Bug 55864 - Xonotic crash when change resolution with gnome-session
Summary: Xonotic crash when change resolution with gnome-session
Status: VERIFIED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/Ext/RandR (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: low normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-11 08:56 UTC by meng
Modified: 2013-09-16 07:30 UTC (History)
4 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Xorg.0.log (48.62 KB, text/plain)
2012-10-11 08:56 UTC, meng
no flags Details
dmesg when run xonotic (121.57 KB, text/plain)
2012-10-11 08:57 UTC, meng
no flags Details
Xorg.0.log of xonotic (28.79 KB, text/plain)
2012-10-16 03:43 UTC, meng
no flags Details
Xorg.0.log when run xonotic (47.82 KB, text/plain)
2012-10-16 03:55 UTC, meng
no flags Details
xtrace for xonotic( xtrace -n -D:9 ./xonotic-linux64-glx) (670.51 KB, text/plain)
2012-10-22 01:12 UTC, meng
no flags Details
Fix BadValue if no currentMode set (1.32 KB, patch)
2012-10-22 09:03 UTC, Chris Wilson
no flags Details | Splinter Review
Use errorValue to report failing test (1.99 KB, patch)
2012-10-22 09:04 UTC, Chris Wilson
no flags Details | Splinter Review
xtrace for xonotic when xserver with above patches (705.20 KB, text/plain)
2012-10-23 01:35 UTC, meng
no flags Details
xtrace for xonotic with above patch (682.27 KB, text/plain)
2012-11-06 06:34 UTC, meng
no flags Details
xrandr report whilst xonotic is running (986 bytes, text/plain)
2012-11-14 08:24 UTC, meng
no flags Details
xrandr when crash (986 bytes, text/plain)
2012-11-14 08:27 UTC, meng
no flags Details

Description meng 2012-10-11 08:56:18 UTC
System Environment:       
--------------------------
Platform:IVB,Piketon
Libdrm:	(master)libdrm-2.4.39-18-g844d75e5a0b3b8f3466a24256955e886275fb298
Mesa:   (9.0)3913cd19b82802449dad2008ff4cfc1d546c05a6
Xserver:(server-1.12-branch)xorg-server-1.12.4-2-g78c77356c5d
Libva:  (master)ab06c8cb5d41e21b03c3d17c5898fae8261113e6
Kernel:	(drm-intel-fixes)c3495ce9785764541d5922bead59da8739be3116

Bug detailed description:
-----------------------------
Xonotic v0.6.0 crash when change resolution with gnome-session. 
It works well with only xinit.It still exists on latest kernel with RC12.02 X11R7 driver. 
Because usb driver can’t work with old kernel, so I don’t test the problem with old kernel. There is no stack in bt. Pls see Xorg.0.log and dmesg attached.

Info in console
------------------
VID_Restart: changing from fullscreen 800x600x32bpp, to fullscreen 1024x768x32bpp.
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  129 (XFree86-VidModeExtension)
  Minor opcode of failed request:  10 (XF86VidModeSwitchToMode)
  Value in failed request:  0x1c00002
  Serial number of failed request:  1799
  Current serial number in output stream:  180

Reproduce steps:
----------------------------
1, xinit&
2, gnome-session
3, ./xonotic-linux64-sdl
4, change resolution(Settings/Video/Resolution)
Comment 1 meng 2012-10-11 08:56:50 UTC
Created attachment 68429 [details]
Xorg.0.log
Comment 2 meng 2012-10-11 08:57:32 UTC
Created attachment 68430 [details]
dmesg when run xonotic
Comment 3 Chris Wilson 2012-10-11 09:02:04 UTC
That Xorg.log doesn't match the versions you stated, which I note do not include the ddx...
Comment 4 meng 2012-10-11 09:31:06 UTC
Sorry, I make a mistake. The right environment is as following which matches the Xorg.log. 

---------------------------------------------------------
Libdrm:(master)libdrm-2.4.39-18-g844d75e5a0b3b8f3466a24256955e886275fb298
Mesa:  (9.0)8e73273cb95626d9def012eeb508160e4022ff60
Xserver:(server-1.12-branch)xorg-server-1.12.4-2-g78c77356c5d88 Xf86_video_intel:(master)2.20.9-47-gd73f5b5bb1a81421f1fdc3ac3
Kernel:	(drm-intel-fixes) 5713a6cfd335dd665400de95fb645ea3d45f27f5
Comment 5 Chris Wilson 2012-10-15 09:06:40 UTC
Just to clarify my point, from the Xorg.0.log:

48.867] (II) LoadModule: "intel"
[    48.867] (II) Loading /opt/X11R7/lib/xorg/modules/drivers/intel_drv.so
[    48.870] (II) Module intel: vendor="X.Org Foundation"
[    48.870] 	compiled for 1.11.4, module version = 2.17.0
[    48.870] 	Module class: X.Org Video Driver
[    48.870] 	ABI class: X.Org Video Driver, version 11.0

which is definitely not the version you think you are testing.
Comment 6 meng 2012-10-16 03:43:20 UTC
Run xonotic by xonotic-linux64-glx or xonotic-linux64-sdl(bug 55829).
This problem can be only reproduced by xonotic-linux64-glx. 
Please see xonotic_Xorg.0.log with above version.
Comment 7 meng 2012-10-16 03:43:55 UTC
Created attachment 68596 [details]
Xorg.0.log of xonotic
Comment 8 meng 2012-10-16 03:55:39 UTC
Created attachment 68597 [details]
Xorg.0.log when run xonotic
Comment 9 Chris Wilson 2012-10-18 16:10:46 UTC
Well that is just bizarre. Care to attach an xtrace so that we can get a dump of the commands sent?
Comment 10 meng 2012-10-22 01:12:49 UTC
Created attachment 68893 [details]
xtrace for xonotic( xtrace -n -D:9 ./xonotic-linux64-glx)
Comment 11 Chris Wilson 2012-10-22 09:02:48 UTC
Fantastic, the XVidMode extension doesn't bother to fill in the error correctly. So a couple of patches to apply to the xserver and then repeat the test with xtrace...
Comment 12 Chris Wilson 2012-10-22 09:03:54 UTC
Created attachment 68907 [details] [review]
Fix BadValue if no currentMode set
Comment 13 Chris Wilson 2012-10-22 09:04:19 UTC
Created attachment 68908 [details] [review]
Use errorValue to report failing test
Comment 14 meng 2012-10-23 01:35:19 UTC
Created attachment 68938 [details]
xtrace for xonotic when xserver with above patches
Comment 15 Chris Wilson 2012-10-23 07:44:58 UTC
Ok, that means that we found a valid mode, but the actual modeset failed (VidModeSwitchMode). Now to dig deeper to see how that could fail silently.
Comment 16 Chris Wilson 2012-10-23 08:52:01 UTC
No obvious failures that might correspond with the silence in the Xorg.log. Can you attach gdb to Xorg and set a breakpoint on VidModeSwitchMode and step through until you see the return FALSE?
Comment 17 meng 2012-10-24 02:29:38 UTC
(In reply to comment #16)

Hi.It seems that Xorg don't run to breakpoint VidModeSwitchMode.
-----------------------------
gdb /opt/X11R7/bin/Xorg
(gdb) b VidModeSwitchMode
Breakpoint 1 at 0x486160: file xf86VidMode.c, line 327.
(gdb) r
...
[tcsetpgrp failed in terminal_inferior: Operation not permitted]
Detaching after fork from child process 1163.
Detaching after fork from child process 1164.
Comment 18 Chris Wilson 2012-10-24 08:01:08 UTC
Hmm, you may have had different line numbers to me. :|

Try breaking on ProcXF86VidModeSwitchToMode instead and stepping until you hit a FALSE.
Comment 19 meng 2012-10-24 08:20:02 UTC
(In reply to comment #18)

Try to break on ProcXF86VidModeSwitchToMode(Breakpoint 1 at 0x4a0500: file xf86vmode.c, line 1078), but the same as above.
Comment 20 Chris Wilson 2012-10-26 14:15:05 UTC
That's a little unexpected as you successfully patched that function to change the reporting of the Error...
Comment 21 Chris Wilson 2012-11-05 10:17:09 UTC
So far, the indication is that SwitchMode is failing due to DGA being active (for no apparent reason).

I think a bisection on the xserver is in order; there were a few changes made to DGA in the last 6 months or so that might be responsible.
Comment 22 meng 2012-11-06 03:14:47 UTC
(In reply to comment #21)

The problem still exists on xorg-server-1.10.3
----------------------------------------------
Libdrm:  (master)2.4.26-11-gc82ef03e4c92017bf5644f294ea04e30500f8d4c
Mesa:    (7.11)b9c7773e0dbf75b9bf5142382fa4174a9f2f569f
Xserver: (server-1.10-branch)xorg-server-1.10.3
Xf86_video_intel: (master)2.16.0-115-gc5414ec992d935e10156a2b513d5ec2dded2f689
Cairo:   (master)34f507a919b0709caa2c0be30e43719356293dd1
Kernel:  (drm-intel-fixes)b3f33cbf7ace8fc149993ee35e0d0fd57f41d6d8
Comment 23 Chris Wilson 2012-11-06 05:40:30 UTC
Ok, how about we first confirm our diagnosis with:

diff --git a/hw/xfree86/common/xf86Cursor.c b/hw/xfree86/common/xf86Cursor.c
index 65a9e82..31cebab 100644
--- a/hw/xfree86/common/xf86Cursor.c
+++ b/hw/xfree86/common/xf86Cursor.c
@@ -206,7 +206,7 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode)
         return FALSE;
 
 #ifdef XFreeXDGA
-    if (DGAActive(pScr->scrnIndex))
+    if (0 && DGAActive(pScr->scrnIndex))
         return FALSE;
 #endif
Comment 24 meng 2012-11-06 06:32:52 UTC
Test xorg-server-1.13.0 with above patch, pls see xtrace attached.
When set a breakpoint on VidModeSwitchMode, bt as following:
216    if (mode->HDisplay > pScr->virtualX || mode->VDisplay > pScr->virtualY)
217    return FALSE;
-------------------------------
#0  xf86SwitchMode (pScreen=0x1b921a0, mode=0x1b8c990) at xf86Cursor.c:217
#1  0x00000000004b4819 in VidModeSwitchMode (scrnIndex=0, mode=0x1b8c990) at xf86VidMode.c:340
#2  0x00000000004caddd in ProcXF86VidModeSwitchToMode (client=0x1edd550) at xf86vmode.c:1168
#3  0x00000000004cc198 in ProcXF86VidModeDispatch (client=0x1edd550) at xf86vmode.c:1673
#4  0x0000000000434726 in Dispatch () at dispatch.c:428
#5  0x000000000049916d in main (argc=2, argv=0x7fff2c2ac538, envp=0x7fff2c2ac550) at main.c:295
Comment 25 meng 2012-11-06 06:34:20 UTC
Created attachment 69592 [details]
xtrace for xonotic with above patch
Comment 26 Chris Wilson 2012-11-13 12:55:39 UTC
Are we confident that it is indeed now returning FALSE due to the check of the request against the screen size?

What does xrandr report whilst xonotic is running? And afterwards?
Comment 27 meng 2012-11-14 06:13:34 UTC
(In reply to comment #26)
When run xonotic, display resolution is 1024x768(xonotic pre-set resolution). After set 1280x1080 in xonotic, game crash and display is still 1024x768.
Comment 28 Chris Wilson 2012-11-14 08:15:14 UTC
I need to know what xrandr says the screen size is in addition to the display size.
Comment 29 meng 2012-11-14 08:24:40 UTC
Created attachment 70054 [details]
xrandr report whilst xonotic is running
Comment 30 meng 2012-11-14 08:27:21 UTC
Created attachment 70055 [details]
xrandr when crash
Comment 31 meng 2012-11-16 00:55:39 UTC
The problem only exists on gnome-session, not xinit and gnome-shell.
Comment 32 Chris Wilson 2012-11-16 09:13:32 UTC
Ok, we have an explanation at last:

  if (mode->HDisplay > pScr->virtualX || mode->VDisplay > pScr->virtualY) return FALSE;

is the winner as gnome-shell (or one of its helpers) is adjusting the screen size upon the VidMode change. So the bug lies somewhere between VidMode not handling screen size in conjunction with display sizes, Xonotic using the legacy VidMode rather than RandR and gnome-shell's overly helpful behaviour of changing the screen size.

Should also file a bug against gnome-shell for them to investigate their behaviour.
Comment 33 ye.tian 2013-02-21 02:39:27 UTC
This problem still exists on environment.
----------------------------
Kernel_version:     3.8
Libdrm:             2.4.42
Mesa:               (9.1)9.1-rc2
Xserver:            (server-1.13-branch)xorg-server-1.13.2
Xf86_video_intel:   (master)2.21.0
Cairo:              (master)1.12.12
Libva:              staging-20130205
Libva_intel_driver: staging-20130205
Comment 34 meng 2013-09-16 07:30:29 UTC
The problem doesn't exists on the driver.
-----------------
Mesa:        mesa-9.2
Kernel :     3.11
Libdrm:     2.4.46
Xf86_video_intel:    2.99.902
Libva:         libva-1.2.1
Libva_intel_driver:    (master)git-9f3fd62
Cairo:         1.12.16
Xserver:     xorg-server-1.14.2.902


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.