[AD] fbcon VT switch problem

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


There was a problem with the fbcon driver and VT switching.  If the
vsync implementation was emulated using `retrace_count' then it would
hang when trying to restore the video mode after a VT switch because
timer "interrupts" are disabled during that time.

I have committed the following patch.

Peter
=== src/linux/fbcon.c
==================================================================
--- src/linux/fbcon.c	(revision 5612)
+++ src/linux/fbcon.c	(local)
@@ -111,8 +111,10 @@
    static int vblank_flags;                  /* supports retrace detection? */
 #endif
 
+static int in_fb_restore;
 
 
+
 static int update_timings(struct fb_var_screeninfo *mode);
 
 
@@ -577,6 +579,10 @@
  */
 static void fb_restore(void)
 {
+   ASSERT(!in_fb_restore);
+
+   in_fb_restore = TRUE;
+   
    ioctl(fbfd, FBIOPUT_VSCREENINFO, &my_mode);
 
    if (fb_approx)
@@ -584,6 +590,8 @@
 
    if (fix_info.visual == FB_VISUAL_DIRECTCOLOR)
       set_ramp_cmap(&fix_info, &my_mode);
+
+   in_fb_restore = FALSE;
 }
 
 
@@ -677,7 +685,11 @@
  #endif
 
    /* bodged implementation for when the framebuffer doesn't support it */
-   if (_timer_installed) {
+   /* We must not to run this loop while returning from a VT switch as timer
+    * "interrupts" will not be running at that time so retrace_count will
+    * remain constant.
+    */
+   if (_timer_installed && !in_fb_restore) {
       prev = retrace_count;
 
       do {


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/