* [PATCH] notify fbcon if framebuffer registered
@ 2004-03-02 11:38 Pattrick Hueper
2004-03-02 17:41 ` James Simmons
0 siblings, 1 reply; 3+ messages in thread
From: Pattrick Hueper @ 2004-03-02 11:38 UTC (permalink / raw)
To: linux-fbdev-devel
Hi,
Note: Please CC: me on replies, since i am not a member of the
linux-fbdev-devel list!
I am helping a team at handhelds.org to port linux to the ipaq h2210, i
was trying to get the framebuffer to start when i came across the
problem, that our fb device is initialized after fb_console_init. I saw
that sometime between 2.6.1 and 2.6.3 you added a notifier_chain for
suspend/resume, so i added a new event for newly registered
framebuffers, this helps my ipaq fb to start, when the kernel starts.
Here is the patch i came up with: (it is a patch based on the
handhelds.org kernel sources, i hope that it still fits your sources.
Sorry!)
I basically added a new event in fb.h and notified the event in
register_framebuffer. I had to move the fb_register_client call in
fb_console_init up, before "if (!num_registered_fb) because it otherwise
did not get called in my case. in fbcon_event_notify() i just call
take_over_console, which is what fb_console_init would have done, had
the framebuffer been registered before, if i understood it correctly.
Regards, Patty
Index: drivers/video/fbmem.c
===================================================================
RCS file: /cvs/linux/kernel26/drivers/video/fbmem.c,v
retrieving revision 1.13
diff -u -b -r1.13 fbmem.c
--- drivers/video/fbmem.c 29 Feb 2004 01:49:03 -0000 1.13
+++ drivers/video/fbmem.c 1 Mar 2004 13:27:57 -0000
@@ -167,6 +167,7 @@
extern int tcx_setup(char*);
extern int leo_init(void);
extern int leo_setup(char*);
+extern int mq1100fb_init(void);
extern int kyrofb_init(void);
extern int kyrofb_setup(char*);
@@ -385,6 +386,9 @@
#ifdef CONFIG_FB_VOODOO1
{ "sstfb", sstfb_init, sstfb_setup },
#endif
+#ifdef CONFIG_FB_MQ1100
+ { "mq1100fb", mq1100fb_init, NULL },
+#endif
#ifdef CONFIG_FB_KYRO
{ "kyrofb", kyrofb_init, kyrofb_setup },
#endif
@@ -1303,6 +1307,9 @@
devfs_mk_cdev(MKDEV(FB_MAJOR, i),
S_IFCHR | S_IRUGO | S_IWUGO, "fb/%d", i);
+
+ notifier_call_chain (&fb_notifier_list, FB_EVENT_FB_REGISTERED,
fb_info);
+
return 0;
}
Index: drivers/video/console/fbcon.c
===================================================================
RCS file: /cvs/linux/kernel26/drivers/video/console/fbcon.c,v
retrieving revision 1.3
diff -u -b -r1.3 fbcon.c
--- drivers/video/console/fbcon.c 29 Feb 2004 01:49:04 -0000 1.3
+++ drivers/video/console/fbcon.c 1 Mar 2004 13:27:57 -0000
@@ -2295,6 +2295,10 @@
case FB_EVENT_RESUME:
fbcon_resumed(info);
break;
+ case FB_EVENT_FB_REGISTERED:
+ /* a framebuffer was registered, try to take over the console */
+ take_over_console(&fb_con, first_fb_vc, last_fb_vc,
fbcon_is_default);
+ break;
}
return 0;
}
@@ -2333,16 +2337,15 @@
int __init fb_console_init(void)
{
- if (!num_registered_fb)
- return -ENODEV;
- take_over_console(&fb_con, first_fb_vc, last_fb_vc, fbcon_is_default);
acquire_console_sem();
if (!fbcon_event_notifier_registered) {
fb_register_client(&fbcon_event_notifer);
fbcon_event_notifier_registered = 1;
}
release_console_sem();
-
+ if (!num_registered_fb)
+ return -ENODEV;
+ take_over_console(&fb_con, first_fb_vc, last_fb_vc, fbcon_is_default);
return 0;
}
Index: include/linux/fb.h
===================================================================
RCS file: /cvs/linux/kernel26/include/linux/fb.h,v
retrieving revision 1.2
diff -u -b -r1.2 fb.h
--- include/linux/fb.h 29 Feb 2004 01:49:22 -0000 1.2
+++ include/linux/fb.h 1 Mar 2004 13:27:58 -0000
@@ -353,6 +353,8 @@
* if you own it
*/
#define FB_EVENT_RESUME 0x03
+/* A new framebuffer registered */
+#define FB_EVENT_FB_REGISTERED 0x04
extern int fb_register_client(struct notifier_block *nb);
extern int fb_unregister_client(struct notifier_block *nb);
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] notify fbcon if framebuffer registered
2004-03-02 11:38 [PATCH] notify fbcon if framebuffer registered Pattrick Hueper
@ 2004-03-02 17:41 ` James Simmons
2004-03-02 20:42 ` Pattrick Hüper
0 siblings, 1 reply; 3+ messages in thread
From: James Simmons @ 2004-03-02 17:41 UTC (permalink / raw)
To: Pattrick Hueper; +Cc: linux-fbdev-devel
> I am helping a team at handhelds.org to port linux to the ipaq h2210, i
> was trying to get the framebuffer to start when i came across the
> problem, that our fb device is initialized after fb_console_init.
Is your driver built as a module? That is the only way that could happen
that I know of. The new behavior is that the fbdev device doesn't not
automatically take over the console. You use the app con2fb to do that.
The reason was so developers could debug there drivers easily. Alot of
times there is a bug in the xxfb_init code and you end up with a blank
display. Very hard to work with. Also some fbdev drivers can work with
vgacon. So you could run a fbdev app on vgacon!!! In this case you don't
want the fbdev device changing the hardware.
Actually you don't really need fbcon for embedded devices except for
debugging output. If your device is embedded and without fbcon you can
call fb_set_var before you register the device.
> I saw
> that sometime between 2.6.1 and 2.6.3 you added a notifier_chain for
> suspend/resume, so i added a new event for newly registered
> framebuffers, this helps my ipaq fb to start, when the kernel starts.
>
> Here is the patch i came up with: (it is a patch based on the
> handhelds.org kernel sources, i hope that it still fits your sources.
> Sorry!)
>
> I basically added a new event in fb.h and notified the event in
> register_framebuffer. I had to move the fb_register_client call in
> fb_console_init up, before "if (!num_registered_fb) because it otherwise
> did not get called in my case. in fbcon_event_notify() i just call
> take_over_console, which is what fb_console_init would have done, had
> the framebuffer been registered before, if i understood it correctly.
This patch could come in handy for hotplug events :-) We would also need a
unregister event. The only thing is you have to do some filtering here.
Say you have a multi-head system. If question you have is do you want to
register this device to the fbcon system. The second question is to which
VCs do you map this device. In fbcon you have a map for that. I have to
think about how to do that. Your patch is a great start. I just need to
go over the different possible cases we can have.
> Regards, Patty
>
> Index: drivers/video/fbmem.c
> ===================================================================
> RCS file: /cvs/linux/kernel26/drivers/video/fbmem.c,v
> retrieving revision 1.13
> diff -u -b -r1.13 fbmem.c
> --- drivers/video/fbmem.c 29 Feb 2004 01:49:03 -0000 1.13
> +++ drivers/video/fbmem.c 1 Mar 2004 13:27:57 -0000
> @@ -167,6 +167,7 @@
> extern int tcx_setup(char*);
> extern int leo_init(void);
> extern int leo_setup(char*);
> +extern int mq1100fb_init(void);
> extern int kyrofb_init(void);
> extern int kyrofb_setup(char*);
>
> @@ -385,6 +386,9 @@
> #ifdef CONFIG_FB_VOODOO1
> { "sstfb", sstfb_init, sstfb_setup },
> #endif
> +#ifdef CONFIG_FB_MQ1100
> + { "mq1100fb", mq1100fb_init, NULL },
> +#endif
> #ifdef CONFIG_FB_KYRO
> { "kyrofb", kyrofb_init, kyrofb_setup },
> #endif
> @@ -1303,6 +1307,9 @@
>
> devfs_mk_cdev(MKDEV(FB_MAJOR, i),
> S_IFCHR | S_IRUGO | S_IWUGO, "fb/%d", i);
> +
> + notifier_call_chain (&fb_notifier_list, FB_EVENT_FB_REGISTERED,
> fb_info);
> +
> return 0;
> }
>
> Index: drivers/video/console/fbcon.c
> ===================================================================
> RCS file: /cvs/linux/kernel26/drivers/video/console/fbcon.c,v
> retrieving revision 1.3
> diff -u -b -r1.3 fbcon.c
> --- drivers/video/console/fbcon.c 29 Feb 2004 01:49:04 -0000 1.3
> +++ drivers/video/console/fbcon.c 1 Mar 2004 13:27:57 -0000
> @@ -2295,6 +2295,10 @@
> case FB_EVENT_RESUME:
> fbcon_resumed(info);
> break;
> + case FB_EVENT_FB_REGISTERED:
> + /* a framebuffer was registered, try to take over the console */
> + take_over_console(&fb_con, first_fb_vc, last_fb_vc,
> fbcon_is_default);
> + break;
> }
> return 0;
> }
> @@ -2333,16 +2337,15 @@
>
> int __init fb_console_init(void)
> {
> - if (!num_registered_fb)
> - return -ENODEV;
> - take_over_console(&fb_con, first_fb_vc, last_fb_vc, fbcon_is_default);
> acquire_console_sem();
> if (!fbcon_event_notifier_registered) {
> fb_register_client(&fbcon_event_notifer);
> fbcon_event_notifier_registered = 1;
> }
> release_console_sem();
> -
> + if (!num_registered_fb)
> + return -ENODEV;
> + take_over_console(&fb_con, first_fb_vc, last_fb_vc, fbcon_is_default);
> return 0;
> }
>
> Index: include/linux/fb.h
> ===================================================================
> RCS file: /cvs/linux/kernel26/include/linux/fb.h,v
> retrieving revision 1.2
> diff -u -b -r1.2 fb.h
> --- include/linux/fb.h 29 Feb 2004 01:49:22 -0000 1.2
> +++ include/linux/fb.h 1 Mar 2004 13:27:58 -0000
> @@ -353,6 +353,8 @@
> * if you own it
> */
> #define FB_EVENT_RESUME 0x03
> +/* A new framebuffer registered */
> +#define FB_EVENT_FB_REGISTERED 0x04
>
> extern int fb_register_client(struct notifier_block *nb);
> extern int fb_unregister_client(struct notifier_block *nb);
>
>
> -------------------------------------------------------
> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> Build and deploy apps & Web services for Linux with
> a free DVD software kit from IBM. Click Now!
> http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
>
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] notify fbcon if framebuffer registered
2004-03-02 17:41 ` James Simmons
@ 2004-03-02 20:42 ` Pattrick Hüper
0 siblings, 0 replies; 3+ messages in thread
From: Pattrick Hüper @ 2004-03-02 20:42 UTC (permalink / raw)
To: James Simmons; +Cc: linux-fbdev-devel
Hi,
thanks for your reply!
>Is your driver built as a module? That is the only way that could happen
>that I know of. The new behavior is that the fbdev device doesn't not
>automatically take over the console. You use the app con2fb to do that.
>The reason was so developers could debug there drivers easily. Alot of
>times there is a bug in the xxfb_init code and you end up with a blank
>display. Very hard to work with. Also some fbdev drivers can work with
>vgacon. So you could run a fbdev app on vgacon!!! In this case you don't
>want the fbdev device changing the hardware.
> Actually you don't really need fbcon for embedded devices except for
>debugging output. If your device is embedded and without fbcon you can
>call fb_set_var before you register the device.
>
>
>
The driver is not compiled as a module, but still fb_console_init runs
before mq11xxfb_init, originally i just called fb_console_init from
within my probe function which worked but was a very ugly way to go, so
i came up with the framebuffer_register notification, and since i saw
that you added event_notifications in kernel 2.6.3, i adapted my
notification and thought i could send you the patch.
It works perfectly for me, sicne my main problem is, that i dont have a
serial cable and can only login to my device thru infrared serial port
which only starts when linuxrc of initrd is running, thus i needed a way
to see kernel messages and the fb seemed an easy way to do that. Thats
what i needed the patch for, and it works perfectly for me, i dont need
to call any applications, just as soon as my (statically compiled) fb is
registered, the fbcon comes up and shows me the boot messages.
I agree that it is only needed for debugging output, thats all i
currently need it for.
>>This patch could come in handy for hotplug events :-) We would also need a
>>unregister event. The only thing is you have to do some filtering here.
>>Say you have a multi-head system. If question you have is do you want to
>>register this device to the fbcon system. The second question is to which
>>VCs do you map this device. In fbcon you have a map for that. I have to
>>think about how to do that. Your patch is a great start. I just need to
>>go over the different possible cases we can have.
>>
>>
>>
I'm very glad if you can use the patch, actually i am not very deep into
the internals of the fbcon, i just saw, that by calling
take_over_console, i can reach my goal, i did not think about any
complications or problems, since i dont know enough about the fbcon.
Regards, Patty
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-03-02 20:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-02 11:38 [PATCH] notify fbcon if framebuffer registered Pattrick Hueper
2004-03-02 17:41 ` James Simmons
2004-03-02 20:42 ` Pattrick Hüper
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).