Skip to contentSkip to conversation

fbdev: Reduce pixmap memory allocation size

PATCH New Antonino A. Daplas 1 participant 1 message Oct 20, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/8 fbdev: Reduce pixmap memory allocation size

- 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

---
 Kconfig          |    6 +++---
 console/fbcon.c  |   12 ++++++------
 fbmem.c          |    9 ++++-----
 i810/i810_main.c |    6 +++---
 riva/fbdev.c     |    6 +++---
 5 files changed, 19 insertions(+), 20 deletions(-)
drivers/video/Kconfig +3 -3
diff -Nru a/drivers/video/Kconfig b/drivers/video/Kconfig
@@ -41,7 +41,7 @@
 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 @@
 	 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
drivers/video/console/fbcon.c +6 -6
diff -Nru a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
@@ -337,24 +337,24 @@
 
 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)
drivers/video/fbmem.c +4 -5
diff -Nru a/drivers/video/fbmem.c b/drivers/video/fbmem.c
@@ -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 @@
 }
 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 @@
 		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 @@
 	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) {
drivers/video/i810/i810_main.c +3 -3
diff -Nru a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c
@@ -1874,12 +1874,12 @@
 	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;
 
drivers/video/riva/fbdev.c +3 -3
diff -Nru a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
@@ -1679,7 +1679,7 @@
 	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 @@
 	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");

-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl