fbcon/fbdev: Remove fbc
Quoted 12 lines · Antonino A. Daplas
diff -Nru
a/drivers/video/matrox/matroxfb_base.cb/drivers/video/matrox/matroxfb_base.cdrivers/video/matrox/matroxfb_base.c 2004-11-01 08:32:54 +08:00 renamed from drivers/video/matrox/matroxfb_base.c 2004-10-23 02:52:37 +08:00 +0
-5@@ -1877,16 +1876,21 @@ } printk("fb%d: %s frame buffer device\n", ACCESS_FBINFO(fbcon.node), ACCESS_FBINFO(fbcon.fix.id)); - if (ACCESS_FBINFO(fbcon.currcon) < 0) { - /* there is no console on this fb... but we have to initialize hardware - * until someone tells me what is proper thing to do */ - printk(KERN_INFO "fb%d: initializing hardware\n", - ACCESS_FBINFO(fbcon.node));
drivers/video/matrox/matroxfb_base.c 2004-11-01 08:32:54 +08:00 line 1883
Quoted 10 lines
drivers/video/matrox/matroxfb_base.c 2004-11-01 08:32:54 +08:00 renamed from drivers/video/matrox/matroxfb_base.c 2004-10-23 02:52:37 +08:00 +5
-5- /* We have to use FB_ACTIVATE_FORCE, as we had to put vesafb_defined to the fbcon.var - * already before, so register_framebuffer works correctly. */ - vesafb_defined.activate |= FB_ACTIVATE_FORCE; - fb_set_var(&ACCESS_FBINFO(fbcon), &vesafb_defined); - } + /* + * Tony: If this driver is to be mapped to the console, then + * fbcon will automatically do a set_par for us. The code below + * may not be needed. + */
Code below (which you made unconditional now) was executed if and only if there is no fbcon attached to this device. If there is fbcon attached to this device, fbcon.currcon would be >= 0 after register_framebuffer() (and fbcon's startup already did needed set_*). If there is no fbcon, this adapter is secondary, and it must be initialized too before leaving driver. But it must not be initialized before call to register_framebuffer, as otherwise taking over vgacon won't work correctly.
You could put some 'ACCESS_FBINFO(flags.hw_initialized) = 1' somewhere into matroxfb's set_par and then test this flag instead of fbcon.currcon.
But your current code probably does not work very well on primary adapter.
Petr
drivers/video/matrox/matroxfb_base.c 2004-11-01 08:32:54 +08:00 line 1895
Quoted 12 lines
drivers/video/matrox/matroxfb_base.c 2004-11-01 08:32:54 +08:00 renamed from drivers/video/matrox/matroxfb_base.c 2004-10-23 02:52:37 +08:00 +9
-0+ /* there is no console on this fb... but we have to initialize hardware + * until someone tells me what is proper thing to do */ + printk(KERN_INFO "fb%d: initializing hardware\n", + ACCESS_FBINFO(fbcon.node)); + /* We have to use FB_ACTIVATE_FORCE, as we had to put vesafb_defined to the fbcon.var + * already before, so register_framebuffer works correctly. */ + vesafb_defined.activate |= FB_ACTIVATE_FORCE; + fb_set_var(&ACCESS_FBINFO(fbcon), &vesafb_defined); + return 0; failVideoIO:; matroxfb_g450_shutdown(PMINFO2);
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
Quoted 34 lines · Petr Vandrovec
Quoted 22 lines · Antonino A. Daplas
diff -Nru
a/drivers/video/matrox/matroxfb_base.cb/drivers/video/matrox/matroxfb_base.c---a/drivers/video/matrox/matroxfb_base.c2004-10-23 02:52:37 +08:00 +++b/drivers/video/matrox/matroxfb_base.c2004-11-01 08:32:54 +08:00 @@ -1877,16 +1876,21 @@} printk("fb%d: %s frame buffer device\n", ACCESS_FBINFO(fbcon.node), ACCESS_FBINFO(fbcon.fix.id));(quoted diff) +0
-2- if (ACCESS_FBINFO(fbcon.currcon) < 0) { - /* there is no console on this fb... but we have to initializehardware - * until someone tells me what is proper thing to do */
(quoted diff) +0
-3- printk(KERN_INFO "fb%d: initializing hardware\n", - ACCESS_FBINFO(fbcon.node)); - /* We have to use FB_ACTIVATE_FORCE, as we had to put
vesafb_definedto the fbcon.var - * already before, soregister_framebufferworks correctly. */ - vesafb_defined.activate
|=FB_ACTIVATE_FORCE;(quoted diff) +3
-2- fb_set_var(&ACCESS_FBINFO(fbcon), &vesafb_defined); - } + /* + * Tony: If this driver is to be mapped to the console, then + * fbcon will automatically do a set_par for us. The codeQuoted 2 lines
below + * may not be needed.
+ */Code below (which you made unconditional now) was executed if and only if there is no fbcon attached to this device. If there is fbcon attached to this device, fbcon.currcon would be >= 0 after
register_framebuffer()(and fbcon's startup already did needed set_*). If there is no fbcon, this adapter is secondary, and it must be initialized too before leaving driver. But it must not be initialized before call toregister_framebuffer, as otherwise taking over vgacon won't work correctly.
Quoted 4 lines
You could put some '
ACCESS_FBINFO(flags.hw_initialized)= 1' somewhere into matroxfb'sset_parand then test this flag instead of fbcon.currcon.But your current code probably does not work very well on primary adapter.
Why not just leave the hardware uninitialized after register_framebuffer? Then, initialize it at the first call to xxxfb_open()? We can even check a flag so we do this only once. This way if people accidentally enabled matroxfb but forgot to enable fbcon, they will still get a usable vga console.
Tony
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
Quoted 38 lines · Antonino A. Daplas
Quoted 37 lines · Petr Vandrovec
Quoted 22 lines · Antonino A. Daplas
diff -Nru
a/drivers/video/matrox/matroxfb_base.cb/drivers/video/matrox/matroxfb_base.c---a/drivers/video/matrox/matroxfb_base.c2004-10-23 02:52:37 +08:00 +++b/drivers/video/matrox/matroxfb_base.c2004-11-01 08:32:54 +08:00 @@ -1877,16 +1876,21 @@} printk("fb%d: %s frame buffer device\n", ACCESS_FBINFO(fbcon.node), ACCESS_FBINFO(fbcon.fix.id));(quoted diff) +0
-2- if (ACCESS_FBINFO(fbcon.currcon) < 0) { - /* there is no console on this fb... but we have to initializehardware - * until someone tells me what is proper thing to do */
(quoted diff) +0
-3- printk(KERN_INFO "fb%d: initializing hardware\n", - ACCESS_FBINFO(fbcon.node)); - /* We have to use FB_ACTIVATE_FORCE, as we had to put
vesafb_definedto the fbcon.var - * already before, soregister_framebufferworks correctly. */ - vesafb_defined.activate
|=FB_ACTIVATE_FORCE;(quoted diff) +3
-2- fb_set_var(&ACCESS_FBINFO(fbcon), &vesafb_defined); - } + /* + * Tony: If this driver is to be mapped to the console, then + * fbcon will automatically do a set_par for us. The codeQuoted 2 lines
below + * may not be needed.
+ */Code below (which you made unconditional now) was executed if and only if there is no fbcon attached to this device. If there is fbcon attached to this device, fbcon.currcon would be >= 0 after
register_framebuffer()(and fbcon's startup already did needed set_*). If there is no fbcon, this adapter is secondary, and it must be initialized too before leaving driver. But it must not be initialized before call toregister_framebuffer, as otherwise taking over vgacon won't work correctly.You could put some '
ACCESS_FBINFO(flags.hw_initialized)= 1' somewhere into matroxfb'sset_parand then test this flag instead of fbcon.currcon.
Quoted 7 lines
Quoted 1 line
But your current code probably does not work very well on primary adapter.
Why not just leave the hardware uninitialized after
register_framebuffer? Then, initialize it at the first call toxxxfb_open()? We can even check a flag so we do this only once. This way if people accidentally enabled matroxfb but forgot to enable fbcon, they will still get a usable vga console.
Because hardware driver is supposed to drive hardware. Plus I do not agree
with paradigm that open should do something special unless each open provides completely separate view (like opening /dev/ptmx). Harddisk also does not spin up when you open /dev/hda and does not stop when you close it.
Petr Vandrovec
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
Quoted 9 lines · Petr Vandrovec
Quoted 7 lines · Antonino A. Daplas
Quoted 1 line · Petr Vandrovec
On 2 Nov 04 at 19:46, Antonino A. Daplas wrote:
Why not just leave the hardware uninitialized after
register_framebuffer? Then, initialize it at the first call toxxxfb_open()? We can even check a flag so we do this only once. This way if people accidentally enabled matroxfb but forgot to enable fbcon, they will still get a usable vga console.
Quoted 5 lines
Because hardware driver is supposed to drive hardware. Plus I do not
agree with paradigm that open should do something special unless each open provides completely separate view (like opening/dev/ptmx). Harddisk also does not spin up when you open/dev/hdaand does not stop when you close it. Petr Vandrovec
Ok, we'll do the flag in matroxfb_set_par().
Tony
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
Quoted 8 lines · Petr Vandrovec
Quoted 2 lines · Antonino A. Daplas
Quoted 1 line · Petr Vandrovec
On 2 Nov 04 at 19:46, Antonino A. Daplas wrote:
Because hardware driver is supposed to drive hardware. Plus I do not
agree with paradigm that open should do something special unless each open provides completely separate view (like opening/dev/ptmx). Harddisk also does not spin up when you open/dev/hdaand does not stop when you close it. Petr Vandrovec
Is this patch acceptable?
Tony
Set 'initialized' field in xxxfb_set_par and check this flag after register_framebuffer. A nonzero value will force the driver to initialize the hardware.
---
matroxfb_base.c | 20 +++++++++----------- matroxfb_base.h | 1 + matroxfb_crtc2.c | 4 +++- matroxfb_crtc2.h | 1 + 4 files changed, 14 insertions(+), 12 deletions(-)
drivers/video/matrox/matroxfb_base.c +9 -11
@@ -835,6 +835,7 @@matrox_cfbX_init (PMINFO2 ); } } +ACCESS_FBINFO (initialized) =1 ;return 0 ; }
@@ -1876,20 +1877,17 @@ }printk ("fb%d: %s frame buffer device\n" ,ACCESS_FBINFO (fbcon.node),ACCESS_FBINFO (fbcon.fix.id)); -/* -* Tony: If this driver is to be mapped to the console, then -* fbcon will automatically do a set_par for us. The code below -* may not be needed. -*/ /* there is no console on this fb... but we have to initialize hardware * until someone tells me what is proper thing to do */ -printk (KERN_INFO "fb%d: initializing hardware\n" , -ACCESS_FBINFO (fbcon.node)); -/* We have to use FB_ACTIVATE_FORCE, as we had to put vesafb_defined to the fbcon.var -* already before, so register_framebuffer works correctly. */ - vesafb_defined.activate |=FB_ACTIVATE_FORCE ; -fb_set_var (&ACCESS_FBINFO (fbcon), &vesafb_defined); +if (!ACCESS_FBINFO (initialized)) { +printk (KERN_INFO "fb%d: initializing hardware\n" , +ACCESS_FBINFO (fbcon.node)); +/* We have to use FB_ACTIVATE_FORCE, as we had to put vesafb_defined to the fbcon.var +* already before, so register_framebuffer works correctly. */ + vesafb_defined.activate |=FB_ACTIVATE_FORCE ; +fb_set_var (&ACCESS_FBINFO (fbcon), &vesafb_defined); + }return 0 ; failVideoIO:;
drivers/video/matrox/matroxfb_base.h +1 -0
@@ -372,6 +372,7 @@struct list_head next_fb;int dead; +int initialized;unsigned int usecount;unsigned int userusecount;
drivers/video/matrox/matroxfb_crtc2.c +3 -1
@@ -387,6 +387,7 @@up_read (&ACCESS_FBINFO (altout).lock);matroxfb_dh_cfbX_init (m2info); } + m2info->initialized =1 ;return 0 ;#undef m2info }
@@ -633,7 +634,8 @@if (register_framebuffer (&m2info->fbcon)) {return -ENXIO ; } -fb_set_var (&m2info->fbcon, &matroxfb_dh_defined); +if (!m2info->initialized) +fb_set_var (&m2info->fbcon, &matroxfb_dh_defined);down_write (&ACCESS_FBINFO (crtc2.lock)); oldcrtc2 =ACCESS_FBINFO (crtc2.info);ACCESS_FBINFO (crtc2.info) = m2info;
drivers/video/matrox/matroxfb_crtc2.h +1 -0
@@ -9,6 +9,7 @@struct matroxfb_dh_fb_info {struct fb_info fbcon;int fbcon_registered; +int initialized;struct matrox_fb_info * primary_dev;
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
Quoted 11 lines · Antonino A. Daplas
Quoted 8 lines · Petr Vandrovec
Quoted 2 lines · Antonino A. Daplas
Quoted 1 line · Petr Vandrovec
On 2 Nov 04 at 19:46, Antonino A. Daplas wrote:
Because hardware driver is supposed to drive hardware. Plus I do not
agree with paradigm that open should do something special unless each open provides completely separate view (like opening/dev/ptmx). Harddisk also does not spin up when you open/dev/hdaand does not stop when you close it. Petr VandrovecIs this patch acceptable?
Looks good. Thanks for fixing secondary head ;-)
Petr
Quoted 94 lines
Tony
Set 'initialized' field in
xxxfb_set_parand check this flag afterregister_framebuffer. A nonzero value will force the driver to initialize the hardware.Signed-off-by Antonino Daplas <[email protected]>---
matroxfb_base.c | 20 +++++++++----------- matroxfb_base.h | 1 + matroxfb_crtc2.c | 4 +++- matroxfb_crtc2.h | 1 + 4 files changed, 14 insertions(+), 12 deletions(-)diff -Nru
a/drivers/video/matrox/matroxfb_base.cb/drivers/video/matrox/matroxfb_base.cdrivers/video/matrox/matroxfb_base.c +9
-11@@ -835,6 +835,7 @@matrox_cfbX_init (PMINFO2 ); } } +ACCESS_FBINFO (initialized) =1 ;return 0 ; }@@ -1876,20 +1877,17 @@ }printk ("fb%d: %s frame buffer device\n" ,ACCESS_FBINFO (fbcon.node),ACCESS_FBINFO (fbcon.fix.id)); -/* -* Tony: If this driver is to be mapped to the console, then -* fbcon will automatically do a set_par for us. The code below -* may not be needed. -*/ /* there is no console on this fb... but we have to initialize hardware * until someone tells me what is proper thing to do */ -printk (KERN_INFO "fb%d: initializing hardware\n" , -ACCESS_FBINFO (fbcon.node)); -/* We have to use FB_ACTIVATE_FORCE, as we had to put vesafb_defined to the fbcon.var -* already before, so register_framebuffer works correctly. */ - vesafb_defined.activate |=FB_ACTIVATE_FORCE ; -fb_set_var (&ACCESS_FBINFO (fbcon), &vesafb_defined); +if (!ACCESS_FBINFO (initialized)) { +printk (KERN_INFO "fb%d: initializing hardware\n" , +ACCESS_FBINFO (fbcon.node)); +/* We have to use FB_ACTIVATE_FORCE, as we had to put vesafb_defined to the fbcon.var +* already before, so register_framebuffer works correctly. */ + vesafb_defined.activate |=FB_ACTIVATE_FORCE ; +fb_set_var (&ACCESS_FBINFO (fbcon), &vesafb_defined); + }return 0 ; failVideoIO:;diff -Nru
a/drivers/video/matrox/matroxfb_base.hb/drivers/video/matrox/matroxfb_base.hdrivers/video/matrox/matroxfb_base.h +1
-0@@ -372,6 +372,7 @@struct list_head next_fb;int dead; +int initialized;unsigned int usecount;unsigned int userusecount;diff -Nru
a/drivers/video/matrox/matroxfb_crtc2.cb/drivers/video/matrox/matroxfb_crtc2.cdrivers/video/matrox/matroxfb_crtc2.c +3
-1@@ -387,6 +387,7 @@up_read (&ACCESS_FBINFO (altout).lock);matroxfb_dh_cfbX_init (m2info); } + m2info->initialized =1 ;return 0 ;#undef m2info }@@ -633,7 +634,8 @@if (register_framebuffer (&m2info->fbcon)) {return -ENXIO ; } -fb_set_var (&m2info->fbcon, &matroxfb_dh_defined); +if (!m2info->initialized) +fb_set_var (&m2info->fbcon, &matroxfb_dh_defined);down_write (&ACCESS_FBINFO (crtc2.lock)); oldcrtc2 =ACCESS_FBINFO (crtc2.info);ACCESS_FBINFO (crtc2.info) = m2info;diff -Nru
a/drivers/video/matrox/matroxfb_crtc2.hb/drivers/video/matrox/matroxfb_crtc2.h
drivers/video/matrox/matroxfb_crtc2.h line 15
Quoted 7 lines
drivers/video/matrox/matroxfb_crtc2.h +1
-0@@ -9,6 +9,7 @@struct matroxfb_dh_fb_info {struct fb_info fbcon;int fbcon_registered; +int initialized;struct matrox_fb_info * primary_dev;
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click