Skip to contentSkip to conversation

: Mode Switch in fbcon_blank()

PATCH In review Antonino A. Daplas 7 participants 19 messages Jun 30, 2004 – Jul 4, 2004

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

PATCH 1/1 : Mode Switch in fbcon_blank()

Hi Ben,

As we've discussed in another thread, below is a diff that will do a set_par() as late as possible when there is KD_TEXT<->KD_GRAPHICS switch. The set_par() will be forced in fbcon_resize() instead.

Not sure if this has repercussions with the other drivers, but this patch fixed the X nv driver hanging when switching to the console. (I believe the crash is actually caused by an early set_par() -- while in fbcon_blank. Removing the set_par in fbcon_blank fixed the hang but caused cursor sprite and display corruption).

What do you think?

Tony

drivers/video/console/fbcon.c +8 -13
diff -Naur linux-2.6.7-mm4-orig/drivers/video/console/fbcon.c linux-2.6.7-mm4/drivers/video/console/fbcon.c
@@ -1679,7 +1679,8 @@
 	var.yres = height * fh;
 	x_diff = info->var.xres - var.xres;
 	y_diff = info->var.yres - var.yres;
-	if (x_diff < 0 || x_diff > fw || (y_diff < 0 || y_diff > fh)) {
+	if (x_diff < 0 || x_diff > fw || (y_diff < 0 || y_diff > fh) ||
+	    (info->flags & FBINFO_MISC_MODESWITCH)) {
 		char mode[40];
 
 		DPRINTK("attempting resize %ix%i\n", var.xres, var.yres);
@@ -1694,9 +1695,12 @@
 			return -EINVAL;
 		DPRINTK("resize now %ix%i\n", var.xres, var.yres);
 		if (CON_IS_VISIBLE(vc)) {
-			var.activate = FB_ACTIVATE_NOW;
+			var.activate = FB_ACTIVATE_NOW |
+				(info->flags & FBINFO_MISC_MODESWITCH) ? 
+				FB_ACTIVATE_FORCE : 0;
 			fb_set_var(info, &var);
 		}
+		info->flags &= ~FBINFO_MISC_MODESWITCH;
 	}
 	updatescrollmode(p, info, vc);
 	return 0;
@@ -1798,17 +1802,8 @@
 	struct fb_info *info = registered_fb[(int) con2fb_map[vc->vc_num]];
 	struct display *p = &fb_display[vc->vc_num];
 
-	if (mode_switch) {
-		struct fb_info *info = registered_fb[(int) con2fb_map[vc->vc_num]];
-		struct fb_var_screeninfo var = info->var;
-
-		if (blank) {
-			fbcon_cursor(vc, CM_ERASE);
-			return 0;
-		}
-		var.activate = FB_ACTIVATE_NOW | FB_ACTIVATE_FORCE;
-		fb_set_var(info, &var);
-	}
+	if (mode_switch)
+		info->flags |= FBINFO_MISC_MODESWITCH;
 
 	fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW);
 
include/linux/fb.h +1 -0
diff -Naur linux-2.6.7-mm4-orig/include/linux/fb.h linux-2.6.7-mm4/include/linux/fb.h
@@ -532,6 +532,7 @@
 
 #define FBINFO_MISC_MODECHANGEUSER     0x10000 /* mode change request
 						  from userspace */
+#define FBINFO_MISC_MODESWITCH         0x20000 /* mode switch */
 
 struct fb_info {
 	int node;

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com

#1 lore raw
Quoted 6 lines · Antonino A. Daplas

Hi Ben,

As we've discussed in another thread, below is a diff that will do a set_par() as late as possible when there is KD_TEXT<->KD_GRAPHICS switch. The set_par() will be forced in fbcon_resize() instead.

Quoted 7 lines

Not sure if this has repercussions with the other drivers, but this patch fixed the X nv driver hanging when switching to the console. (I believe the crash is actually caused by an early set_par() -- while in fbcon_blank. Removing the set_par in fbcon_blank fixed the hang but caused cursor sprite and display corruption).

What do you think?

Well... I don't know. It seem to work, so it's probably an acceptable workaround, but I'd like to find out what's wrong with doing it in blank precisely (that is what is the bug in XFree or in the kernel VT), since it's shared by many X drivers, I don't suppose it's a bug in them.

I'll try to find time to toy with this, but I may not have any until after OLS though....

Ben.

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com

#2 lore raw

Telling libSDL that my fbdev can do acclerated fills

I'm working on a app that runs on the STPC Atlas and uses libSDL with the stpcfb from STPC. Kernel 2.4.x. I'm currently using 2.4.23 but any of later kernels will work.

The Atlas video accelerator supports hardware assisted fills. I've been looking over the stpcfb code and some of the other framebuffer drivers and its not obvious to me how the fb system exports out what kind of graphics hardware assisted abilities it has. Or even how you would call those abilities if you knew they were avaiable.

All I see is stuff for text related console work.

The STPC is a pretty slow device and my app needs all the speed help it can get. libSDL is currently doing software fills since it dosen't know otherwise.

I see in the libSDL source code that the FillHWRect funciton pointer for the fb driver is set to NULL as if its not possible to realize hardware assisted graphics functions via fbdev.

Is this the case or what am I missing?

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com

#3 lore raw

Re: Telling libSDL that my fbdev can do acclerated fills

Quoted 16 lines · Richard Smith

I'm working on a app that runs on the STPC Atlas and uses libSDL with the stpcfb from STPC. Kernel 2.4.x. I'm currently using 2.4.23 but any of later kernels will work.

The Atlas video accelerator supports hardware assisted fills. I've been looking over the stpcfb code and some of the other framebuffer drivers and its not obvious to me how the fb system exports out what kind of graphics hardware assisted abilities it has. Or even how you would call those abilities if you knew they were avaiable.

All I see is stuff for text related console work.

The STPC is a pretty slow device and my app needs all the speed help it can get. libSDL is currently doing software fills since it dosen't know otherwise.

Quoted 6 lines

I see in the libSDL source code that the FillHWRect funciton pointer for the fb driver is set to NULL as if its not possible to realize hardware assisted graphics functions via fbdev.

Is this the case or what am I missing?

All hardware-assisted drawing functions in fbdev are for use by the console only. You might want to try DirectFB (www.directfb.org), I believe they have ported a lot of libs, including SDL. However, I doubt they have a gfxdriver for your hardware though.

Tony

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com

#4 lore raw

Re: Telling libSDL that my fbdev can do acclerated fills

Quoted 5 lines · Antonino A. Daplas

All hardware-assisted drawing functions in fbdev are for use by the console only. You might want to try DirectFB (www.directfb.org), I believe they have ported a lot of libs, including SDL. However, I doubt they have a gfxdriver for your hardware though.

I'm looking at that now. Yes they have a SDL driver. No they don't have anything for my hardware. I'll have to do a port if I want directfb.

The documentation says that it runs on top of the linux framebuffer device. If it runs on top of fbdev but fbdev only does assisted stuff for the console then how does that work?

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com

#5 lore raw

Re: Telling libSDL that my fbdev can do acclerated fills

Quoted 4 lines · Richard Smith

The documentation says that it runs on top of the linux framebuffer device. If it runs on top of fbdev but fbdev only does assisted stuff for the console then how does that work?

fbdev exports the register space and framebuffer to userspace, DirectFB uses those to create hardware specific drawing functions via the gfxdrivers.

Tony

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com

#6 lore raw
In reply to Benjamin Herrenschmidt
Quoted 10 lines · Benjamin Herrenschmidt
Quoted 9 lines

As we've discussed in another thread, below is a diff that will do a set_par() as late as possible when there is KD_TEXT<->KD_GRAPHICS switch. The set_par() will be forced in fbcon_resize() instead.

Not sure if this has repercussions with the other drivers, but this patch fixed the X nv driver hanging when switching to the console. (I believe the crash is actually caused by an early set_par() -- while in fbcon_blank. Removing the set_par in fbcon_blank fixed the hang but caused cursor sprite and display corruption).

Quoted 4 lines

Well... I don't know. It seem to work, so it's probably an acceptable workaround, but I'd like to find out what's wrong with doing it in blank precisely (that is what is the bug in XFree or in the kernel VT), since it's shared by many X drivers, I don't suppose it's a bug in them.

This was included in 2.6.7-mm5 -that's how I noticed it- and I had to revert it.

I use radeonfb and when switching from X to console my two monitors will go out of sync. The VT is actually there since I can type on it, but I can't see anything on neither of my two monitors :(

Signature · 16 lines
Homer:  Hey, Burns!  Eat my shorts!

Burns:  Who the Sam Hill was that?

                   One Fish, Two Fish, Blowfish, Blue Fish

Javier Marcet <[email protected]>




-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
#7 lore raw
Quoted 16 lines · Javier Marcet
Quoted 10 lines · Benjamin Herrenschmidt
Quoted 9 lines

As we've discussed in another thread, below is a diff that will do a set_par() as late as possible when there is KD_TEXT<->KD_GRAPHICS switch. The set_par() will be forced in fbcon_resize() instead.

Not sure if this has repercussions with the other drivers, but this patch fixed the X nv driver hanging when switching to the console. (I believe the crash is actually caused by an early set_par() -- while in fbcon_blank. Removing the set_par in fbcon_blank fixed the hang but caused cursor sprite and display corruption).

Quoted 4 lines

Well... I don't know. It seem to work, so it's probably an acceptable workaround, but I'd like to find out what's wrong with doing it in blank precisely (that is what is the bug in XFree or in the kernel VT), since it's shared by many X drivers, I don't suppose it's a bug in them.

Quoted 6 lines

This was included in 2.6.7-mm5 -that's how I noticed it- and I had to revert it.

I use radeonfb and when switching from X to console my two monitors will go out of sync. The VT is actually there since I can type on it, but I can't see anything on neither of my two monitors :(

Grr, I was a little tentative about this patch, hoping against hope that it will work for all drivers, but you've proven me wrong. Anyway, we now have at least 2 drivers that requires reinitialization at different stages, radeonfb requires it at fbcon_blank() and rivafb at fbcon_switch(). And I really don't know how to fix it except to look closely at X (and I dread looking at X's code...) and the VT code (ditto).

Can you try the patch below? It works for the rivafb, hopefully it works for yours.

Andrew,

This patch is ugly as sin but I can't find a good solution without hacking X or the vt system. I've included a big fat comment describing the ugliness.

Tony

Ugly workaround. When switching from KD_GRAPHICS to KD_TEXT, the event is captured at fbcon_blank() allowing fbcon to reinitialize the hardware. However, some hardware requires the reinitialization to be done immediately, others require it to be done later. Others may need it to be done immediately and later, this is the worst case.

drivers/video/console/fbcon.c +25 -2
diff -Naur linux-2.6.7-mm5-orig/drivers/video/console/fbcon.c linux-2.6.7-mm5/drivers/video/console/fbcon.c
@@ -1802,8 +1802,31 @@
 	struct fb_info *info = registered_fb[(int) con2fb_map[vc->vc_num]];
 	struct display *p = &fb_display[vc->vc_num];
 
-	if (mode_switch)
-		info->flags |= FBINFO_MISC_MODESWITCH;
+	if (mode_switch) {
+		struct fb_var_screeninfo var = info->var;
+
+/* 
+ * HACK ALERT: Some hardware will require reinitializion at this stage,
+ *             others will require it to be done as late as possible.
+ *             For now, we differentiate this with the 
+ *             FBINFO_MISC_MODESWITCHLATE bitflag.  Worst case will be
+ *             hardware that requires it here and another one later.
+ *             A definitive solution may require fixing X or the VT
+ *             system.
+ */
+		if (info->flags & FBINFO_MISC_MODESWITCHLATE)
+			info->flags |= FBINFO_MISC_MODESWITCH;
+
+		if (blank) {
+		    fbcon_cursor(vc, CM_ERASE);
+		    return 0;
+		}
+
+		if (!(info->flags & FBINFO_MISC_MODESWITCHLATE)) {
+			var.activate = FB_ACTIVATE_NOW | FB_ACTIVATE_FORCE;
+			fb_set_var(info, &var);
+		}
+	}
 
 	fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW);
 
drivers/video/riva/fbdev.c +2 -1
diff -Naur linux-2.6.7-mm5-orig/drivers/video/riva/fbdev.c linux-2.6.7-mm5/drivers/video/riva/fbdev.c
@@ -1681,7 +1681,8 @@
 		    | FBINFO_HWACCEL_YPAN
 		    | FBINFO_HWACCEL_COPYAREA
 		    | FBINFO_HWACCEL_FILLRECT
-		    | FBINFO_HWACCEL_IMAGEBLIT;
+		    | FBINFO_HWACCEL_IMAGEBLIT
+	            | FBINFO_MISC_MODESWITCHLATE;
 	info->var = rivafb_default_var;
 	info->fix.visual = (info->var.bits_per_pixel == 8) ?
 				FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR;
include/linux/fb.h +1 -0
diff -Naur linux-2.6.7-mm5-orig/include/linux/fb.h linux-2.6.7-mm5/include/linux/fb.h
@@ -533,6 +533,7 @@
 #define FBINFO_MISC_MODECHANGEUSER     0x10000 /* mode change request
 						  from userspace */
 #define FBINFO_MISC_MODESWITCH         0x20000 /* mode switch */
+#define FBINFO_MISC_MODESWITCHLATE     0x40000 /* init hardware later */
 
 struct fb_info {
 	int node;

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com

#8 lore raw
Quoted 12 lines · Antonino A. Daplas
Quoted 11 lines
Quoted 4 lines

Well... I don't know. It seem to work, so it's probably an acceptable workaround, but I'd like to find out what's wrong with doing it in blank precisely (that is what is the bug in XFree or in the kernel VT), since it's shared by many X drivers, I don't suppose it's a bug in them.

This was included in 2.6.7-mm5 -that's how I noticed it- and I had to revert it.

I use radeonfb and when switching from X to console my two monitors will go out of sync. The VT is actually there since I can type on it, but I can't see anything on neither of my two monitors :(

Quoted 8 lines

Grr, I was a little tentative about this patch, hoping against hope that it will work for all drivers, but you've proven me wrong. Anyway, we now have at least 2 drivers that requires reinitialization at different stages, radeonfb requires it at fbcon_blank() and rivafb at fbcon_switch(). And I really don't know how to fix it except to look closely at X (and I dread looking at X's code...) and the VT code (ditto).

Can you try the patch below? It works for the rivafb, hopefully it works for yours.

Hi Antonio,
sorry for not answering sooner, I thought I had done before leaving to work.
Well, with this patch in addition to your original one, it works right again with my radeon frame buffer & X :)

For me it's fine. Thanks for your help ;-)

If I can be of any help, trying further patches or whatever, please ask.

Signature · 5 lines
If A equals success, then the formula is _A = _X + _Y + _Z.  _X is work.  _Y
is play.  _Z is keep your mouth shut.
s		-- Albert Einstein

Javier Marcet <[email protected]>
#9 lore raw

PATCH 1/1 radeonfb: mode switch work around

In reply to Antonino A. Daplas

Here's the fix for radeonfb for use with your patch.

-dte

drivers/video/aty/radeon_base.c +2 -1
diff -Nru a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c
@@ -1793,7 +1793,8 @@
 		    | FBINFO_HWACCEL_COPYAREA
 		    | FBINFO_HWACCEL_FILLRECT
 		    | FBINFO_HWACCEL_XPAN
-		    | FBINFO_HWACCEL_YPAN;
+		    | FBINFO_HWACCEL_YPAN
+		    | FBINFO_MISC_MODESWITCHLATE;
 	info->fbops = &radeonfb_ops;
 	info->screen_base = (char *)rinfo->fb_base;
 

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com

#10 lore raw

Re: [PATCH] radeonfb: mode switch work around

Quoted 3 lines · David Eger

Here's the fix for radeonfb for use with your patch.

-dte

On second look, strike that. I have general badness trying to switch out of X in recent kernels to radeonfb. Grr.. I'm not having luck pinpointing what went wrong just yet.

-dte

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com

#11 lore raw

Re: [PATCH] radeonfb: mode switch work around

Quoted 9 lines · David Eger
Quoted 3 lines · David Eger

Here's the fix for radeonfb for use with your patch.

-dte

On second look, strike that. I have general badness trying to switch out of X in recent kernels to radeonfb. Grr.. I'm not having luck pinpointing what went wrong just yet.

Maybe your hardware is one that requires a set_par() in both fbcon_blank() and fbcon_switch(), the worst case scenario....? If that's the case, we need another flag (and another ugyly workaround).

Tony

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com

#12 lore raw

Re: [PATCH] radeonfb: mode switch work around

Quoted 11 lines · Antonino A. Daplas
Quoted 6 lines · David Eger
Quoted 2 lines

Here's the fix for radeonfb for use with your patch.

On second look, strike that. I have general badness trying to switch out of X in recent kernels to radeonfb. Grr.. I'm not having luck pinpointing what went wrong just yet.

Maybe your hardware is one that requires a set_par() in both fbcon_blank() and fbcon_switch(), the worst case scenario....? If that's the case, we need another flag (and another ugyly workaround).

Actually, I'm trying older kernels that I'm sure didn't have this problem (2.6.6) and I'm thinking instead the bad X->VT switch is due to the X.Org code. I recently switched from XFree... hrmmm :-(

I hate to uninstall/reinstall X again just to test (I run gentoo... good god)

-Unhappy David

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com

#13 lore raw

Re: [PATCH] radeonfb: mode switch work around

I have noticed this too. I don't think it is specific to x.org. My best guess is that the X server is mucking with the VGA registers on the radeon card.

Try this experiment...
modprobe radeonfb from a VT, then switch to an xterm and rmmod it. Try it the other way to, modprobe from xterm and rmmod from VT. Both of those result in a reboot on my machine.

The problem seems to be with radeonfb snap shotting the register state when it loads, and then restoring it when it unloads. But the VT/xterm pair causes the retored registers to be set to the wrong values.

This saved register state is also used in other places. These other uses may be the source of the problem you see. If I remember right, X is also saving a snap shot of the initial register values.

Quoted 8 lines · --- David Eger
Quoted 7 lines · Antonino A. Daplas
Quoted 6 lines · David Eger
Quoted 2 lines

Here's the fix for radeonfb for use with your patch.

On second look, strike that. I have general badness trying to switch out of X in recent kernels to radeonfb. Grr.. I'm not having luck pinpointing what went wrong just yet.

=====
Jon Smirl
[email protected]

__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com

#14 lore raw

Re: [PATCH] radeonfb: mode switch work around

Quoted 4 lines · Jon Smirl

Try this experiment...
modprobe radeonfb from a VT, then switch to an xterm and rmmod it. Try it the other way to, modprobe from xterm and rmmod from VT. Both of those result in a reboot on my machine.

I would say modprobing any fbdev while X is already playing with the same hardware is unsafe...

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com

#15 lore raw

Re: [PATCH] radeonfb: mode switch work around

Nevermind the patch I sent. I tracked down my X->VT issue to my xorg.conf file. It was missing the line

Option "UseFBDev"

Tony, your patch (the one with the big HACK ALERT sticker on it)
seems to give radeon the mode switch call when it is needed.

-dte

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com

#16 lore raw
In reply to Javier Marcet
Quoted 16 lines · Javier Marcet
Quoted 10 lines · Benjamin Herrenschmidt
Quoted 9 lines

As we've discussed in another thread, below is a diff that will do a set_par() as late as possible when there is KD_TEXT<->KD_GRAPHICS switch. The set_par() will be forced in fbcon_resize() instead.

Not sure if this has repercussions with the other drivers, but this patch fixed the X nv driver hanging when switching to the console. (I believe the crash is actually caused by an early set_par() -- while in fbcon_blank. Removing the set_par in fbcon_blank fixed the hang but caused cursor sprite and display corruption).

Quoted 4 lines

Well... I don't know. It seem to work, so it's probably an acceptable workaround, but I'd like to find out what's wrong with doing it in blank precisely (that is what is the bug in XFree or in the kernel VT), since it's shared by many X drivers, I don't suppose it's a bug in them.

Quoted 6 lines

This was included in 2.6.7-mm5 -that's how I noticed it- and I had to revert it.

I use radeonfb and when switching from X to console my two monitors will go out of sync. The VT is actually there since I can type on it, but I can't see anything on neither of my two monitors :(

Jurriaan's problem told me that I'm probably over-engineering the mode switch code. Perhaps the ugly workaround patch is not necessary. All that is needed is to bypass fbcon_resize() and just do a simple set_par().

David, Javier, can you try the patch below? Reverse the one with the big HACK ALERT comment first. If it works for you two, the code just became simpler.

Tony

drivers/video/console/fbcon.c +9 -6
diff -Naur linux-2.6.7-mm5-orig/drivers/video/console/fbcon.c linux-2.6.7-mm5/drivers/video/console/fbcon.c
@@ -1679,8 +1679,7 @@
 	var.yres = height * fh;
 	x_diff = info->var.xres - var.xres;
 	y_diff = info->var.yres - var.yres;
-	if (x_diff < 0 || x_diff > fw || (y_diff < 0 || y_diff > fh) ||
-	    (info->flags & FBINFO_MISC_MODESWITCH)) {
+	if (x_diff < 0 || x_diff > fw || (y_diff < 0 || y_diff > fh)) {
 		char mode[40];
 
 		DPRINTK("attempting resize %ix%i\n", var.xres, var.yres);
@@ -1695,12 +1694,9 @@
 			return -EINVAL;
 		DPRINTK("resize now %ix%i\n", var.xres, var.yres);
 		if (CON_IS_VISIBLE(vc)) {
-			var.activate = FB_ACTIVATE_NOW |
-				(info->flags & FBINFO_MISC_MODESWITCH) ?
-				FB_ACTIVATE_FORCE : 0;
+			var.activate = FB_ACTIVATE_NOW;
 			fb_set_var(info, &var);
 		}
-		info->flags &= ~FBINFO_MISC_MODESWITCH;
 	}
 	updatescrollmode(p, info, vc);
 	return 0;
@@ -1752,6 +1748,13 @@
 	}
 
  	fbcon_resize(vc, vc->vc_cols, vc->vc_rows);
+
+	if (info->flags & FBINFO_MISC_MODESWITCH &&
+		info->fbops->fb_set_par) {
+		info->fbops->fb_set_par(info);
+	}
+	info->flags &= ~FBINFO_MISC_MODESWITCH;
+
 	switch (p->scrollmode) {
 	case SCROLL_WRAP:
 		scrollback_phys_max = p->vrows - vc->vc_rows;

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com

#17 lore raw
Quoted 9 lines · Antonino A. Daplas
Quoted 3 lines · Javier Marcet

I use radeonfb and when switching from X to console my two monitors will go out of sync. The VT is actually there since I can type on it, but I can't see anything on neither of my two monitors :(

Jurriaan's problem told me that I'm probably over-engineering the mode switch code. Perhaps the ugly workaround patch is not necessary. All that is needed is to bypass fbcon_resize() and just do a simple set_par().

Quoted 5 lines

David, Javier, can you try the patch below? Reverse the one with the big HACK ALERT comment first. If it works for you two, the code just became simpler.

Tony

With this patch, X won't even get to the point of showing an X cursor :-(

-dte

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com

#18 lore raw
Quoted 11 lines · David Eger
Quoted 10 lines · Antonino A. Daplas
Quoted 3 lines · Javier Marcet

I use radeonfb and when switching from X to console my two monitors will go out of sync. The VT is actually there since I can type on it, but I can't see anything on neither of my two monitors :(

Jurriaan's problem told me that I'm probably over-engineering the mode switch code. Perhaps the ugly workaround patch is not necessary. All that is needed is to bypass fbcon_resize() and just do a simple set_par().

Quoted 8 lines
Quoted 5 lines

David, Javier, can you try the patch below? Reverse the one with the big HACK ALERT comment first. If it works for you two, the code just became simpler.

Tony

With this patch, X won't even get to the point of showing an X cursor :-(

Ok, so the hack is really needed. Forget the patch then.

Thanks

Tony

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com