[PATCH] fbcon scrollback w/ bootlogo

Kurt Garloff (garloff@kg1.ping.de)
Thu, 22 Oct 1998 02:18:42 +0200


--XsQoSWH+UP9D9v3l
Content-Type: text/plain; charset=us-ascii

Hi Geert, Martin, Jakub, Linus, L-Kernel people,

I really like the bootlogo (and I even installed the bootlogo-select patch
by Clifford Wolf to have more of them), but one thing I really dislike, that
I cannot see my boot messages using the scrollback feature.

OK, I placed the boot logo(s) at the right hand side of the screen and
modified the scroll up routines to copy only the space taken by the logo if
it is displayed and we have a top region.
It did take me some time, cause I did no have any experience with the fb
code. I think it's clean, but you may want to look over it.
I also changed the heuristic when to use redraw instaed of ypan/ywrap a
little bit to avoid redraw.
Patch for this is appended.

I created another small patch, which lets the screen scroll more than one
line at a time and thus have the ouput scroll in larger chunks. This should
help people with a slow console a lot. Also it makes reading of scrolling
output easier.
It makes the logo look nicer, too:
The #define used by me sets the scrolling to 5 lines on my 36 line display
(matroxfb), which with a standard 8x16 font results in the logo being
redisplayed as a whole.
Of course one could change the heuristic to calculate the # of linesto scroll
up each time or set it to a fixed value of 2.
BTW: I found a problem with this patch: less won't scroll as it is supposed
to. So this might need some rework, as the console code may assume that
scroll one line down and lf are identical which isn't any longer.

2nd patch appended for this.

I hope somebody likes these patches ...

There is one thing in fbcon which is still annoying: If you scrollback, your
mouse (selection/gpm) does not follow the screen but is restricted to the
lowest vc_rows of it. Too bad. Sometimes you need to have something selected
which you only reach via the scrollback feature.
I would really like somebody adress this. From a first glance, I don't have
any idea how to do it myself.

Happy hacking,

-- 
Kurt Garloff <K.Garloff@ping.de>  (Dortmund, FRG)
PGP key on http://student.physik.uni-dortmund.de/homepages/garloff
Unix IS user friendly - it's just selective about who its friends are!

--XsQoSWH+UP9D9v3l Content-Type: text/plain; charset=us-ascii Content-Description: 21125-fbcon-logo-scroll.diff Content-Disposition: attachment; filename="21125-fbcon-logo-scroll.diff"

--- linux/drivers/video/fbcon.c.orig Wed Oct 21 00:22:30 1998 +++ linux/drivers/video/fbcon.c Thu Oct 22 01:33:48 1998 @@ -481,7 +481,7 @@ nr_cols = p->var.xres/fontwidth(p); nr_rows = p->var.yres/fontheight(p); - + if (logo) { /* Need to make room for the logo */ int cnt; @@ -490,17 +490,17 @@ logo_lines = (LOGO_H + fontheight(p) - 1) / fontheight(p); q = (unsigned short *)(conp->vc_origin + conp->vc_size_row * old_rows); step = logo_lines * old_cols; - for (r = q - logo_lines * old_cols; r < q; r++) - if (*r != conp->vc_video_erase_char) - break; + for (r = q - logo_lines * old_cols; r < q; r++) + if (*r != conp->vc_video_erase_char) + break; if (r != q && nr_rows >= old_rows + logo_lines) { save = kmalloc(logo_lines * nr_cols * 2, GFP_KERNEL); if (save) { - int i = old_cols < nr_cols ? old_cols : nr_cols; - scr_memsetw(save, conp->vc_video_erase_char, logo_lines * nr_cols * 2); - r = q - step; - for (cnt = 0; cnt < logo_lines; cnt++, r += i) - scr_memcpyw_to(save + cnt * nr_cols, r, 2 * i); + int i = old_cols < nr_cols ? old_cols : nr_cols; + scr_memsetw(save, conp->vc_video_erase_char, logo_lines * nr_cols * 2); + r = q - step; + for (cnt = 0; cnt < logo_lines; cnt++, r += i) + scr_memcpyw_to(save + cnt * nr_cols, r, 2 * i); r = q; } } @@ -942,6 +942,7 @@ int unit = conp->vc_num; struct display *p = &fb_display[unit]; int is_txt = (p->type == FB_TYPE_TEXT); + int logos_left = 0; int logos_width = conp->vc_cols; if (!p->can_soft_blank && console_blanked) return 0; @@ -959,6 +960,18 @@ switch (dir) { case SM_UP: + /* K.Garloff@ping.de, 98/10/21: If logo is diplayed, only save logo + * and not the hole top region. In combination with the logo being + * displayed on the right side, this allows scrollback feature + * when bootlogo is displayed. */ + if (t != 0 && logo_shown == fg_console) { + int unit = conp->vc_num; + struct display *p = &fb_display[unit]; + int lw = (smp_num_cpus * (LOGO_W + 8) - 7) / fontwidth(p) + 1; + logos_left = conp->vc_cols - lw; + if (logos_left < 0) logos_left = 0; + else logos_width = lw; + } if (count > conp->vc_rows) /* Maximum realistic size */ count = conp->vc_rows; switch (p->scrollmode & __SCROLL_YMASK) { @@ -970,11 +983,10 @@ break; case __SCROLL_YWRAP: - if (b-t-count > 3*conp->vc_rows>>2) { + if (b-t-count > 2*conp->vc_rows/3) { if (t > 0) - fbcon_bmove(conp, 0, 0, count, 0, t, - conp->vc_cols); - ywrap_up(unit, conp, p, count); + fbcon_bmove(conp, 0, logos_left, count, logos_left, t, logos_width); + ywrap_up(unit, conp, p, count); if (conp->vc_rows-b > 0) fbcon_bmove(conp, b-count, 0, b, 0, conp->vc_rows-b, conp->vc_cols); @@ -988,10 +1000,9 @@ case __SCROLL_YPAN: if (( is_txt && (b-t == conp->vc_rows)) || - (!is_txt && (b-t-count > 3*conp->vc_rows>>2))) { + (!is_txt && (b-t-count > 2*conp->vc_rows/3))) { if (t > 0) - fbcon_bmove(conp, 0, 0, count, 0, t, - conp->vc_cols); + fbcon_bmove(conp, 0, logos_left, count, logos_left, t, logos_width); ypan_up(unit, conp, p, count); if (conp->vc_rows-b > 0) fbcon_bmove(conp, b-count, 0, b, 0, @@ -1670,8 +1681,8 @@ logo_depth = 1; } - for (x = 0; x < smp_num_cpus * (LOGO_W + 8) && - x < p->var.xres - (LOGO_W + 8); x += (LOGO_W + 8)) { + for (x = p->var.xres - LOGO_W; x > 0 && x > p->var.xres + - smp_num_cpus * (LOGO_W + 8); x -= (LOGO_W + 8)) { #if defined(CONFIG_FBCON_CFB16) || defined(CONFIG_FBCON_CFB24) || \ defined(CONFIG_FBCON_CFB32) || defined(CONFIG_FB_SBUS)

--XsQoSWH+UP9D9v3l Content-Type: text/plain; charset=us-ascii Content-Description: 21125-console-scroll.diff Content-Disposition: attachment; filename="21125-console-scroll.diff"

--- linux/drivers/char/console.c.orig Thu Oct 22 00:17:51 1998 +++ linux/drivers/char/console.c Thu Oct 22 02:02:16 1998 @@ -849,13 +849,20 @@ scrolldelta(lines); } +/* Scroll multiple lines in one take; 5 is a beautiful default for + * bootlogos and fonts w/ 16 p. height. The value below was calculated + * to avoid redraw. K.Garloff@ping.de, 98/10/22 */ +#define CONS_SCROLL_LN (video_num_lines*5/17-5) static void lf(int currcons) { /* don't scroll if above bottom of scrolling region, or * if below scrolling region */ - if (y+1 == bottom) - scrup(currcons,top,bottom,1); + if (y+1 == bottom) { + scrup(currcons,top,bottom,CONS_SCROLL_LN); + y -= (CONS_SCROLL_LN - 1); + pos -= video_size_row * (CONS_SCROLL_LN - 1); + } else if (y < video_num_lines-1) { y++; pos += video_size_row; @@ -868,8 +875,11 @@ /* don't scroll if below top of scrolling region, or * if above scrolling region */ - if (y == top) - scrdown(currcons,top,bottom,1); + if (y == top) { + scrdown(currcons,top,bottom,CONS_SCROLL_LN); + y += (CONS_SCROLL_LN - 1); + pos += video_size_row * (CONS_SCROLL_LN - 1); + } else if (y > 0) { y--; pos -= video_size_row;

--XsQoSWH+UP9D9v3l--

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/