From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2003-07-30 13:14:52
(resent with proper recipients list, sorry)
So, here's a new version that removes checking for suspend field
all over fbcon. I tried it here with a modified radeonfb that sets
the fbops to some dummy functions (provided by fbmem.c in this
patch though you may want to move them around).
In theory, I could implement power management properly without the client
notification mecanism by just setting the dummy fbops and directly calling
update_screen from the low level fbdev on resume, but that doesn't smell
good. The console subsystem is a bit of a nightmare to me, James, can we
currently have several consoles on several heads ? (that currcons in
vt.c is disturbing me). It may be worth doing better than just update_screen
(fg_console) when resuming in fbcon.c... (this callback will be called for
each fbdev who is waking up).
Let me know what you think, in all cases, asap so I can push the remaining
fbdev driver bits.
Ben.
===== drivers/video/fbmem.c 1.77 vs edited =====
@@ -2259,6 +2259,19 @@return0;}+staticvoidfbcon_suspended(void*data,structfb_info*info)+{+/* Here, we should do something to properly erase the+*cursorandsynchronizewiththecursorinterrupton+*SMP...(maynotbethatcriticalthough...)+*/+}++staticvoidfbcon_resumed(void*data,structfb_info*info)+{+update_screen(fg_console);+}+/**Theconsole`switch'structurefortheframebufferbasedconsole*/
@@ -2285,16 +2298,25 @@.con_resize=fbcon_resize,};+staticstructfb_client_opsfbcon_client={+.owner=THIS_MODULE,+.mode_changed=NULL,/* TODO */+.suspended=fbcon_suspended,+.resumed=fbcon_resumed,+};+int__initfb_console_init(void){if(!num_registered_fb)return-ENODEV;take_over_console(&fb_con,first_fb_vc,last_fb_vc,fbcon_is_default);+register_fb_client(&fbcon_client,NULL);return0;}void__exitfb_console_exit(void){+unregister_fb_client(&fbcon_client);give_up_console(&fb_con);}
@@ -352,6 +352,44 @@structfb_info;structvm_area_struct;structfile;+structfb_client;++/*+*Framebufferclients.Currently,thisisonlyused+*byfbcontogetnotifiedofeventsontheframebuffer,+*thoughthatshouldbeextendedtotheuserlandinterface+*someway.+*+*Weshouldalsoaddmorecallbackstobetterdealwith+*hotplugdisplays(add/removalnotification).Thisis+*nottoreplacedbyadeviceclass,thoughitcouldbe+*wrappedinadeviceinterfaceaccordingtothedriver+*model,Ihavetothinkmoreaboutit.+*+*Lockingrules:Thecallbackshouldnottaketheconsole+*semaphoreexplicitely(callacquire_console_sem())asit+*willtypicallyalreadybeowned.+*+*/+structfb_client_ops{+structmodule*owner;++/* Userland initiated mode change */+void(*mode_changed)(void*data,structfb_info*info);+/* The device is beeing suspended, do not access from+*thatpoint+*/+void(*suspended)(void*data,structfb_info*info);+/* The device is back to life, refresh screen+*/+void(*resumed)(void*data,structfb_info*info);+};++structfb_client{+structlist_headlink;+structfb_client_ops*ops;+void*data;+};/**Framebufferoperations
@@ -399,6 +437,7 @@intnode;intflags;intopen;/* Has this been open already ? */+intsuspended;/* Is this currently suspended ? */#define FBINFO_FLAG_MODULE 1 /* Low-level driver is a module */structfb_var_screeninfovar;/* Current var */structfb_fix_screeninfofix;/* Current fix */
@@ -412,6 +451,7 @@structvc_data*display_fg;/* Console visible on this display */intcurrcon;/* Current VC. */void*pseudo_palette;/* Fake palette of 16 colors */+/* From here on everything is device dependent */void*par;};
@@ -574,6 +618,22 @@conststructfb_videomode*default_mode,unsignedintdefault_bpp);#endif++/* Power Management: called by low driver to notify other layers,+*drivershouldhaveacquiredtheconsolesemaphorepriorto+*callingthis+*/+externintfb_set_suspend(structfb_info*info,intsuspended);++/*+*fb_clientoperations+*/++externintregister_fb_client(structfb_client_ops*ops,void*data);+externintunregister_fb_client(structfb_client_ops*ops);+externintfb_clients_call_mode_changed(structfb_info*info);+externintfb_clients_call_suspended(structfb_info*info);+externintfb_clients_call_resumed(structfb_info*info);#endif /* __KERNEL__ */-------------------------------------------------------
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2003-08-01 10:05:38
James, if you are ok, can you get that upstream to Linus asap so
I can start pushing the driver bits for radeon & aty128 ?
Ben.
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
From: James Simmons <hidden> Date: 2003-08-06 23:54:12
James, if you are ok, can you get that upstream to Linus asap so
I can start pushing the driver bits for radeon & aty128 ?
Working on it. I'm thinking about also how it effects userland and how
userland affects the console if present. Basically the logic will go
pci suspend -> framebuffer driver supend function -> call each client
Just give me a few days to piece it together.
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2003-08-07 09:38:51
On Thu, 2003-08-07 at 01:52, James Simmons wrote:
quoted
James, if you are ok, can you get that upstream to Linus asap so
I can start pushing the driver bits for radeon & aty128 ?
Working on it. I'm thinking about also how it effects userland and how
userland affects the console if present. Basically the logic will go
pci suspend -> framebuffer driver supend function -> call each client
Just give me a few days to piece it together.
Right now, we don't have a proper userland notification. So far, the
main affected thing is XFree, but this is ok as it will have received
a suspend request via /dev/apm_bios (which we emulate on PowerMacs),
and so won't touch the framebuffer until resumed.
There isn't much we can do against a userland client tapping the
framebuffer that it mmap'ed previously. I don't know how feasible it
would be to sort of "hack" this process mapping on the fly (would
involve some nasty SMP synchronisation issues) so that the userland
process is just put to sleep on fb access while the fb is suspended
(or get a SEGV). We probably want to extend the notification mecanism
to userland in some way, but this isn't something i cover in this
patch.
Ben.
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
From: Pavel Machek <hidden> Date: 2003-08-07 10:03:27
Hi!
quoted
quoted
James, if you are ok, can you get that upstream to Linus asap so
I can start pushing the driver bits for radeon & aty128 ?
Working on it. I'm thinking about also how it effects userland and how
userland affects the console if present. Basically the logic will go
pci suspend -> framebuffer driver supend function -> call each client
Just give me a few days to piece it together.
Right now, we don't have a proper userland notification. So far, the
main affected thing is XFree, but this is ok as it will have received
a suspend request via /dev/apm_bios (which we emulate on PowerMacs),
and so won't touch the framebuffer until resumed.
There isn't much we can do against a userland client tapping the
framebuffer that it mmap'ed previously. I don't know how feasible it
would be to sort of "hack" this process mapping on the fly (would
involve some nasty SMP synchronisation issues) so that the userland
process is just put to sleep on fb access while the fb is suspended
(or get a SEGV). We probably want to extend the notification mecanism
to userland in some way, but this isn't something i cover in this
patch.
I believe solution to this is simple: always switch to kernel-owned
console during suspend. (swsusp does it, there's patch for S3 to do
the same). That way, Xfree (or qtopia or whoever) should clean up
after themselves and leave the console to the kernel. (See
kernel/power/console.c)
Pavel
--
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2003-08-07 13:34:35
On Thu, 2003-08-07 at 12:03, Pavel Machek wrote:
I believe solution to this is simple: always switch to kernel-owned
console during suspend. (swsusp does it, there's patch for S3 to do
the same). That way, Xfree (or qtopia or whoever) should clean up
after themselves and leave the console to the kernel. (See
kernel/power/console.c)
I admit I quite like this solution. It would also help displaying
something sane (blank, pattern, whatever) on screen during driver
teardown instead of the junk left by X...
I'll look into including that switch into my pmac code as well
and see if it works properly in all cases (I think so). Also,
recent DRI CVS finally has working suspend/resume (works on
console switch too).
Ben.
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2003-08-07 14:42:46
I believe solution to this is simple: always switch to kernel-owned
console during suspend. (swsusp does it, there's patch for S3 to do
the same). That way, Xfree (or qtopia or whoever) should clean up
after themselves and leave the console to the kernel. (See
kernel/power/console.c)
I tried using it on pmac, but it causes hell with XFree. I'm not sure
what's up yet, I suspect it may be XFree still doing things after
calling the RELDISP ioctl but I'm not completely sure yet.
The setup XFree + DRI is working without switching to suspend console
(with only the apm_bios emulation for XFree to suspend/restore itself)
but not when switching to suspend console right before doing the apm
emulation callbacks (which should be ignored by X since it's no longer
the frontmost process at this point).
For some reason, it seems that after we have switched to the suspend
console, we race with the X server on accel engine, and on resume, the X
server just crashes.
Ben.
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
From: James Simmons <hidden> Date: 2003-08-07 17:23:17
I believe solution to this is simple: always switch to kernel-owned
console during suspend. (swsusp does it, there's patch for S3 to do
the same). That way, Xfree (or qtopia or whoever) should clean up
after themselves and leave the console to the kernel. (See
kernel/power/console.c)
Not very helpful on embedded systems that use the framebuffer without the
VT console.
From: James Simmons <hidden> Date: 2003-08-07 17:26:22
quoted
I believe solution to this is simple: always switch to kernel-owned
console during suspend. (swsusp does it, there's patch for S3 to do
the same). That way, Xfree (or qtopia or whoever) should clean up
after themselves and leave the console to the kernel. (See
kernel/power/console.c)
I admit I quite like this solution. It would also help displaying
something sane (blank, pattern, whatever) on screen during driver
teardown instead of the junk left by X...
There is the case of framebuffer without VT console. Of course X can't
work except with specific patches. X shouldn't be touching the console.
From: James Simmons <hidden> Date: 2003-08-07 17:28:05
For some reason, it seems that after we have switched to the suspend
console, we race with the X server on accel engine, and on resume, the X
server just crashes.
Are you shutting down the accel engine in the fbdev driver on suspend?
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
From: Pavel Machek <hidden> Date: 2003-08-07 20:29:29
Hi!
quoted
I believe solution to this is simple: always switch to kernel-owned
console during suspend. (swsusp does it, there's patch for S3 to do
the same). That way, Xfree (or qtopia or whoever) should clean up
after themselves and leave the console to the kernel. (See
kernel/power/console.c)
I tried using it on pmac, but it causes hell with XFree. I'm not sure
what's up yet, I suspect it may be XFree still doing things after
calling the RELDISP ioctl but I'm not completely sure yet.
Sounds like XFree bug to me ;-).
Pavel
--
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
From: Pavel Machek <hidden> Date: 2003-08-07 20:30:13
Hi!
quoted
I believe solution to this is simple: always switch to kernel-owned
console during suspend. (swsusp does it, there's patch for S3 to do
the same). That way, Xfree (or qtopia or whoever) should clean up
after themselves and leave the console to the kernel. (See
kernel/power/console.c)
Not very helpful on embedded systems that use the framebuffer without the
VT console.
Okay, that might be a problem. But such system will need some special
notification... Is VT so much overhead?
Pavel
--
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
Hi.
Would this play well with the suspend process itself displaying output?
(Eg progress, errors...).
Regards,
Nigel
On Fri, 2003-08-08 at 01:32, Benjamin Herrenschmidt wrote:
On Thu, 2003-08-07 at 12:03, Pavel Machek wrote:
quoted
I believe solution to this is simple: always switch to kernel-owned
console during suspend. (swsusp does it, there's patch for S3 to do
the same). That way, Xfree (or qtopia or whoever) should clean up
after themselves and leave the console to the kernel. (See
kernel/power/console.c)
I admit I quite like this solution. It would also help displaying
something sane (blank, pattern, whatever) on screen during driver
teardown instead of the junk left by X...
I'll look into including that switch into my pmac code as well
and see if it works properly in all cases (I think so). Also,
recent DRI CVS finally has working suspend/resume (works on
console switch too).
Ben.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
--
Nigel Cunningham
495 St Georges Road South, Hastings 4201, New Zealand
You see, at just the right time, when we were still powerless,
Christ died for the ungodly.
-- Romans 5:6, NIV.
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
From: Pavel Machek <hidden> Date: 2003-08-07 21:52:03
Hi!
Would this play well with the suspend process itself displaying output?
(Eg progress, errors...).
Yes.
Pavel
...
quoted
quoted
I believe solution to this is simple: always switch to kernel-owned
console during suspend. (swsusp does it, there's patch for S3 to do
the same). That way, Xfree (or qtopia or whoever) should clean up
after themselves and leave the console to the kernel. (See
kernel/power/console.c)
I admit I quite like this solution. It would also help displaying
something sane (blank, pattern, whatever) on screen during driver
teardown instead of the junk left by X...
I'll look into including that switch into my pmac code as well
and see if it works properly in all cases (I think so). Also,
recent DRI CVS finally has working suspend/resume (works on
console switch too).
Ben.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
--
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01