2000-11-16 14:29:16

by Bryan Mayland

[permalink] [raw]
Subject: [PATCH] VESA framebuffer memory detection fix

Hello all. I've seen a problem with the VESA framebuffer console using ywrap
scrolling. When you reach the end of the video memory, the y_scroll variable
wraps before the end of memory, leaving a "black hole" in the last bit of
memory until the rest of the screen wraps around in video memory to be linear
again. I've tried this on several laptops (all Dells, but different models)
around the office and they all behave the same. I tracked the problem down to
the video.S setup code, where the kernel calls the good 'ole INT 10h (AX =
4f00h), the amount of 64 KB video frames is coming back one lower than there
actually is. I therefore went ahead and modified the VESA frambuffer code to
allow the user to set the amount of memory from the command line with the
standard
mem=XXX[kKmM] format. I posted this patch back in the 2.3.18 days, but I've
still yet to see it show up in the kernel, and I've never even received
criticism for it :)

Bry

diff -uNr linux/Documentation/fb/vesafb.txt
linux-2.4.0-test10/Documentation/fb/vesafb.txt
--- linux/Documentation/fb/vesafb.txt Fri Jul 28 15:50:51 2000
+++ linux-2.4.0-test10/Documentation/fb/vesafb.txt Fri Aug 18 17:13:27 2000
@@ -146,6 +146,12 @@

mtrr setup memory type range registers for the vesafb framebuffer.

+mem Override the amount of memory reported by the VESA BIOS
+ INT 10h (AX=4f00h). Some VBE implementations misreport the
+ amount of video memory, causing a "black hole" when using ywrap
+ every time the end of the memory is reached. If you enter a
+ value here larger than you actually have, you will more than
+ likely lock your system so be careful! Syntax is mem=XXX[kKmM]

Have fun!

@@ -156,3 +162,4 @@

Minor (mostly typo) changes
by Nico Schmoigl <[email protected]>
+mem option added by Bryan Mayland <[email protected]>
--- linux/drivers/video/vesafb.c Wed Jul 26 14:08:41 2000
+++ linux-2.4.0-test10/drivers/video/vesafb.c Fri Aug 18 17:16:03 2000
@@ -452,7 +452,8 @@
{
char *this_opt;

- fb_info.fontname[0] = '\0';
+ fb_info.fontname[0] = '\0';
+ video_size = 0;

if (!options || !*options)
return 0;
@@ -476,6 +477,13 @@
mtrr=1;
else if (!strncmp(this_opt, "font:", 5))
strcpy(fb_info.fontname, this_opt+5);
+ else if (!strncmp(this_opt, "mem=", 4)) {
+ video_size = simple_strtoul(this_opt + 4, &this_opt, 0);
+ if (*this_opt == 'K' || *this_opt == 'k')
+ video_size <<= 10;
+ else if (*this_opt=='M' || *this_opt=='m')
+ video_size <<= 20;
+ }
}
return 0;
}
@@ -515,7 +523,9 @@
video_width = screen_info.lfb_width;
video_height = screen_info.lfb_height;
video_linelength = screen_info.lfb_linelength;
- video_size = screen_info.lfb_size * 65536;
+ /* video_size may have been overriden by a command line option */
+ if (!video_size)
+ video_size = screen_info.lfb_size * 65536;
video_visual = (video_bpp == 8) ?
FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;