wlserver: create wl_output before starting Xwayland

Apparently there's a race that makes Steam unhappy and fail with:

   libGL error: failed to create drawable

Closes: https://github.com/Plagman/gamescope/issues/228
This commit is contained in:
Simon Ser 2021-08-02 18:13:55 +02:00
parent 6e1d4c2a7e
commit 0034d492d8

View file

@ -603,13 +603,6 @@ int wlserver_init(int argc, char **argv, bool bIsNested) {
create_gamescope_xwayland(); create_gamescope_xwayland();
struct wlr_xwayland_server_options xwayland_options = {
.lazy = false,
.enable_wm = false,
};
wlserver.wlr.xwayland_server = wlr_xwayland_server_create(wlserver.display, &xwayland_options);
wl_signal_add(&wlserver.wlr.xwayland_server->events.ready, &xwayland_ready_listener);
int result = -1; int result = -1;
int display_slot = 0; int display_slot = 0;
@ -640,6 +633,19 @@ int wlserver_init(int argc, char **argv, bool bIsNested) {
return 1; return 1;
} }
wlr_output_enable( wlserver.wlr.output, true );
wlr_output_set_custom_mode( wlserver.wlr.output, g_nNestedWidth, g_nNestedHeight, g_nOutputRefresh * 1000 );
wlr_output_commit( wlserver.wlr.output );
wlr_output_create_global( wlserver.wlr.output );
struct wlr_xwayland_server_options xwayland_options = {
.lazy = false,
.enable_wm = false,
};
wlserver.wlr.xwayland_server = wlr_xwayland_server_create(wlserver.display, &xwayland_options);
wl_signal_add(&wlserver.wlr.xwayland_server->events.ready, &xwayland_ready_listener);
while (!bXwaylandReady) { while (!bXwaylandReady) {
wl_display_flush_clients(wlserver.display); wl_display_flush_clients(wlserver.display);
if (wl_event_loop_dispatch(wlserver.event_loop, -1) < 0) { if (wl_event_loop_dispatch(wlserver.event_loop, -1) < 0) {
@ -655,12 +661,6 @@ int wlserver_init(int argc, char **argv, bool bIsNested) {
return 1; return 1;
} }
wlr_output_enable( wlserver.wlr.output, true );
wlr_output_set_custom_mode( wlserver.wlr.output, g_nNestedWidth, g_nNestedHeight, g_nOutputRefresh * 1000 );
wlr_output_commit( wlserver.wlr.output );
wlr_output_create_global( wlserver.wlr.output );
return 0; return 0;
} }