xwayland: Add -force-xrandr-emulation switch

Adds a -force-xrandr-emulation cmdline switch that always exposes extra
modes when viewporter isn't exposed by the Wayland compositor.

Having the additional modes exposed by the X server is important for
games to function and be configured

Compositors, such as Gamescope (the compositor for Steam Deck),
support only a single window that is rendered in the centre of the
screen that is scaled up to fill the screen by the compositor based
on some user scaling settings.

Exposing viewporter, wouldn't make sense here, and could mislead native
Wayland clients, so exposing dummy modesets in X is preferred here.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
This commit is contained in:
Joshua Ashton 2022-05-12 11:16:13 +00:00 committed by Olivier Fourdan
parent 4119cd9ffa
commit 7cdcdfea08
6 changed files with 11 additions and 1 deletions

View File

@ -71,6 +71,10 @@ Disable touch pointer emulation. This allows the Wayland compositor to
implement its own pointer emulation mechanism for X11 clients that don't implement its own pointer emulation mechanism for X11 clients that don't
support touch input. support touch input.
.TP 8 .TP 8
.B \-force-xrandr-emulation
Force additional non-native modes to be exposed when viewporter is not
supported by the Wayland compositor.
.TP 8
.B \-rootless .B \-rootless
Run \fIXwayland\fP rootless, so that X clients integrate seamlessly with Run \fIXwayland\fP rootless, so that X clients integrate seamlessly with
Wayland clients in a Wayland desktop. That requires the Wayland server Wayland clients in a Wayland desktop. That requires the Wayland server

View File

@ -355,7 +355,7 @@ output_get_rr_modes(struct xwl_output *xwl_output,
*count = 1; *count = 1;
if (!xwl_screen_has_resolution_change_emulation(xwl_screen)) if (!xwl_screen_has_resolution_change_emulation(xwl_screen) && !xwl_screen->force_xrandr_emulation)
return rr_modes; return rr_modes;
/* Add fake modes */ /* Add fake modes */

View File

@ -643,6 +643,9 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
ErrorF("xwayland glamor: this build does not have EGLStream support\n"); ErrorF("xwayland glamor: this build does not have EGLStream support\n");
#endif #endif
} }
else if (strcmp(argv[i], "-force-xrandr-emulation") == 0) {
xwl_screen->force_xrandr_emulation = 1;
}
} }
#ifdef XWL_HAS_GLAMOR #ifdef XWL_HAS_GLAMOR

View File

@ -56,6 +56,7 @@ struct xwl_screen {
int rootless; int rootless;
int glamor; int glamor;
int present; int present;
int force_xrandr_emulation;
CreateScreenResourcesProcPtr CreateScreenResources; CreateScreenResourcesProcPtr CreateScreenResources;
CloseScreenProcPtr CloseScreen; CloseScreenProcPtr CloseScreen;

View File

@ -102,6 +102,7 @@ ddxUseMsg(void)
ErrorF("-verbose [n] verbose startup messages\n"); ErrorF("-verbose [n] verbose startup messages\n");
ErrorF("-version show the server version and exit\n"); ErrorF("-version show the server version and exit\n");
ErrorF("-noTouchPointerEmulation disable touch pointer emulation\n"); ErrorF("-noTouchPointerEmulation disable touch pointer emulation\n");
ErrorF("-force-xrandr-emulation force non-native modes to be exposed when viewporter is not exposed by the compositor\n");
} }
static int init_fd = -1; static int init_fd = -1;

View File

@ -12,3 +12,4 @@ have_listenfd=true
have_verbose=true have_verbose=true
have_terminate_delay=true have_terminate_delay=true
have_no_touch_pointer_emulation=true have_no_touch_pointer_emulation=true
have_force_xrandr_emulation=true