xserver: Branch 'master'
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Aug 14 15:00:57 UTC 2024
hw/xwayland/xwayland-output.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
New commits:
commit e2e5842444c20ab57cfc74cf0c0cdeb021afbc8a
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Thu Aug 8 10:07:27 2024 +0200
xwayland: Report correct mode size when rootful
The vidmode extension emulation in Xwayland reports the modeline based
on the current mode.
To do so, it searches for the mode using `xwl_output_find_mode(-1, -1)`
which is supposed to return the current mode, whatever that mode is.
With XRandR emulation, in rootless mode, the default value is the mode
at index 0. That assumption, however is not true when running rootful.
That means that the vidmode extension will always return the highest
mode available, which is 5120x2880, with Xwayland running rootful:
$ xwayland-run -geometry 1024x768 -- xvidtune -show
"5120x2880" 1276.50 5120 5560 6128 7136 2880 2883 2888 2982 -hsync +vsync
Luckily, when Xwayland is running rootful, we have the current mode size
conveniently stored in dedicated fields of the xwayland output struct,
so we can use that to search for the right mode being used and report
that through the vidmode extension:
$ xwayland-run -geometry 1024x768 -- xvidtune -show
"1024x768" 63.50 1024 1064 1176 1328 768 771 775 798 -hsync +vsync
That fixes legacy games using the vidmode extension and rendering at the
wrong size when running within Xwayland rootful.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1641>
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index 42569f73d..e77cc4305 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -404,9 +404,18 @@ xwl_output_find_mode(struct xwl_output *xwl_output,
RROutputPtr output = xwl_output->randr_output;
int i;
- /* width & height -1 means we want the actual output mode, which is idx 0 */
- if (width == -1 && height == -1 && output->modes)
- return output->modes[0];
+ /* width & height -1 means we want the actual output mode */
+ if (width == -1 && height == -1) {
+ if (xwl_output->mode_width > 0 && xwl_output->mode_height > 0) {
+ /* If running rootful, use the current mode size to search for the mode */
+ width = xwl_output->mode_width;
+ height = xwl_output->mode_height;
+ }
+ else if (output->modes) {
+ /* else return the mode at first idx 0 */
+ return output->modes[0];
+ }
+ }
for (i = 0; i < output->numModes; i++) {
if (output->modes[i]->mode.width == width && output->modes[i]->mode.height == height)
More information about the xorg-commit
mailing list