Commit c38182a7 authored by Marcin Slusarz's avatar Marcin Slusarz Committed by Linus Torvalds

vgacon: optimize scrolling

Join multiple scr_memcpyw into 1-3 calls (usually 2).  (benchmarked
average speedup: 1%)
Signed-off-by: default avatarMarcin Slusarz <marcin.slusarz@gmail.com>
Cc: Krzysztof Helt <krzysztof.h1@poczta.fm>
Cc: Antonino Daplas <adaplas@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 1a3b09dc
...@@ -292,23 +292,26 @@ static int vgacon_scrolldelta(struct vc_data *c, int lines) ...@@ -292,23 +292,26 @@ static int vgacon_scrolldelta(struct vc_data *c, int lines)
d = (void *) c->vc_origin; d = (void *) c->vc_origin;
s = (void *) c->vc_screenbuf; s = (void *) c->vc_screenbuf;
while (count--) { if (count) {
scr_memcpyw(d, vgacon_scrollback + soff, c->vc_size_row); int copysize;
d += c->vc_size_row; count *= c->vc_size_row;
soff += c->vc_size_row; /* how much memory to end of buffer left? */
copysize = min(count, vgacon_scrollback_size - soff);
if (soff >= vgacon_scrollback_size) scr_memcpyw(d, vgacon_scrollback + soff, copysize);
soff = 0; d += copysize;
count -= copysize;
if (count) {
scr_memcpyw(d, vgacon_scrollback, count);
d += count;
}
} }
if (diff == c->vc_rows) { if (diff == c->vc_rows) {
vgacon_cursor(c, CM_MOVE); vgacon_cursor(c, CM_MOVE);
} else { } else {
while (diff--) { if (diff)
scr_memcpyw(d, s, c->vc_size_row); scr_memcpyw(d, s, diff * c->vc_size_row);
d += c->vc_size_row;
s += c->vc_size_row;
}
} }
return 1; return 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment