Skip to content

Commit bad07ff

Browse files
Krzysztof-HLinus Torvalds
authored andcommitted
fbcon: smart blitter usage for scrolling
This patch replaces the current SCROLL_MOVE method with smarter method using the same logic as the SCROLL_REDRAW method. This brings these two methods much closer in performance and benefits all framebuffers which uses the SCROLL_MOVE method. [adaplas] - remove unnecessary char attribute checking - whitespace cleanups and 80-column line fixes Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Antonino Daplas <adaplas@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 5d2b56c commit bad07ff

1 file changed

Lines changed: 68 additions & 8 deletions

File tree

‎drivers/video/console/fbcon.c‎

Lines changed: 68 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,6 +1704,56 @@ static void fbcon_redraw_move(struct vc_data *vc, struct display *p,
17041704
}
17051705
}
17061706

1707+
static void fbcon_redraw_blit(struct vc_data *vc, struct fb_info *info,
1708+
struct display *p, int line, int count, int ycount)
1709+
{
1710+
int offset = ycount * vc->vc_cols;
1711+
unsigned short *d = (unsigned short *)
1712+
(vc->vc_origin + vc->vc_size_row * line);
1713+
unsigned short *s = d + offset;
1714+
struct fbcon_ops *ops = info->fbcon_par;
1715+
1716+
while (count--) {
1717+
unsigned short *start = s;
1718+
unsigned short *le = advance_row(s, 1);
1719+
unsigned short c;
1720+
int x = 0;
1721+
1722+
do {
1723+
c = scr_readw(s);
1724+
1725+
if (c == scr_readw(d)) {
1726+
if (s > start) {
1727+
ops->bmove(vc, info, line + ycount, x,
1728+
line, x, 1, s-start);
1729+
x += s - start + 1;
1730+
start = s + 1;
1731+
} else {
1732+
x++;
1733+
start++;
1734+
}
1735+
}
1736+
1737+
scr_writew(c, d);
1738+
console_conditional_schedule();
1739+
s++;
1740+
d++;
1741+
} while (s < le);
1742+
if (s > start)
1743+
ops->bmove(vc, info, line + ycount, x, line, x, 1,
1744+
s-start);
1745+
console_conditional_schedule();
1746+
if (ycount > 0)
1747+
line++;
1748+
else {
1749+
line--;
1750+
/* NOTE: We subtract two lines from these pointers */
1751+
s -= vc->vc_size_row;
1752+
d -= vc->vc_size_row;
1753+
}
1754+
}
1755+
}
1756+
17071757
static void fbcon_redraw(struct vc_data *vc, struct display *p,
17081758
int line, int count, int offset)
17091759
{
@@ -1789,7 +1839,6 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
17891839
{
17901840
struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
17911841
struct display *p = &fb_display[vc->vc_num];
1792-
struct fbcon_ops *ops = info->fbcon_par;
17931842
int scroll_partial = info->flags & FBINFO_PARTIAL_PAN_OK;
17941843

17951844
if (fbcon_is_inactive(vc, info))
@@ -1813,10 +1862,15 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
18131862
goto redraw_up;
18141863
switch (p->scrollmode) {
18151864
case SCROLL_MOVE:
1816-
ops->bmove(vc, info, t + count, 0, t, 0,
1817-
b - t - count, vc->vc_cols);
1818-
ops->clear(vc, info, b - count, 0, count,
1819-
vc->vc_cols);
1865+
fbcon_redraw_blit(vc, info, p, t, b - t - count,
1866+
count);
1867+
fbcon_clear(vc, b - count, 0, count, vc->vc_cols);
1868+
scr_memsetw((unsigned short *) (vc->vc_origin +
1869+
vc->vc_size_row *
1870+
(b - count)),
1871+
vc->vc_video_erase_char,
1872+
vc->vc_size_row * count);
1873+
return 1;
18201874
break;
18211875

18221876
case SCROLL_WRAP_MOVE:
@@ -1899,9 +1953,15 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
18991953
goto redraw_down;
19001954
switch (p->scrollmode) {
19011955
case SCROLL_MOVE:
1902-
ops->bmove(vc, info, t, 0, t + count, 0,
1903-
b - t - count, vc->vc_cols);
1904-
ops->clear(vc, info, t, 0, count, vc->vc_cols);
1956+
fbcon_redraw_blit(vc, info, p, b - 1, b - t - count,
1957+
-count);
1958+
fbcon_clear(vc, t, 0, count, vc->vc_cols);
1959+
scr_memsetw((unsigned short *) (vc->vc_origin +
1960+
vc->vc_size_row *
1961+
t),
1962+
vc->vc_video_erase_char,
1963+
vc->vc_size_row * count);
1964+
return 1;
19051965
break;
19061966

19071967
case SCROLL_WRAP_MOVE:

0 commit comments

Comments
 (0)