Bug 64808 - X segfault on xf86-video-modesetting whit SDL apps start runing at fullscreen in 64 bits
Summary: X segfault on xf86-video-modesetting whit SDL apps start runing at fullscreen...
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/modesetting (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: high critical
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
Depends on:
Reported: 2013-05-21 03:39 UTC by Pablo Lezaeta
Modified: 2013-06-11 00:32 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:

backtrace and variables with gdb (1.10 KB, text/plain)
2013-05-24 17:44 UTC, Peter Wu
no flags Details
Prevent AdjustFrame from calling uninitialized mode_set (626 bytes, patch)
2013-05-25 09:41 UTC, Peter Wu
no flags Details | Splinter Review

Description Pablo Lezaeta 2013-05-21 03:39:05 UTC

As I mention I can reproduce segfault in ALL app linked to SDL that want full screen in a gma500_gfx using xf86-video-modesetting in a 64 it environment

If I run same app windowed, nothing happen, run normal, but if I runn it a Full screen ( not maximized.. FULLscreened) then X segfault

I can reproduce it whit X 1.13-1.14 and uper, mesa 9.1 (in fact and extrangely my Distro unify all the mesa pkgs in one for mesa 9.1-2 an then all the segfaults begin) SDL 1.2

I test
Zsnes fullscreen without opengl, with it
doukutsu fullscreen 16,24,32 bits
airlines tycoon linux demo at fullscreen at default conf
and athers
Comment 1 Peter Wu 2013-05-24 17:44:16 UTC
Created attachment 79772 [details]
backtrace and variables with gdb

Confirmed, trying to start QEMU (in SDL) full-screen triggers a segfault. Backtrace attached.

Problematic source:
 957 {
 958     SCRN_INFO_PTR(arg);
 959     xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
 960     xf86OutputPtr output = config->output[config->compat_output];
 961     xf86CrtcPtr crtc = output->crtc;
 963     if (crtc && crtc->enabled) {
 964         crtc->funcs->mode_set(crtc, pScrn->currentMode,
pScrn->currentMode, x,
 965                               y);
 966         crtc->x = output->initial_x + x;
 967         crtc->y = output->initial_y + y;
 968     }

mode_set is not set in drmmode_display.c, static const xf86CrtcFuncsRec drmmode_crtc_funcs. If I disable this function within gdb (break AdjustFrame; return; continue), there is no crash. (but the picture is shown outside the screen boundaries, probably unrelated?)
Comment 2 Peter Wu 2013-05-24 17:45:41 UTC
By the way, that was Xorg 1.14.1 on Arch Linux 64-bit. Using gma500_gfx as well.
Comment 3 Peter Wu 2013-05-25 09:41:39 UTC
Created attachment 79781 [details] [review]
Prevent AdjustFrame from calling uninitialized mode_set

In my tests with qemu, output->initial_x, x and crtc->x (and p;s/x/y/g) are always 0. That, and since I saw other drivers that also do nothing for AdjustFrame, I decided to strip this whole function.

The code that is stripped by this patch originates from a different driver in 2008.

After applying this patch, X no longer segfaults (obviously, mode_set is a NULL pointer...). In order to get the picture correctly displayed on-screen, I had to apply another quirk though. There was a ghost output device which I had to disable before starting this application. It is documented on

I have also tried the below patch, with the same results:
--- src/xf86-video-modesetting-0.7.0/src/driver.c	2013-05-25 08:35:26.372159926 +0000
+++ -	2013-05-25 08:35:31.281344995 +0000
@@ -961,10 +961,8 @@
     xf86CrtcPtr crtc = output->crtc;
     if (crtc && crtc->enabled) {
-	crtc->funcs->mode_set(crtc, pScrn->currentMode, pScrn->currentMode, x,
-			      y);
-	crtc->x = output->initial_x + x;
-	crtc->y = output->initial_y + y;
+        crtc->funcs->set_mode_major(crtc, pScrn->currentMode, crtc->rotation,
+                output->initial_x + x, output->initial_y + y);
Comment 4 Alexander Sharihin 2013-05-30 07:34:42 UTC
This problem actual for x86 too.
Comment 5 Dave Airlie 2013-06-11 00:32:21 UTC
should be fixed in master now.

I'll do a release in a day or two.

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.