summaryrefslogtreecommitdiffstats
path: root/sys/dev/syscons/fire
diff options
context:
space:
mode:
authorphilip <philip@FreeBSD.org>2007-02-21 12:27:12 +0000
committerphilip <philip@FreeBSD.org>2007-02-21 12:27:12 +0000
commite0f499d1d4431d2e6df14594352d3b4828252d6f (patch)
tree8f2df30a1e9c79b8e09d7dc29d55cee093923b96 /sys/dev/syscons/fire
parent74bf41b149bacbb9c41cd49e28a27658d11313c2 (diff)
downloadFreeBSD-src-e0f499d1d4431d2e6df14594352d3b4828252d6f.zip
FreeBSD-src-e0f499d1d4431d2e6df14594352d3b4828252d6f.tar.gz
Optimize set_origin() use in some screensavers to stop them eating
cpu power when the origin hasn't changed. PR: kern/100683 Submitted by: Gareth McCaughan <gareth -dot- mccaughan -at- pobox.com> MFC after: 3 days
Diffstat (limited to 'sys/dev/syscons/fire')
-rw-r--r--sys/dev/syscons/fire/fire_saver.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/dev/syscons/fire/fire_saver.c b/sys/dev/syscons/fire/fire_saver.c
index 0bc031c..de60a20 100644
--- a/sys/dev/syscons/fire/fire_saver.c
+++ b/sys/dev/syscons/fire/fire_saver.c
@@ -52,6 +52,12 @@
#define GREEN(n) ((n) * 3 + 1)
#define BLUE(n) ((n) * 3 + 2)
+#define SET_ORIGIN(adp, o) do { \
+ int oo = o; \
+ if (oo != last_origin) \
+ set_origin(adp, last_origin = oo); \
+ } while (0)
+
static u_char *buf;
static u_char *vid;
static int banksize, scrmode, bpsl, scrw, scrh;
@@ -63,6 +69,7 @@ fire_update(video_adapter_t *adp)
{
int x, y;
int o, p;
+ int last_origin = -1;
/* make a new bottom line */
for (x = 0, y = scrh; x < scrw; x++)
@@ -87,12 +94,12 @@ fire_update(video_adapter_t *adp)
p -= banksize;
o += banksize;
}
- set_origin(adp, o);
+ SET_ORIGIN(adp, o);
if (p + scrw < banksize) {
bcopy(buf + y * scrw, vid + p, scrw);
} else {
bcopy(buf + y * scrw, vid + p, banksize - p);
- set_origin(adp, o + banksize);
+ SET_ORIGIN(adp, o + banksize);
bcopy(buf + y * scrw + (banksize - p), vid,
scrw - (banksize - p));
p -= banksize;
OpenPOWER on IntegriCloud