diff options
author | Marcin Slusarz <marcin.slusarz@gmail.com> | 2008-10-16 01:03:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-16 14:21:45 -0400 |
commit | c38182a713df5268d8a4a33819a77f93b950f84c (patch) | |
tree | 5c19e8bb3ad02ba9fa0bc6435b0ff626af2ac06a /drivers/video/console | |
parent | 1a3b09dc9aeaaab25ff736c2443df423a8fb655e (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')
-rw-r--r-- | drivers/video/console/vgacon.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index 6df29a62d720..3556268fe0a0 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) | |||
292 | d = (void *) c->vc_origin; | 292 | d = (void *) c->vc_origin; |
293 | s = (void *) c->vc_screenbuf; | 293 | s = (void *) c->vc_screenbuf; |
294 | 294 | ||
295 | while (count--) { | 295 | if (count) { |
296 | scr_memcpyw(d, vgacon_scrollback + soff, c->vc_size_row); | 296 | int copysize; |
297 | d += c->vc_size_row; | 297 | count *= c->vc_size_row; |
298 | soff += c->vc_size_row; | 298 | /* how much memory to end of buffer left? */ |
299 | 299 | copysize = min(count, vgacon_scrollback_size - soff); | |
300 | if (soff >= vgacon_scrollback_size) | 300 | scr_memcpyw(d, vgacon_scrollback + soff, copysize); |
301 | soff = 0; | 301 | d += copysize; |
302 | count -= copysize; | ||
303 | |||
304 | if (count) { | ||
305 | scr_memcpyw(d, vgacon_scrollback, count); | ||
306 | d += count; | ||
307 | } | ||
302 | } | 308 | } |
303 | 309 | ||
304 | if (diff == c->vc_rows) { | 310 | if (diff == c->vc_rows) { |
305 | vgacon_cursor(c, CM_MOVE); | 311 | vgacon_cursor(c, CM_MOVE); |
306 | } else { | 312 | } else { |
307 | while (diff--) { | 313 | if (diff) |
308 | scr_memcpyw(d, s, c->vc_size_row); | 314 | scr_memcpyw(d, s, diff * c->vc_size_row); |
309 | d += c->vc_size_row; | ||
310 | s += c->vc_size_row; | ||
311 | } | ||
312 | } | 315 | } |
313 | 316 | ||
314 | return 1; | 317 | return 1; |