[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#390646: xserver-xorg: Server crash when switching back from full screen mode



On Wed, 2006-10-11 at 02:32 +0200, Frans Pop wrote: 
> 
> On Monday 02 October 2006 13:51, Frans Pop wrote:
> > After playing a particular game (Chromium) in full screen mode, the
> > XOrg server crashes about 2 out of 3 times when switching back to KDE.
> 
> With the help of David I've done some further research on this and 
> obtained a full backtrace from gdb with both the xserver and the i810 
> driver compiled with debugging symbols (attached).
> 
> I used the upstream 1.7.0 version of the i810 driver for this, so it is 
> confirmed that the new driver does _not_ fix this issue.
> 
> From the Xorg log:
> (II) Module i810: vendor="X.Org Foundation"
>         compiled for 7.1.1, module version = 1.7.0
>         Module class: X.Org Video Driver
>         ABI class: X.Org Video Driver, version 1.0
> 
> My default screen resolution when running KDE is 1280x1024. The game 
> switches that to fullscreen mode at 800x600.
> The crash mostly happens when exiting the game, but also sometimes when 
> starting it.
> Both starting and exiting the game are also sometimes successful.

Thanks for the detailed information. This looks like a race condition
between the mode switching code leaving pScrn->currentMode NULL for some
time and I830SetCursorPosition() dereferencing it unconditionally,
getting called from the SIGIO handler. 

Can you try the attached patch? Alternatively, possible workarounds are:

      * Disabling SilkenMouse
      * Not moving the mouse while the mode is being switched ;)

Alan, if the patch works for Frans, should I push it to xf86-video-intel
git, or would you like to fix this differently?


> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 47953045281504 (LWP 8640)]
> I830SetCursorPosition (pScrn=0x6ea2d0, x=33, y=61)
> at ../../src/i830_cursor.c:524
> 524        if (x >= pScrn->currentMode->HDisplay) x =
> pScrn->currentMode->HDisplay - 1;
> (gdb) bt f
> #0  I830SetCursorPosition (pScrn=0x6ea2d0, x=33, y=61)
> at ../../src/i830_cursor.c:524
> #1  0x00002b9cf1921c39 in xf86SetCursor ()
> from /usr/lib/xorg/modules/libramdac.so
> #2  0x00002b9cf19213c9 in xf86CursorSetCursor ()
> from /usr/lib/xorg/modules/libramdac.so
> #3  0x00000000004cacf2 in miPointerMove (pScreen=0x6f0cc0, x=34, y=62,
> time=884799019)
>     at ../../mi/mipointer.c:487
> #4  0x00000000004cadce in miPointerAbsoluteCursor (x=34, y=62,
> time=884799019)
>     at ../../mi/mipointer.c:456
> #5  0x000000000049e170 in xf86PostMotionEvent (device=0x748c80,
> is_absolute=0,
>     first_valuator=<value optimized out>, num_valuators=2)
>     at ../../../../hw/xfree86/common/xf86Xinput.c:1057
> #6  0x00002b9cf139d76c in xf86MouseProtocolNameToID ()
>    from /usr/lib/xorg/modules/input/mouse_drv.so
> #7  0x00002b9cf139dce8 in xf86MouseProtocolNameToID ()
>    from /usr/lib/xorg/modules/input/mouse_drv.so
> #8  0x00002b9cf139e182 in xf86MouseProtocolNameToID ()
>    from /usr/lib/xorg/modules/input/mouse_drv.so
> #9  0x00000000004803bf in xf86SigioReadInput (fd=<value optimized
> out>, closure=0x7479d0)
>     at ../../../../hw/xfree86/common/xf86Events.c:1232
> #10 0x000000000046d60f in xf86SIGIO (sig=<value optimized out>)
> 
> at ../../../../../hw/xfree86/os-support/linux/../shared/sigio.c:125
> #11 0x00002b9cf0027110 in killpg () from /lib/libc.so.6
> #12 0x0000000000000000 in ?? ()


-- 
Earthling Michel Dänzer           |          http://tungstengraphics.com
Libre software enthusiast         |          Debian, X and DRI developer
diff --git a/src/i830_cursor.c b/src/i830_cursor.c
index c5c904c..8343b6b 100644
--- a/src/i830_cursor.c
+++ b/src/i830_cursor.c
@@ -520,11 +520,17 @@ #endif
    x -= pScrn->frameX0;
    y -= pScrn->frameY0;
 
-   /* Clamp the cursor position to the visible screen area */
-   if (x >= pScrn->currentMode->HDisplay) x = pScrn->currentMode->HDisplay - 1;
-   if (y >= pScrn->currentMode->VDisplay) y = pScrn->currentMode->VDisplay - 1;
-   if (x <= -I810_CURSOR_X) x = -I810_CURSOR_X + 1;
-   if (y <= -I810_CURSOR_Y) y = -I810_CURSOR_Y + 1;
+   if (pScrn->currentMode) {
+      /* Clamp the cursor position to the visible screen area */
+      if (x >= pScrn->currentMode->HDisplay) x = pScrn->currentMode->HDisplay - 1;
+      if (y >= pScrn->currentMode->VDisplay) y = pScrn->currentMode->VDisplay - 1;
+      if (x <= -I810_CURSOR_X) x = -I810_CURSOR_X + 1;
+      if (y <= -I810_CURSOR_Y) y = -I810_CURSOR_Y + 1;
+   } else {
+      /* Can't ensure the cursor will be visible, so hide it */
+      hide = TRUE;
+      show = FALSE;
+   }
 
 #if 0
    /*

Reply to: