
From: "Antonino A. Daplas" <adaplas@hotpop.com>

- Reduce pixmap size allocated by fbmem, i810fb and rivafb from 16-64K to
  8K.  This size is sufficient that a single putcs call can be accomodated by
  a single imageblit

- Replace NR_FB_DRIVERS with FB_MAX

- Trivial code, Kconfig and Documentation cleanup

Signed-off-by: Antonino Daplas <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/drivers/video/Kconfig          |    6 +++---
 25-akpm/drivers/video/console/fbcon.c  |   12 ++++++------
 25-akpm/drivers/video/fbmem.c          |    9 ++++-----
 25-akpm/drivers/video/i810/i810_main.c |    6 +++---
 25-akpm/drivers/video/riva/fbdev.c     |    6 +++---
 5 files changed, 19 insertions(+), 20 deletions(-)

diff -puN drivers/video/console/fbcon.c~fbdev-reduce-pixmap-memory-allocation-size drivers/video/console/fbcon.c
--- 25/drivers/video/console/fbcon.c~fbdev-reduce-pixmap-memory-allocation-size	Wed Oct 20 15:44:47 2004
+++ 25-akpm/drivers/video/console/fbcon.c	Wed Oct 20 15:44:47 2004
@@ -337,24 +337,24 @@ __setup("fbcon=", fb_console_setup);
 
 static int search_fb_in_map(int idx)
 {
-	int i;
+	int i, retval = 0;
 
 	for (i = 0; i < MAX_NR_CONSOLES; i++) {
 		if (con2fb_map[i] == idx)
-			return 1;
+			retval = 1;
 	}
-	return 0;
+	return retval;
 }
 
 static int search_for_mapped_con(void)
 {
-	int i;
+	int i, retval = 0;
 
 	for (i = 0; i < MAX_NR_CONSOLES; i++) {
 		if (con2fb_map[i] != -1)
-			return 1;
+			retval = 1;
 	}
-	return 0;
+	return retval;
 }
 
 static int fbcon_takeover(int show_logo)
diff -puN drivers/video/fbmem.c~fbdev-reduce-pixmap-memory-allocation-size drivers/video/fbmem.c
--- 25/drivers/video/fbmem.c~fbdev-reduce-pixmap-memory-allocation-size	Wed Oct 20 15:44:47 2004
+++ 25-akpm/drivers/video/fbmem.c	Wed Oct 20 15:44:47 2004
@@ -51,7 +51,7 @@
      *  Frame buffer device initialization and setup routines
      */
 
-#define FBPIXMAPSIZE	16384
+#define FBPIXMAPSIZE	(1024 * 8)
 
 static struct notifier_block *fb_notifier_list;
 struct fb_info *registered_fb[FB_MAX];
@@ -1307,8 +1307,7 @@ fbmem_init(void)
 }
 module_init(fbmem_init);
 
-#define NR_FB_DRIVERS 64
-static char *video_options[NR_FB_DRIVERS];
+static char *video_options[FB_MAX];
 static int ofonly;
 
 /**
@@ -1329,7 +1328,7 @@ int fb_get_options(char *name, char **op
 		retval = 1;
 
 	if (name_len && !retval) {
-		for (i = 0; i < NR_FB_DRIVERS; i++) {
+		for (i = 0; i < FB_MAX; i++) {
 			if (video_options[i] == NULL)
 				continue;
 			opt_len = strlen(video_options[i]);
@@ -1371,7 +1370,7 @@ int __init video_setup(char *options)
 	if (!options || !*options)
 		return 0;
 
-	for (i = 0; i < NR_FB_DRIVERS; i++) {
+	for (i = 0; i < FB_MAX; i++) {
 		if (!strncmp(options, "ofonly", 6))
 			ofonly = 1;
 		if (video_options[i] == NULL) {
diff -puN drivers/video/i810/i810_main.c~fbdev-reduce-pixmap-memory-allocation-size drivers/video/i810/i810_main.c
--- 25/drivers/video/i810/i810_main.c~fbdev-reduce-pixmap-memory-allocation-size	Wed Oct 20 15:44:47 2004
+++ 25-akpm/drivers/video/i810/i810_main.c	Wed Oct 20 15:44:47 2004
@@ -1874,12 +1874,12 @@ static int __devinit i810fb_init_pci (st
 	par = (struct i810fb_par *) info->par;
 	par->dev = dev;
 
-	if (!(info->pixmap.addr = kmalloc(64*1024, GFP_KERNEL))) {
+	if (!(info->pixmap.addr = kmalloc(8*1024, GFP_KERNEL))) {
 		i810fb_release_resource(info, par);
 		return -ENOMEM;
 	}
-	memset(info->pixmap.addr, 0, 64*1024);
-	info->pixmap.size = 64*1024;
+	memset(info->pixmap.addr, 0, 8*1024);
+	info->pixmap.size = 8*1024;
 	info->pixmap.buf_align = 8;
 	info->pixmap.flags = FB_PIXMAP_SYSTEM;
 
diff -puN drivers/video/Kconfig~fbdev-reduce-pixmap-memory-allocation-size drivers/video/Kconfig
--- 25/drivers/video/Kconfig~fbdev-reduce-pixmap-memory-allocation-size	Wed Oct 20 15:44:47 2004
+++ 25-akpm/drivers/video/Kconfig	Wed Oct 20 15:44:47 2004
@@ -41,7 +41,7 @@ config FB
 config FB_MODE_HELPERS
         bool "Enable Video Mode Handling Helpers"
         depends on FB
-	default y
+	default n
 	---help---
 	  This enables functions for handling video modes using the
 	  Generalized Timing Formula and the EDID parser. A few drivers rely
@@ -61,10 +61,10 @@ config FB_TILEBLITTING
 	 parameters in terms of number of tiles instead of number of pixels.
 	 For example, to draw a single character, instead of using bitmaps,
 	 an index to an array of bitmaps will be used.  To clear or move a
-	 rectangular section of a screen, the rectangle willbe described in
+	 rectangular section of a screen, the rectangle will be described in
 	 terms of number of tiles in the x- and y-axis.
 
-	 This is particularly important to one driver, the matroxfb.  If
+	 This is particularly important to one driver, matroxfb.  If
 	 unsure, say N.
 
 config FB_CIRRUS
diff -puN drivers/video/riva/fbdev.c~fbdev-reduce-pixmap-memory-allocation-size drivers/video/riva/fbdev.c
--- 25/drivers/video/riva/fbdev.c~fbdev-reduce-pixmap-memory-allocation-size	Wed Oct 20 15:44:47 2004
+++ 25-akpm/drivers/video/riva/fbdev.c	Wed Oct 20 15:44:47 2004
@@ -1679,7 +1679,7 @@ static int __devinit riva_set_fbinfo(str
 	cmap_len = riva_get_cmap_len(&info->var);
 	fb_alloc_cmap(&info->cmap, cmap_len, 0);	
 
-	info->pixmap.size = 64 * 1024;
+	info->pixmap.size = 8 * 1024;
 	info->pixmap.buf_align = 4;
 	info->pixmap.scan_align = 4;
 	info->pixmap.flags = FB_PIXMAP_SYSTEM;
@@ -1866,10 +1866,10 @@ static int __devinit rivafb_probe(struct
 	default_par = (struct riva_par *) info->par;
 	default_par->pdev = pd;
 
-	info->pixmap.addr = kmalloc(64 * 1024, GFP_KERNEL);
+	info->pixmap.addr = kmalloc(8 * 1024, GFP_KERNEL);
 	if (info->pixmap.addr == NULL)
 		goto err_out_kfree;
-	memset(info->pixmap.addr, 0, 64 * 1024);
+	memset(info->pixmap.addr, 0, 8 * 1024);
 
 	if (pci_enable_device(pd)) {
 		printk(KERN_ERR PFX "cannot enable PCI device\n");
_
