]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] fbdev: split vesafb option vram into vtotal and vremap
authorAntonino Daplas <adaplas@hotpop.com>
Tue, 19 Oct 2004 01:08:40 +0000 (18:08 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 19 Oct 2004 01:08:40 +0000 (18:08 -0700)
From: Gerd Knorr <kraxel@bytesex.org>:

"IMHO the the only sane thing is to have two options for total + remapped
memory as well.  Otherwise we'll end up changing that back and forth like
it happened for the size calculation stuff for quite some time ...

The patch below does just that and also has the other vmode fix
(vmode = yres * linelength /* instead of yres * xres * depth >> 3 */)."

Signed-off-by: Antonino Daplas <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Documentation/fb/vesafb.txt
drivers/video/vesafb.c

index 36beb54f1a576f66da10d9ca530106d9ece67502..814e2f56a6ad35ce367e2d542769664c8b6641f3 100644 (file)
@@ -146,11 +146,16 @@ pmipal    Use the protected mode interface for palette changes.
 
 mtrr   setup memory type range registers for the vesafb framebuffer.
 
-vram:n remap 'n' MiB of video RAM. If 0 or not specified, remap memory
+vremap:n
+        remap 'n' MiB of video RAM. If 0 or not specified, remap memory
        according to video mode. (2.5.66 patch/idea by Antonino Daplas
        reversed to give override possibility (allocate more fb memory
        than the kernel would) to 2.4 by tmb@iki.fi)
 
+vtotal:n
+        if the video BIOS of your card incorrectly determines the total
+        amount of video RAM, use this option to override the BIOS (in MiB).
+
 Have fun!
 
   Gerd
index 632ee47b8d70fe22aebf938ed854f2edfbe371a5..9429e6c63708bc3a99c3297bfb5ad2ebe39bb0fc 100644 (file)
@@ -49,7 +49,8 @@ static struct fb_fix_screeninfo vesafb_fix __initdata = {
 
 static int             inverse   = 0;
 static int             mtrr      = 1;
-static int            vram __initdata = 0; /* Set amount of memory to be used */
+static int            vram_remap __initdata = 0; /* Set amount of memory to be used */
+static int            vram_total __initdata = 0; /* Set total amount of memory */
 static int             pmi_setpal = 0; /* pmi for palette changes ??? */
 static int             ypan       = 0;  /* 0..nothing, 1..ypan, 2..ywrap */
 static unsigned short  *pmi_base  = NULL;
@@ -209,8 +210,10 @@ int __init vesafb_setup(char *options)
                        mtrr=1;
                else if (! strcmp(this_opt, "nomtrr"))
                        mtrr=0;
-               else if (! strncmp(this_opt, "vram:", 5))
-                       vram = simple_strtoul(this_opt+5, NULL, 0);
+               else if (! strncmp(this_opt, "vtotal:", 7))
+                       vram_total = simple_strtoul(this_opt+7, NULL, 0);
+               else if (! strncmp(this_opt, "vremap:", 7))
+                       vram_remap = simple_strtoul(this_opt+7, NULL, 0);
        }
        return 0;
 }
@@ -240,11 +243,14 @@ static int __init vesafb_probe(struct device *device)
        /*   size_vmode -- that is the amount of memory needed for the
         *                 used video mode, i.e. the minimum amount of
         *                 memory we need. */
-       size_vmode = vesafb_fix.line_length * vesafb_defined.yres;
+       size_vmode = vesafb_defined.yres * vesafb_fix.line_length;
 
        /*   size_total -- all video memory we have. Used for mtrr
-        *                 entries and bounds checking. */
+        *                 entries, ressource allocation and bounds
+        *                 checking. */
        size_total = screen_info.lfb_size * 65536;
+       if (vram_total)
+               size_total = vram_total * 1024 * 1024;
        if (size_total < size_vmode)
                size_total = size_vmode;
 
@@ -252,10 +258,11 @@ static int __init vesafb_probe(struct device *device)
         *                 use for vesafb.  With modern cards it is no
         *                 option to simply use size_total as that
         *                 wastes plenty of kernel address space. */
-       size_remap = size_vmode * 2;
-       if (vram)
-               size_remap = vram * 1024 * 1024;
-
+       size_remap  = size_vmode * 2;
+       if (vram_remap)
+               size_remap = vram_remap * 1024 * 1024;
+       if (size_remap < size_vmode)
+               size_remap = size_vmode;
        if (size_remap > size_total)
                size_remap = size_total;
        vesafb_fix.smem_len = size_remap;