patch-2.3.99-pre1 linux/drivers/video/fbmem.c

Next file: linux/drivers/video/hgafb.c
Previous file: linux/drivers/video/fbcon.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.51/linux/drivers/video/fbmem.c linux/drivers/video/fbmem.c
@@ -239,8 +239,14 @@
 static initcall_t pref_init_funcs[FB_MAX];
 static int num_pref_init_funcs __initdata = 0;
 
+
 struct fb_info *registered_fb[FB_MAX];
 int num_registered_fb = 0;
+extern int fbcon_softback_size; 
+
+static int first_fb_vc = 0;
+static int last_fb_vc = MAX_NR_CONSOLES-1;
+static int fbcon_is_default = 1;
 
 static int fbmem_read_proc(char *buf, char **start, off_t offset,
 			   int len, int *eof, void *private)
@@ -418,10 +424,13 @@
 	int fbidx = GET_FB_IDX(file->f_dentry->d_inode->i_rdev);
 	struct fb_info *info = registered_fb[fbidx];
 	struct fb_ops *fb = info->fbops;
+	unsigned long off;
+#if !defined(__sparc__) || defined(__sparc_v9__)
 	struct fb_fix_screeninfo fix;
 	struct fb_var_screeninfo var;
-	unsigned long start, off;
+	unsigned long start;
 	u32 len;
+#endif
 
 	if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT))
 		return -EINVAL;
@@ -520,7 +529,7 @@
 #endif /* !sparc32 */
 }
 
-#if 1 /* to go away in 2.4.0 */
+#if 1 /* to go away in 2.5.0 */
 int GET_FB_IDX(kdev_t rdev)
 {
     int fbidx = MINOR(rdev);
@@ -550,8 +559,6 @@
 #endif /* CONFIG_KMOD */
 	if (!(info = registered_fb[fbidx]))
 		return -ENODEV;
-	if (info->flags & FBINFO_FLAG_OPEN) return -EBUSY; 
-	info->flags |= FBINFO_FLAG_OPEN;		
 	return info->fbops->fb_open(info,1);
 }
 
@@ -562,7 +569,6 @@
 	struct fb_info *info = registered_fb[fbidx];
 
 	info->fbops->fb_release(info,1);
-        info->flags &= ~FBINFO_FLAG_OPEN;
 	return 0;
 }
 
@@ -580,8 +586,10 @@
 int
 register_framebuffer(struct fb_info *fb_info)
 {
+	int i, j;
 	char name_buf[8];
- 	int i;
+	static int fb_ever_opened[FB_MAX];
+	static int first = 1;
 
 	if (num_registered_fb == FB_MAX)
 		return -ENXIO;
@@ -590,9 +598,22 @@
 		if (!registered_fb[i])
 			break;
 	fb_info->node = MKDEV(FB_MAJOR, i);
-	fb_info->flags &= ~FBINFO_FLAG_OPEN;
-	fb_info->count = 0;
 	registered_fb[i] = fb_info;
+	if (!fb_ever_opened[i]) {
+		/*
+		 *  We assume initial frame buffer devices can be opened this
+		 *  many times
+		 */
+		for (j = 0; j < MAX_NR_CONSOLES; j++)
+			if (con2fb_map[j] == i)
+				fb_info->fbops->fb_open(fb_info,0);
+		fb_ever_opened[i] = 1;
+	}
+
+	if (first) {
+		first = 0;
+		take_over_console(&fb_con, first_fb_vc, last_fb_vc, fbcon_is_default);
+	}
 	sprintf (name_buf, "%d", i);
 	fb_info->devfs_handle =
 	    devfs_register (devfs_handle, name_buf, 0, DEVFS_FL_NONE,
@@ -605,12 +626,12 @@
 int
 unregister_framebuffer(struct fb_info *fb_info)
 {
-	int i;
+	int i, j;
 
 	i = GET_FB_IDX(fb_info->node);
-	
-	if (fb_info->count || (fb_info->flags & FBINFO_FLAG_OPEN))
-		return -EBUSY;
+	for (j = 0; j < MAX_NR_CONSOLES; j++)
+		if (con2fb_map[j] == i)
+			return -EBUSY;
 	if (!registered_fb[i])
 		return -EINVAL;
 	devfs_unregister (fb_info->devfs_handle);
@@ -654,6 +675,43 @@
 
     if (!options || !*options)
 	    return 0;
+	    
+    if (!strncmp(options, "scrollback:", 11)) {
+	    options += 11;
+	    if (*options) {
+		fbcon_softback_size = simple_strtoul(options, &options, 0);
+		if (*options == 'k' || *options == 'K') {
+			fbcon_softback_size *= 1024;
+			options++;
+		}
+		if (*options != ',')
+			return 0;
+		options++;
+	    } else
+	        return 0;
+    }
+
+    if (!strncmp(options, "map:", 4)) {
+	    options += 4;
+	    if (*options)
+		    for (i = 0, j = 0; i < MAX_NR_CONSOLES; i++) {
+			    if (!options[j])
+				    j = 0;
+			    con2fb_map[i] = (options[j++]-'0') % FB_MAX;
+		    }
+	    return 0;
+    }
+    
+    if (!strncmp(options, "vc:", 3)) {
+	    options += 3;
+	    if (*options)
+		first_fb_vc = simple_strtoul(options, &options, 10) - 1;
+	    if (first_fb_vc < 0)
+		first_fb_vc = 0;
+	    if (*options++ == '-')
+		last_fb_vc = simple_strtoul(options, &options, 10) - 1;
+	    fbcon_is_default = 0;
+    }
 
     if (num_pref_init_funcs == FB_MAX)
 	    return 0;
@@ -695,6 +753,6 @@
 EXPORT_SYMBOL(unregister_framebuffer);
 EXPORT_SYMBOL(registered_fb);
 EXPORT_SYMBOL(num_registered_fb);
-#if 1 /* to go away in 2.4.0 */
+#if 1 /* to go away in 2.5.0 */
 EXPORT_SYMBOL(GET_FB_IDX);
 #endif

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)