mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-01-06 02:40:14 +01:00
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@redhat.com>
(cherry picked from commit e2e5842444)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
This commit is contained in:
parent
05a3a4068b
commit
fa70fdf961
1 changed files with 12 additions and 3 deletions
|
|
@ -402,9 +402,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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue