Re: fbset doesn't change resolution for all consoles

"Antonino A. Daplas" <[email protected]>
Newsgroups gmane.linux.fbdev.user
Message-ID <[email protected]>
On Tuesday 26 April 2005 22:30, Grzegorz Adam Hankiewicz wrote:
> On 2005-04-26, "Antonino A. Daplas" <[email protected]> wrote:
> > Not a bug in fbset, but is due to changes in fbcon code from
> > 2.4->2.6.  Now, only the visible console will respond to fbset
> > requests.
> >
> > I'll see what I can do about this bug.
>
> Tell me if I can help in any way.

Can you test this patch?  This is against my tree which is based on
2.6.12-rc2-mm3 for this patch, but you can use other kernels if you're
willing to fix hunks.

Tony

diff -Nru a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
--- a/drivers/video/console/fbcon.c	2005-03-23 11:53:44 +08:00
+++ b/drivers/video/console/fbcon.c	2005-04-27 11:37:20 +08:00
@@ -2598,6 +2598,51 @@
 	}
 }
 
+static void fbcon_set_all_vcs(struct fb_info *info)
+{
+	struct fbcon_ops *ops = info->fbcon_par;
+	struct vc_data *vc;
+	struct display *p;
+	int i, rows, cols;
+
+	if (!ops || ops->currcon < 0)
+		return;
+	
+	for (i = 0; i < MAX_NR_CONSOLES; i++) {
+		vc = vc_cons[i].d;
+		if (!vc || vc->vc_mode != KD_TEXT ||
+		    registered_fb[con2fb_map[i]] != info)
+			continue;
+		
+		p = &fb_display[vc->vc_num];
+
+		info->var.xoffset = info->var.yoffset = p->yscroll = 0;
+		var_to_display(p, &info->var, info);
+		cols = info->var.xres / vc->vc_font.width;
+		rows = info->var.yres / vc->vc_font.height;
+		vc_resize(vc, cols, rows);
+
+		if (CON_IS_VISIBLE(vc)) {
+			updatescrollmode(p, info, vc);
+			scrollback_max = 0;
+			scrollback_current = 0;
+			update_var(vc->vc_num, info);
+			fbcon_set_palette(vc, color_table);
+			update_screen(vc);
+			if (softback_buf) {
+				int l = fbcon_softback_size / vc->vc_size_row;
+				if (l > 5)
+					softback_end = softback_buf + l * vc->vc_size_row;
+				else {
+					/* Smaller scrollback makes no sense, and 0
+					   would screw the operation totally */
+					softback_top = 0;
+				}
+			}
+		}
+	}
+}	
+
 static int fbcon_mode_deleted(struct fb_info *info,
 			      struct fb_videomode *mode)
 {
@@ -2712,6 +2757,9 @@
 		break;
 	case FB_EVENT_MODE_CHANGE:
 		fbcon_modechanged(info);
+		break;
+	case FB_EVENT_MODE_CHANGE_ALL:
+		fbcon_set_all_vcs(info);
 		break;
 	case FB_EVENT_MODE_DELETE:
 		mode = event->data;
diff -Nru a/drivers/video/fbmem.c b/drivers/video/fbmem.c
--- a/drivers/video/fbmem.c	2005-04-14 12:06:43 +08:00
+++ b/drivers/video/fbmem.c	2005-04-27 11:37:20 +08:00
@@ -729,11 +729,13 @@
 
 			if (!err && info->flags & FBINFO_MISC_USEREVENT) {
 				struct fb_event event;
+				int evnt = (var->activate & FB_ACTIVATE_ALL) ?
+					FB_EVENT_MODE_CHANGE_ALL :
+					FB_EVENT_MODE_CHANGE;
 
 				info->flags &= ~FBINFO_MISC_USEREVENT;
 				event.info = info;
-				notifier_call_chain(&fb_notifier_list,
-						    FB_EVENT_MODE_CHANGE,
+				notifier_call_chain(&fb_notifier_list, evnt,
 						    &event);
 			}
 		}
diff -Nru a/include/linux/fb.h b/include/linux/fb.h
--- a/include/linux/fb.h	2005-04-14 12:44:11 +08:00
+++ b/include/linux/fb.h	2005-04-27 11:37:20 +08:00
@@ -495,6 +495,9 @@
 #define FB_EVENT_BLANK                  0x08
 /*      Private modelist is to be replaced */
 #define FB_EVENT_NEW_MODELIST           0x09
+/*	The resolution of the passed in fb_info about to change and
+        all vc's should be changed         */ 
+#define FB_EVENT_MODE_CHANGE_ALL	0x0A
 
 struct fb_event {
 	struct fb_info *info;




-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id=105hix
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.