Messages in this thread Patches in this message | | | Date | Mon, 27 Sep 1999 15:34:41 -0400 | From | Bryan Mayland <> | Subject | VESA framebuffer memory detection |
| |
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. Here's the patch and the documentation:
Bry
diff -ur linux-2.3.18/Documentation/fb/vesafb.txt linux/Documentation/fb/vesafb.txt --- linux-2.3.18/Documentation/fb/vesafb.txt Thu Apr 29 14:53:41 1999 +++ linux/Documentation/fb/vesafb.txt Mon Sep 27 14:42:38 1999 @@ -146,7 +146,13 @@
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! Gerd @@ -154,5 +160,6 @@ -- Gerd Knorr <kraxel@goldbach.in-berlin.de>
-Minor (mostly typo) changes +Minor (mostly typo) changes by Nico Schmoigl <schmoigl@rumms.uni-mannheim.de> +mem option added by Bryan Mayland <bmayland@leonindev.com> diff -ur linux-2.3.18/drivers/video/vesafb.c linux/drivers/video/vesafb.c --- linux-2.3.18/drivers/video/vesafb.c Mon Sep 27 14:59:17 1999 +++ linux/drivers/video/vesafb.c Mon Sep 27 15:06:55 1999 @@ -475,6 +475,7 @@ char *this_opt;
fb_info.fontname[0] = '\0'; + video_size = 0;
if (!options || !*options) return 0; @@ -498,6 +499,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; } @@ -535,7 +543,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;
diff -ur linux-2.3.18/Documentation/fb/vesafb.txt linux/Documentation/fb/vesafb.txt --- linux-2.3.18/Documentation/fb/vesafb.txt Thu Apr 29 14:53:41 1999 +++ linux/Documentation/fb/vesafb.txt Mon Sep 27 14:42:38 1999 @@ -146,7 +146,13 @@ 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! Gerd @@ -154,5 +160,6 @@ -- Gerd Knorr <kraxel@goldbach.in-berlin.de> -Minor (mostly typo) changes +Minor (mostly typo) changes by Nico Schmoigl <schmoigl@rumms.uni-mannheim.de> +mem option added by Bryan Mayland <bmayland@leonindev.com> diff -ur linux-2.3.18/drivers/video/vesafb.c linux/drivers/video/vesafb.c --- linux-2.3.18/drivers/video/vesafb.c Mon Sep 27 14:59:17 1999 +++ linux/drivers/video/vesafb.c Mon Sep 27 15:06:55 1999 @@ -475,6 +475,7 @@ char *this_opt; fb_info.fontname[0] = '\0'; + video_size = 0; if (!options || !*options) return 0; @@ -498,6 +499,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; } @@ -535,7 +543,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; | |