Skip to content

x11 with Xwayland: requesting fullscreen causes BadRRCrtc and makes subsequent SDL programs fail #4630

@smcv

Description

@smcv

I'm trying to upgrade the SDL package in Debian from 2.0.14 to the recent 2.0.16 release, and encountered a regression. I'm running GNOME 3.38 in Wayland mode with Xwayland, which will be the default desktop environment in Debian 11 (we can't have GNOME 40 in Debian 11, because that wasn't released until after Debian 11 had already frozen).

When I run a fullscreen SDL program like testgl2 --fullscreen or OpenArena using the default X11 video backend for SDL, the updated SDL fails with an X11 error:

X Error of failed request:  BadRRCrtc (invalid Crtc parameter)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  20 (RRGetCrtcInfo)
  Crtc id in failed request: 0x0
  Serial number of failed request:  243
  Current serial number in output stream:  243

SDL 2.0.16 triggers this, but a modified SDL 2.0.16 with b033cd0, 4c7825f, d0effad and 16e3bfe reverted does not trigger it.

When this happens, it changes the state of my Xwayland display, leaving the mode unset.

After the state has changed, running any other graphical SDL program with the X11 backend (for example testgl2, or openarena again) fails, this time with a different error:

X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  151 (XFree86-VidModeExtension)
  Minor opcode of failed request:  1 (XF86VidModeGetModeLine)
  Value in failed request:  0x522
  Serial number of failed request:  63
  Current serial number in output stream:  63

After the state has changed, all versions of SDL that I have tried will fail in the same way (I tried vanilla 2.0.16, 2.0.16 + reverts as listed above, and 2.0.14dfsg2-3 from Debian 11), which means it's easy to get the wrong idea about which versions work and which versions don't.

The changed state persists until I log out from GNOME and back in.

Original report (misleading)

Games like openarena and darkplaces, and also simpler test programs like testgl2 and testvulkan, fail with:

X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  151 (XFree86-VidModeExtension)
  Minor opcode of failed request:  1 (XF86VidModeGetModeLine)
  Value in failed request:  0x522
  Serial number of failed request:  63
  Current serial number in output stream:  63

Workaround: if I run with SDL_VIDEODRIVER=wayland, the games and test programs work (but without window decorations because we don't have libdecor available yet - I'm working on that in parallel).

This seems like might be related to #4561, where @icculus mentioned that XVidMode "doesn't work in SDL2 in almost all cases", but the failure mode is different. I have not done anything special to force Xrandr to be disabled, and I don't have any SDL_* in my environment.

I'm building with essentially the same options that we used in the 2.0.14 package, and in particular configure.ac is successfully detecting Xrandr.

I tried building 2.0.16 with b033cd0, 4c7825f, d0effad and 16e3bfe reverted, but that doesn't seem to resolve this.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions