From: Antonino A. Daplas <hidden> Date: 2004-06-21 22:37:30
Hi,
**This patch is more of an RFC. BenH probably has similar code.
This patch adds a method (con_notify) that will notify console drivers of
impending console switches, passing them with the about-to-be-old (last)
vc structure and about-to-be-new (wanted) vc structure. The console
drivers can then elect to pass selected information to low-level drivers.
This is important to fbcon so it can detect a switch from a graphics console to a
text console and vice versa. This will give underlying drivers a chance to update
its hardware state. This is added via the method fbcon_state_switch(). Fbcon
will, however, do a set_par if the _state_switch method is not availabe and if
switching from a KD_GRAPHICS console.
Also updated rivafb to take advantage of this method. With this, switching
to/from X with XFree86/Org nv driver works. Usually it hangs without the
option usefbdev, or gets a Sig11 if with option usefbdev.
(Unfortunately it doesn't work for nVidia's binary nvidia driver, switching to
the console is possible, switching back to X will hang the machine).
Diff is against linux-2.6.7-mm1
Tony
Signed-off-by: Antonino Daplas <redacted>
diff -Naur linux-2.6.7-mm1-orig/drivers/char/vt.c linux-2.6.7-mm1/drivers/char/vt.c
@@ -1758,10 +1788,18 @@#else/* XXX use other methods later */#ifdef CONFIG_FB_RIVA_I2C+inti;+structriva_par*par=(structriva_par*)info->par;riva_create_i2c_busses(par);-riva_probe_i2c_connector(par,1,&par->EDID);+for(i=par->bus;i>=1;i--){+riva_probe_i2c_connector(par,i,&par->EDID);+if(par->EDID){+printk("rivafb: Found EDID Block from BUS %i\n",i);+break;+}+}riva_delete_i2c_busses(par);#endif#endif
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
From: Antonino A. Daplas <hidden> Date: 2004-06-21 22:49:57
On Tuesday 22 June 2004 06:39, Antonino A. Daplas wrote:
Hi,
**This patch is more of an RFC. BenH probably has similar code.
This patch adds a method (con_notify) that will notify console drivers of
impending console switches, passing them with the about-to-be-old (last)
vc structure and about-to-be-new (wanted) vc structure. The console
drivers can then elect to pass selected information to low-level drivers.
Oops, try this one.
Tony
Signed-off-by: Antonino Daplas <redacted>
diff -Naur linux-2.6.7-mm1-orig/drivers/char/vt.c linux-2.6.7-mm1/drivers/char/vt.c
@@ -1758,10 +1788,18 @@#else/* XXX use other methods later */#ifdef CONFIG_FB_RIVA_I2C+inti;+structriva_par*par=(structriva_par*)info->par;riva_create_i2c_busses(par);-riva_probe_i2c_connector(par,1,&par->EDID);+for(i=par->bus;i>=1;i--){+riva_probe_i2c_connector(par,i,&par->EDID);+if(par->EDID){+printk("rivafb: Found EDID Block from BUS %i\n",i);+break;+}+}riva_delete_i2c_busses(par);#endif#endif
@@ -501,6 +501,9 @@/* perform fb specific mmap */int(*fb_mmap)(structfb_info*info,structfile*file,structvm_area_struct*vma);++/* hardware state change */+void(*fb_state_switch)(structfb_info*info,intout,intvc_mode);};/* FBINFO_* = fb_info.flags bit flags */-------------------------------------------------------
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
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2004-06-23 16:11:35
On Mon, 2004-06-21 at 17:39, Antonino A. Daplas wrote:
Hi,
**This patch is more of an RFC. BenH probably has similar code.
This patch adds a method (con_notify) that will notify console drivers of
impending console switches, passing them with the about-to-be-old (last)
vc structure and about-to-be-new (wanted) vc structure. The console
drivers can then elect to pass selected information to low-level drivers.
This is important to fbcon so it can detect a switch from a graphics console to a
text console and vice versa. This will give underlying drivers a chance to update
its hardware state. This is added via the method fbcon_state_switch(). Fbcon
will, however, do a set_par if the _state_switch method is not availabe and if
switching from a KD_GRAPHICS console.
Also updated rivafb to take advantage of this method. With this, switching
to/from X with XFree86/Org nv driver works. Usually it hangs without the
option usefbdev, or gets a Sig11 if with option usefbdev.
(Unfortunately it doesn't work for nVidia's binary nvidia driver, switching to
the console is possible, switching back to X will hang the machine).
You don't need that. A method for that was _ALREADY_ added to the kernel,
it's based on the fact that the blank() callback is called on switches
between KD_TEXT and KD_GRAPHICS. After discussing the issue with Linus,
we decided to add a parameter to it indicating the nature of the
switch. You should be able to rely on that. Actually, if you look at
the code, I'm forcing a set_par in this case. If this doesn't work, then
I may have missed a code path, and that should be fixed but there is no
need at this point to change the infrastructure.
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
From: Antonino A. Daplas <hidden> Date: 2004-06-23 23:48:06
On Thursday 24 June 2004 00:02, Benjamin Herrenschmidt wrote:
You don't need that. A method for that was _ALREADY_ added to the kernel,
it's based on the fact that the blank() callback is called on switches
between KD_TEXT and KD_GRAPHICS. After discussing the issue with Linus,
we decided to add a parameter to it indicating the nature of the
switch. You should be able to rely on that. Actually, if you look at
the code, I'm forcing a set_par in this case. If this doesn't work, then
I may have missed a code path, and that should be fixed but there is no
need at this point to change the infrastructure.
Thanks Ben, I see it now. I did not realize it was in the console_blank hook. (I did
not follow this list for a time). And no, I don't think you missed a code path. The
problem is that we are calling fb_set_var->set_par too early, before X has really
given up on the hardware. We can fix this by setting some kind of flag while in
fbcon_blank, and depending on the setting of this flag, force a set_par in
fbcon_switch instead.
I'll concoct a patch later. (I'll test James' new patch first).
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
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2004-06-24 02:37:46
On Wed, 2004-06-23 at 18:50, Antonino A. Daplas wrote:
Thanks Ben, I see it now. I did not realize it was in the console_blank hook. (I did
not follow this list for a time). And no, I don't think you missed a code path. The
problem is that we are calling fb_set_var->set_par too early, before X has really
given up on the hardware. We can fix this by setting some kind of flag while in
fbcon_blank, and depending on the setting of this flag, force a set_par in
fbcon_switch instead.
I'll concoct a patch later. (I'll test James' new patch first).
That would be a bug in X
If console switching, the 'unblank' is done, afaik, after X calls the ioctl
to relinguish the console to the kernel.
When exiting X, I'm not sure, but that should be similar. If X still touches
the HW after that, it's an X bug (and yes, I does that, at least in the radeon
driver, afaik)
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
From: Antonino A. Daplas <hidden> Date: 2004-06-24 20:49:08
On Thursday 24 June 2004 10:35, Benjamin Herrenschmidt wrote:
On Wed, 2004-06-23 at 18:50, Antonino A. Daplas wrote:
quoted
Thanks Ben, I see it now. I did not realize it was in the console_blank
hook. (I did not follow this list for a time). And no, I don't think you
missed a code path. The problem is that we are calling
fb_set_var->set_par too early, before X has really given up on the
hardware. We can fix this by setting some kind of flag while in
fbcon_blank, and depending on the setting of this flag, force a set_par
in fbcon_switch instead.
I'll concoct a patch later. (I'll test James' new patch first).
That would be a bug in X
If console switching, the 'unblank' is done, afaik, after X calls the ioctl
to relinguish the console to the kernel.
When exiting X, I'm not sure, but that should be similar. If X still
touches the HW after that, it's an X bug (and yes, I does that, at least in
the radeon driver, afaik)
Include nvidia into the list. With the nv driver, the whole machine hangs.
The i810 has cursor sprite corruption, but has a workaround for it.
So, I would still like to do the set_par as late as possible such as in
fbcon_switch(). (BTW, this fixes the riva driver)
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
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2004-06-28 22:12:41
Include nvidia into the list. With the nv driver, the whole machine hangs.
The i810 has cursor sprite corruption, but has a workaround for it.
So, I would still like to do the set_par as late as possible such as in
fbcon_switch(). (BTW, this fixes the riva driver)
Except that you may not have a switch, if for example an app switch to
KD_GRAPHICS, do stuff with the engine, then back to KD_TEXT on the
same console...
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
From: Antonino A. Daplas <hidden> Date: 2004-06-28 22:48:14
On Tuesday 29 June 2004 06:09, Benjamin Herrenschmidt wrote:
quoted
Include nvidia into the list. With the nv driver, the whole machine
hangs. The i810 has cursor sprite corruption, but has a workaround for
it.
So, I would still like to do the set_par as late as possible such as in
fbcon_switch(). (BTW, this fixes the riva driver)
Except that you may not have a switch, if for example an app switch to
KD_GRAPHICS, do stuff with the engine, then back to KD_TEXT on the
same console...
fbcon_switch() will be called when there is a request to redraw the screen
of the same vc, such as in the above, or when switching to a different vc.
I think the name 'con_switch' is misleading. The better term, IMO, is
'con_redraw'.
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
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2004-06-29 00:58:19
fbcon_switch() will be called when there is a request to redraw the screen
of the same vc, such as in the above, or when switching to a different vc.
I think the name 'con_switch' is misleading. The better term, IMO, is
'con_redraw'.
Hrm... ok, I missed that one then. It would still be useful to figure
out what's wrong with X, it may not be a driver problem, but rather
an X core problem calling the driver "restore" callbacks at the wrong
time, and thus more easily fixable
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