2.6.7-bk16, mode-switch-in-fbcon_blank.patch breaks X on r128
Subsystems (2)
This patch, which went into 2.6.7-bk16, breaks X on my ibook with r128 chipset. X starts just fine, but the screen stays black. I can switch to a textconsole and the console login appears.
I see no errors in dmesg or XFree86.0.log. Its version 4.3.0 from SuSE 8.2.
From: "Antonino A. Daplas" <[email protected]>
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).
---
25-akpm/drivers/video/console/fbcon.c | 21 ++++++++------------- 25-akpm/include/linux/fb.h | 1 + 2 files changed, 9 insertions(+), 13 deletions(-)
drivers/video/console/fbcon.c renamed from drivers/video/console/fbcon.c~mode-switch-in-fbcon_blank +8 -13
@@ -1663,7 +1663,8 @@ static int fbcon_resize(struct vc_data * 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);
@@ -1678,9 +1679,12 @@ static int fbcon_resize(struct vc_data *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 ; } p->vrows = var.yres_virtual/fh;if (var.yres > (fh * (height +1 )))
@@ -1788,17 +1792,8 @@ static int fbcon_blank(struct vc_data *vstruct 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 renamed from include/linux/fb.h~mode-switch-in-fbcon_blank +1 -0
@@ -532,6 +532,7 @@ struct fb_ops {#define FBINFO_MISC_MODECHANGEUSER 0x10000/* mode change request from userspace */ +#define FBINFO_MISC_MODESWITCH 0x20000/* mode switch */ struct fb_info {int node;
_
Signature · 3 lines
USB is for mice, FireWire is for men! sUse lINUX ag, nÜRNBERG
From: Olaf Hering <[email protected]>
Date: Sun, Jul 04, 2004 at 06:03:58PM +0200
Quoted 7 lines
This patch, which went into 2.6.7-bk16, breaks X on my ibook with r128 chipset. X starts just fine, but the screen stays black. I can switch to a textconsole and the console login appears.
I see no errors in dmesg or XFree86.0.log. Its version 4.3.0 from SuSE 8.2.
I also had problems (switching back from X to console rewrote my refresh rate from 85 to 60 Hz) and this patch was posted in the linux-fbdev-devel mailinglist which solved my problems.
could you try it and let Antonino A Daplas (adaplas @ pol.net) know if this worked for you?
drivers/video/console/fbcon.c +9 -6
@@ -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;
Good luck,
Jurriaan
Signature · 4 lines
If you ever need anything please don't hesitate to ask someone else
first.
Nirvana
Debian (Unstable) GNU/Linux 2.6.7-mm5 2x6078 bogomips load 1.17Quoted 10 lines · Jurriaan
From: Olaf Hering <[email protected]>
Date: Sun, Jul 04, 2004 at 06:03:58PM +0200Quoted 7 lines
This patch, which went into 2.6.7-bk16, breaks X on my ibook with r128 chipset. X starts just fine, but the screen stays black. I can switch to a textconsole and the console login appears.
I see no errors in dmesg or XFree86.0.log. Its version 4.3.0 from SuSE 8.2.
Quoted 6 lines
I also had problems (switching back from X to console rewrote my refresh rate from 85 to 60 Hz) and this patch was posted in the linux-fbdev-devel mailinglist which solved my problems.
could you try it and let Antonino A Daplas (adaplas @ pol.net) know if this worked for you?
No, this will not work, fbcon_resize() is called before fbcon_blank(). I think the removed code in fbcon_blank() is needed.
Hi Olaf, Jurriaan
Quoted 15 lines · Olaf Hering
Quoted 14 lines · Jurriaan
From: Olaf Hering <[email protected]>
Date: Sun, Jul 04, 2004 at 06:03:58PM +0200Quoted 6 lines
This patch, which went into 2.6.7-bk16, breaks X on my ibook with r128 chipset. X starts just fine, but the screen stays black. I can switch to a textconsole and the console login appears.
I see no errors in dmesg or XFree86.0.log. Its version 4.3.0 from SuSE 8.2.
I also had problems (switching back from X to console rewrote my refresh rate from 85 to 60 Hz) and this patch was posted in the linux-fbdev-devel mailinglist which solved my problems.
Quoted 5 lines
Quoted 2 lines
could you try it and let Antonino A Daplas (adaplas @ pol.net) know if this worked for you?
No, this will not work,
fbcon_resize()is called beforefbcon_blank(). I think the removed code infbcon_blank()is needed.
Yes, thanks. It does seem that some Radeon cards need the set_var() code in fbcon_blank, such as Olaf's, while others do okay with the set_var() code in fbcon_switch()->fbcon_resize(), such as Jurriann's. As to why, I'm not sure.
Can you try this patch? It's ugly, but I have no reports of failure yet. It's just the old code (pre-mm5/pre-bk16) -- do a set_var() code in fbcon_blank() -- combined with the new code (mm5 and bk16), as an option to do the set_var() in fbcon_switch() -- needed by other cards such as rivafb.
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
@@ -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
@@ -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
@@ -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;
Quoted 7 lines · Antonino A. Daplas
Signed-off-by Antonino Daplas <[email protected]>Ugly workaround. ??When switching from
KD_GRAPHICStoKD_TEXT, the event is captured atfbcon_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.
This patch fixes it, tested on a ibook g4 with radeon card and 2.6.7-bk17
Signature · 3 lines
USB is for mice, FireWire is for men! sUse lINUX ag, nÜRNBERG
Quoted 7 lines · Jurriaan
From: Olaf Hering <[email protected]>
Date: Sun, Jul 04, 2004 at 06:03:58PM +0200Quoted 5 lines
This patch, which went into 2.6.7-bk16, breaks X on my ibook with r128 chipset. X starts just fine, but the screen stays black. I can switch to a textconsole and the console login appears.
Quoted 6 lines
Quoted 2 lines
I see no errors in dmesg or XFree86.0.log. Its version 4.3.0 from SuSE 8.2.
I also had problems (switching back from X to console rewrote my refresh rate from 85 to 60 Hz) and this patch was posted in the linux-fbdev-devel mailinglist which solved my problems.
I think you can debug it better with 'Option "usefbdev" "on"' in our XF86config. It breaks also atyfb.
Signature · 3 lines
USB is for mice, FireWire is for men! sUse lINUX ag, nÜRNBERG