Does not run properly on Wayland #12777

paulvt opened this Issue Feb 14, 2017 · 4 comments


None yet

3 participants

paulvt commented Feb 14, 2017

SDL has experimental Wayland support since version 2.0.2 according to Wayland's wiki. I tried it out, but I only see the lower left corner of the game.

$ SDL_VIDEODRIVER=wayland openra
Platform is Linux
Using SDL 2 with OpenGL renderer
Desktop resolution: 3200x1800
No custom resolution provided, using desktop resolution
Using resolution: 3200x1800
Using window scale 1.00
OpenGL version: 3.0 Mesa 13.0.3
Using default sound device
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for 4294967295, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for 4294967295, skipping unlock
Available mods:
	cnc: Tiberian Dawn (release-20161019)
	d2k: Dune 2000 (release-20161019)
	modchooser: Mod Chooser (release-20161019)
	ra: Red Alert (release-20161019)
Loading mod: cnc

See also the attached screenshot.

screenshot from 2017-02-14 10-43-13

pchote commented Feb 14, 2017

Try removing SDL.SDL_WindowFlags.SDL_WINDOW_ALLOW_HIGHDPI from I expect that to fix the scaling, but leave you without HiDPI rendering.

paulvt commented Feb 15, 2017

Unfortunately, that doesn't change anything.

pchote commented Feb 17, 2017 edited

I set up a Fedora VM and dug around a bit, and as far as I can tell something between SDL, GTK, Wayland, and the GPU drivers is completely broken. I wasn't able to find much useful information about how to fix this.

  • Your specific problem above happens because SDL_GetCurrentDisplayMode reports native pixels but SDL_CreateWindow expects scaled points. Creating a window at the "desktop size" therefore gives you something twice as big in each dimension.
  • We would need to manually divide the native pixels by the scaling ratio (which we don't know) to get a properly sized window, but we can't because SDL_GetDisplayDPI doesn't work and SDL_GL_GetDrawableSize appears to be returning scaled points instead of native pixels (see below)
  • The SDL_WINDOW_ALLOW_HIGHDPI flag doesn't appear to work, so I guess we need to ping some native API to disable the window scaling and get access to the full resolution OpenGL surface.

Considering that (1) you have to explicitly override the SDL backend to trigger this, and (2) window borders and possibly other things break under wayland, i'm leaning towards a WONTFIX for the forseeable future.

paulvt commented Feb 19, 2017

Ok, well, I think the GTK/Wayland/GPU part seems fine otherwise the entire desktop wouldn't work so well. You are right that the SDL backend is still marked as experimental, so maybe issues are there that cannot be solved within OpenRA just yet. But considering (1), I assume that at some point SDL will auto-select the Wayland backend if it's stable enough and finds Wayland. However, it is safe to say thata Xwayland will stick around for a while, although then I will need the environment variable again and it is only one of two applications that still needs it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment