Hi
I believe there is a regression in libsdl 2.0.4 (ish), possibly due to the
recent changes to SDL_x11modes.
I’ve recently noticed steam (the game platform from Valve) does not want to
switch into “big picture mode” on my setup. It’s a Ubuntu Wily box but most
notably I only ever access it over remote desktop (specifically, chrome remote
desktop). As such, most of the time there is no display connected and X runs in
"headless" mode (no connected xrandr outputs).
Isolating the failure to ~minimal broken example:
#include<stdlib.h>
#include<SDL2/SDL_video.h>
#include<SDL2/SDL_error.h>
int main(int argc, char **argv) {
SDL_Window *w;
// The SDL_CreateWindow call Steam client is attempting.
w = SDL_CreateWindow(
“Steam”, SDL_WINDOWPOS_UNDEFINED_MASK, SDL_WINDOWPOS_UNDEFINED_MASK,
1365, 768, SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_OPENGL |
SDL_WINDOW_BORDERLESS);
if (w == NULL) {
printf(“SDL_CreateWindow: %s\n”, SDL_GetError());
}
return 0;
}
This code fails with libsdl 2.0.4 (in this case with the upcoming Ubuntu
package, but I also tried with mercurial head):
$ LD_PRELOAD=libsdl2-2.0.4+dfsg1/build/.libs/libSDL2-2.0.so.0 DISPLAY=:20 ./sdl
SDL_CreateWindow: No available displays
$
But works with libsdl 2.0.0 in Ubuntu Wily:
$ dpkg -l libsdl2-2.0-0
libsdl2-2.0-0:amd64
$ DISPLAY=:20 ./sdl
$
For reference, xrandr output:
$ DISPLAY=:20 xrandr
Screen 0: minimum 8 x 8, current 1366 x 768, maximum 32767 x 32767
DP1 disconnected (normal left inverted right x axis y axis)
Chrome Remote Desktop client resolution 0.00
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
I have not yet taken a stab at fixing this, just reporting observations. I could
probably come up with a patch that makes this work locally but I’d really need
help with figuring out how to do this so as to not break other use cases - the
logic is not obvious to a bystander.
Currently it looks like all screens and outputs are tried twice - first to find
a working primary output if one exists and then to add all non-primary outputs.
Would it make sense to do something like add all the screens as the last pass?
Or is it cool to add a hack specifically for chrome remote desktop? Presumably
other people might be running similar configurations with vnc and the likes as
well so that does not sound optimal.
Siim