summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Ashton <joshua@froggi.es>2022-05-12 11:16:13 +0000
committerOlivier Fourdan <fourdan@gmail.com>2022-05-18 13:04:21 +0000
commit7cdcdfea08ad9d63466286a6f94783cbf5fc3717 (patch)
tree730c45308a1d49026ee8ead4077626f11fb6601b
parent4119cd9ffaeb1d2ed554885668edd2b32d955256 (diff)
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>
-rw-r--r--hw/xwayland/man/Xwayland.man4
-rw-r--r--hw/xwayland/xwayland-output.c2
-rw-r--r--hw/xwayland/xwayland-screen.c3
-rw-r--r--hw/xwayland/xwayland-screen.h1
-rw-r--r--hw/xwayland/xwayland.c1
-rw-r--r--hw/xwayland/xwayland.pc.in1
6 files changed, 11 insertions, 1 deletions
diff --git a/hw/xwayland/man/Xwayland.man b/hw/xwayland/man/Xwayland.man
index 15eb7f5f4..2ceec9432 100644
--- a/hw/xwayland/man/Xwayland.man
+++ b/hw/xwayland/man/Xwayland.man
@@ -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
support touch input.
.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
Run \fIXwayland\fP rootless, so that X clients integrate seamlessly with
Wayland clients in a Wayland desktop. That requires the Wayland server
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index 927d97194..58764b7c3 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -355,7 +355,7 @@ output_get_rr_modes(struct xwl_output *xwl_output,
*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;
/* Add fake modes */
diff --git a/hw/xwayland/xwayland-screen.c b/hw/xwayland/xwayland-screen.c
index 5c8b388f0..d6e19282c 100644
--- a/hw/xwayland/xwayland-screen.c
+++ b/hw/xwayland/xwayland-screen.c
@@ -643,6 +643,9 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
ErrorF("xwayland glamor: this build does not have EGLStream support\n");
#endif
}
+ else if (strcmp(argv[i], "-force-xrandr-emulation") == 0) {
+ xwl_screen->force_xrandr_emulation = 1;
+ }
}
#ifdef XWL_HAS_GLAMOR
diff --git a/hw/xwayland/xwayland-screen.h b/hw/xwayland/xwayland-screen.h
index f04d431c7..f8aee2bdc 100644
--- a/hw/xwayland/xwayland-screen.h
+++ b/hw/xwayland/xwayland-screen.h
@@ -56,6 +56,7 @@ struct xwl_screen {
int rootless;
int glamor;
int present;
+ int force_xrandr_emulation;
CreateScreenResourcesProcPtr CreateScreenResources;
CloseScreenProcPtr CloseScreen;
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 603e8be4f..6cc5f8e0f 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -102,6 +102,7 @@ ddxUseMsg(void)
ErrorF("-verbose [n] verbose startup messages\n");
ErrorF("-version show the server version and exit\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;
diff --git a/hw/xwayland/xwayland.pc.in b/hw/xwayland/xwayland.pc.in
index 9d727b002..e2c06b801 100644
--- a/hw/xwayland/xwayland.pc.in
+++ b/hw/xwayland/xwayland.pc.in
@@ -12,3 +12,4 @@ have_listenfd=true
have_verbose=true
have_terminate_delay=true
have_no_touch_pointer_emulation=true
+have_force_xrandr_emulation=true