Erich E. Hoover : winex11.drv: Update the check for broken nVidia RandR to test for the number of resolutions instead of the number of modes.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jan 22 15:20:46 CST 2015


Module: wine
Branch: master
Commit: 8e9e4a657f29ff018c6296ced1f115ca8731e5e6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8e9e4a657f29ff018c6296ced1f115ca8731e5e6

Author: Erich E. Hoover <erich.e.hoover at gmail.com>
Date:   Sat Aug  9 13:15:09 2014 -0600

winex11.drv: Update the check for broken nVidia RandR to test for the number of resolutions instead of the number of modes.

---

 dlls/winex11.drv/xrandr.c | 42 +++++++++++++++++++++++++++---------------
 1 file changed, 27 insertions(+), 15 deletions(-)

diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c
index fc09020..e9670c3 100644
--- a/dlls/winex11.drv/xrandr.c
+++ b/dlls/winex11.drv/xrandr.c
@@ -386,6 +386,7 @@ static XRRCrtcInfo *xrandr12_get_primary_crtc_info( XRRScreenResources *resource
 
 static int xrandr12_init_modes(void)
 {
+    unsigned int only_one_resolution = 1, mode_count;
     XRRScreenResources *resources;
     XRROutputInfo *output_info;
     XRRCrtcInfo *crtc_info;
@@ -434,21 +435,6 @@ static int xrandr12_init_modes(void)
         goto done;
     }
 
-    /* Recent (304.64, possibly earlier) versions of the nvidia driver only
-     * report a DFP's native mode through RandR 1.2 / 1.3. Standard DMT modes
-     * are only listed through RandR 1.0 / 1.1. This is completely useless,
-     * but NVIDIA considers this a feature, so it's unlikely to change. The
-     * best we can do is to fall back to RandR 1.0 and encourage users to
-     * consider more cooperative driver vendors when we detect such a
-     * configuration. */
-    if (output_info->nmode == 1 && XQueryExtension( gdi_display, "NV-CONTROL", &i, &j, &ret ))
-    {
-        ERR_(winediag)("Broken NVIDIA RandR detected, falling back to RandR 1.0. "
-                       "Please consider using the Nouveau driver instead.\n");
-        ret = -1;
-        goto done;
-    }
-
     if (!(xrandr12_modes = HeapAlloc( GetProcessHeap(), 0, sizeof(*xrandr12_modes) * output_info->nmode )))
     {
         ERR("Failed to allocate xrandr mode info array.\n");
@@ -480,6 +466,32 @@ static int xrandr12_init_modes(void)
         }
     }
 
+    mode_count = X11DRV_Settings_GetModeCount();
+    for (i = 1; i < mode_count; ++i)
+    {
+        if (dd_modes[i].width != dd_modes[0].width || dd_modes[i].height != dd_modes[0].height)
+        {
+            only_one_resolution = 0;
+            break;
+        }
+    }
+
+    /* Recent (304.64, possibly earlier) versions of the nvidia driver only
+     * report a DFP's native mode through RandR 1.2 / 1.3. Standard DMT modes
+     * are only listed through RandR 1.0 / 1.1. This is completely useless,
+     * but NVIDIA considers this a feature, so it's unlikely to change. The
+     * best we can do is to fall back to RandR 1.0 and encourage users to
+     * consider more cooperative driver vendors when we detect such a
+     * configuration. */
+    if (only_one_resolution && XQueryExtension( gdi_display, "NV-CONTROL", &i, &j, &ret ))
+    {
+        ERR_(winediag)("Broken NVIDIA RandR detected, falling back to RandR 1.0. "
+                       "Please consider using the Nouveau driver instead.\n");
+        ret = -1;
+        HeapFree( GetProcessHeap(), 0, xrandr12_modes );
+        goto done;
+    }
+
     X11DRV_Settings_AddDepthModes();
     ret = 0;
 




More information about the wine-cvs mailing list