[Bug 34348] Wine xrandr12 failure

wine-bugs at winehq.org wine-bugs at winehq.org
Sat Feb 7 03:49:46 CST 2015


https://bugs.winehq.org/show_bug.cgi?id=34348

--- Comment #22 from Sebastian Lackner <sebastian at fds-team.de> ---
Thanks to Adam Bolte for providing a download link to the demo of Overlord 2,
which can be used to reproduce this problem:
http://www.fileplanet.com/200489/200000/fileinfo/Overlord-2-Demo

More affected games are mentioned in
* https://bugs.winehq.org/show_bug.cgi?id=37966
* https://bugs.winehq.org/show_bug.cgi?id=11558 (<- the same issue was
mentioned there in 2010!)

It works fine with xrandr 1.2, but crashes with xrandr 1.0. For those that
normally have a working xrandr 1.2 setup, you can also reproduce the failure by
changing the Wine source, and manually setting only_one_resolution = 1 in
dlls/winex11.drv/xrandr.c.

Output from my system:
--- snip ---
trace:xrandr:xrandr12_init_modes Adding mode 0x27f: 1920x1080 at 60.
trace:xrandr:xrandr12_init_modes Adding mode 0x280: 1680x1050 at 60.
trace:xrandr:xrandr12_init_modes Adding mode 0x281: 1440x900 at 75.
trace:xrandr:xrandr12_init_modes Adding mode 0x282: 1440x900 at 60.
trace:xrandr:xrandr12_init_modes Adding mode 0x283: 1280x1024 at 75.
trace:xrandr:xrandr12_init_modes Adding mode 0x284: 1280x1024 at 60.
trace:xrandr:xrandr12_init_modes Adding mode 0x285: 1024x768 at 75.
trace:xrandr:xrandr12_init_modes Adding mode 0x286: 1024x768 at 60.
trace:xrandr:xrandr12_init_modes Adding mode 0x287: 800x600 at 75.
trace:xrandr:xrandr12_init_modes Adding mode 0x288: 800x600 at 60.
trace:xrandr:xrandr12_init_modes Adding mode 0x289: 640x480 at 75.
trace:xrandr:xrandr12_init_modes Adding mode 0x28a: 640x480 at 73.
trace:xrandr:xrandr12_init_modes Adding mode 0x28b: 640x480 at 60.
err:winediag:xrandr12_init_modes Broken NVIDIA RandR detected, falling back to
RandR 1.0. Please consider using the Nouveau driver instead.
trace:xrandr:xrandr10_init_modes XRandR: found 10 sizes.
trace:xrandr:xrandr10_init_modes - at 0: 1920x1080 (1 rates):  50 Hz
trace:xrandr:xrandr10_init_modes - at 1: 1680x1050 (1 rates):  51 Hz
trace:xrandr:xrandr10_init_modes - at 2: 1440x900 (2 rates):  52,  53 Hz
trace:xrandr:xrandr10_init_modes - at 3: 1280x1024 (2 rates):  54,  55 Hz
trace:xrandr:xrandr10_init_modes - at 4: 1024x768 (2 rates):  56,  57 Hz
trace:xrandr:xrandr10_init_modes - at 5: 800x600 (2 rates):  58,  59 Hz
trace:xrandr:xrandr10_init_modes - at 6: 640x480 (3 rates):  60,  61,  62 Hz
trace:xrandr:xrandr10_init_modes - at 7: 1366x768 (1 rates):  63 Hz
trace:xrandr:xrandr10_init_modes - at 8: 1280x800 (1 rates):  64 Hz
trace:xrandr:xrandr10_init_modes - at 9: 1280x720 (1 rates):  65 Hz
--- snip ---

As you can easily see the resolution of the modes do not match. After some
searching I found the reason, its a pretty stupid idea from NVIDIA:
http://http.download.nvidia.com/XFree86/Linux-x86/1.0-9625/README/chapter-04.html

--- quote ---
Why is the refresh rate not reported correctly by utilities that use the XRandR
X extension (e.g., the GNOME "Screen Resolution Preferences" panel, `xrandr
-q`, etc)?

The XRandR X extension is not presently aware of multiple display devices on a
single X screen; it only sees the MetaMode bounding box, which may contain one
or more actual modes. This means that if multiple MetaModes have the same
bounding box, XRandR will not be able to distinguish between them.

In order to support DynamicTwinView, the NVIDIA X driver must make each
MetaMode appear to be unique to XRandR. Presently, the NVIDIA X driver
accomplishes this by using the refresh rate as a unique identifier.

You can use `nvidia-settings -q RefreshRate` to query the actual refresh rate
on each display device.

This behavior can be disabled by setting the X configuration option
"DynamicTwinView" to FALSE.
--- quote ---

When using an NVIDIA driver (without DynamicTwinView manually disabled), the
refresh rates which are passed to the application are not really refresh rates.
They are just unique identifiers, and this is what breaks (at least) Overlord
2. Returning fake refresh rates solves it:

--- snip ---
diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c
index 58e66d6..8d8528c 100644
--- a/dlls/winex11.drv/xrandr.c
+++ b/dlls/winex11.drv/xrandr.c
@@ -252,6 +252,7 @@ static void xrandr10_init_modes(void)
         {
             for (j = 0; j < rates_count; ++j)
             {
+                rates[j] = 60; /* HACK */
                 X11DRV_Settings_AddOneMode( sizes[i].width, sizes[i].height,
0, rates[j] );
                 xrandr10_modes[xrandr_mode_count++] = i;
             }
--- snip ---

I would guess that the easiest workaround for this bug is to disable
DynamicTwinView. I'll check if there is a better solution to solve this,
because its of course a bit unfortunate that it doesn't work out of the box.
I'll attach a patch if I can come up with some good idea.

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list