aboutsummaryrefslogtreecommitdiff
path: root/drivers/video/console/vgacon.c
diff options
context:
space:
mode:
authorMarcin Slusarz <marcin.slusarz@gmail.com>2008-10-15 22:03:49 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-16 11:21:45 -0700
commitc38182a713df5268d8a4a33819a77f93b950f84c (patch)
tree5c19e8bb3ad02ba9fa0bc6435b0ff626af2ac06a /drivers/video/console/vgacon.c
parent1a3b09dc9aeaaab25ff736c2443df423a8fb655e (diff)
vgacon: optimize scrolling
Join multiple scr_memcpyw into 1-3 calls (usually 2). (benchmarked average speedup: 1%) Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Cc: Antonino Daplas <adaplas@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/console/vgacon.c')
-rw-r--r--drivers/video/console/vgacon.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index 6df29a62d72..3556268fe0a 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -292,23 +292,26 @@ static int vgacon_scrolldelta(struct vc_data *c, int lines)
d = (void *) c->vc_origin;
s = (void *) c->vc_screenbuf;
- while (count--) {
- scr_memcpyw(d, vgacon_scrollback + soff, c->vc_size_row);
- d += c->vc_size_row;
- soff += c->vc_size_row;
-
- if (soff >= vgacon_scrollback_size)
- soff = 0;
+ if (count) {
+ int copysize;
+ count *= c->vc_size_row;
+ /* how much memory to end of buffer left? */
+ copysize = min(count, vgacon_scrollback_size - soff);
+ scr_memcpyw(d, vgacon_scrollback + soff, copysize);
+ d += copysize;
+ count -= copysize;
+
+ if (count) {
+ scr_memcpyw(d, vgacon_scrollback, count);
+ d += count;
+ }
}
if (diff == c->vc_rows) {
vgacon_cursor(c, CM_MOVE);
} else {
- while (diff--) {
- scr_memcpyw(d, s, c->vc_size_row);
- d += c->vc_size_row;
- s += c->vc_size_row;
- }
+ if (diff)
+ scr_memcpyw(d, s, diff * c->vc_size_row);
}
return 1;