Added patch to report the correct refresh rates for some NVIDIA cards.

This commit is contained in:
Erich E. Hoover 2015-03-06 12:48:40 -07:00
parent 9e39b598ad
commit def2378b7a
6 changed files with 283 additions and 1 deletions

View File

@ -38,7 +38,7 @@ Wine. All those differences are also documented on the
Included bug fixes and improvements
===================================
**Bugfixes and features included in the next upcoming release [17]:**
**Bugfixes and features included in the next upcoming release [18]:**
* Add stub for gdiplus.GdipCreateEffect ([Wine Bug #32163](https://bugs.winehq.org/show_bug.cgi?id=32163))
* Add support for CopyFileEx progress callback ([Wine Bug #22692](https://bugs.winehq.org/show_bug.cgi?id=22692))
@ -55,6 +55,7 @@ Included bug fixes and improvements
* Increase wineconsole commandline buffer size ([Wine Bug #34814](https://bugs.winehq.org/show_bug.cgi?id=34814))
* Process Hacker 2.x needs ntoskrnl.ProbeForRead ([Wine Bug #38103](https://bugs.winehq.org/show_bug.cgi?id=38103))
* Properly track handle count of wineserver objects
* Some NVIDIA cards report fake refresh rates ([Wine Bug #34348](https://bugs.winehq.org/show_bug.cgi?id=34348))
* Support for GetFinalPathNameByHandle ([Wine Bug #34851](https://bugs.winehq.org/show_bug.cgi?id=34851))
* Support for shell32 file operation progress dialog

1
debian/changelog vendored
View File

@ -4,6 +4,7 @@ wine-staging (1.7.38) UNRELEASED; urgency=low
* Long overdue update to the TransmitFile patches.
* Disabled patchset for reg.exe cleanup (partially accepted upstream).
* Disabled patchset for TransmitFile (rewrite in progress).
* Added patch to report the correct refresh rates for some NVIDIA cards.
* Added patch to mark DllCanUnloadNow and DllGetClassObject as private (by Amine Khaldi, wine-patched/pull/3).
* Added patch to skip Wine specific __wine_check_for_events calls in ReactOS (by Amine Khaldi, wine-patched/pull/4).
* Added patch to declare pDirectInputCreateEx in a MSVC compatible way (by Amine Khaldi, wine-patched/pull/5).

View File

@ -209,6 +209,7 @@ patch_enable_all ()
enable_winepulse_PulseAudio_Support="$1"
enable_winex11_CandidateWindowPos="$1"
enable_winex11_Clipboard_HTML="$1"
enable_winex11_Limited_Resolutions="$1"
enable_winex11_Thread_Data="$1"
enable_winex11_Window_Groups="$1"
enable_winex11_Window_Style="$1"
@ -669,6 +670,9 @@ patch_enable ()
winex11-Clipboard_HTML)
enable_winex11_Clipboard_HTML="$2"
;;
winex11-Limited_Resolutions)
enable_winex11_Limited_Resolutions="$2"
;;
winex11-Thread_Data)
enable_winex11_Thread_Data="$2"
;;
@ -4141,6 +4145,23 @@ if test "$enable_winex11_Clipboard_HTML" -eq 1; then
) >> "$patchlist"
fi
# Patchset winex11-Limited_Resolutions
# |
# | This patchset fixes the following Wine bugs:
# | * [#34348] Some NVIDIA cards report fake refresh rates
# |
# | Modified files:
# | * configure.ac, dlls/winex11.drv/xrandr.c
# |
if test "$enable_winex11_Limited_Resolutions" -eq 1; then
patch_apply winex11-Limited_Resolutions/0001-winex11-Display-a-helpful-warning-when-Dynamic-TwinV.patch
patch_apply winex11-Limited_Resolutions/0002-winex11-Return-the-actual-refresh-rate-for-NVIDIA-ca.patch
(
echo '+ { "Erich E. Hoover", "winex11: Display a helpful warning when Dynamic TwinView is enabled.", 1 },';
echo '+ { "Erich E. Hoover", "winex11: Return the actual refresh rate for NVIDIA cards with Dynamic TwinView enabled.", 1 },';
) >> "$patchlist"
fi
# Patchset winex11-Thread_Data
# |
# | This patchset fixes the following Wine bugs:

View File

@ -0,0 +1,105 @@
From 4fb6295c36aa1d6fea493bffde8a0390857be9fb Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
Date: Mon, 2 Mar 2015 23:18:10 -0700
Subject: winex11: Display a helpful warning when Dynamic TwinView is enabled.
---
configure.ac | 20 +++++++++++++++++++-
dlls/winex11.drv/xrandr.c | 22 ++++++++++++++++++++++
2 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index f242181..b898597 100644
--- a/configure.ac
+++ b/configure.ac
@@ -86,6 +86,8 @@ AC_ARG_WITH(xinput, AS_HELP_STRING([--without-xinput],[do not use the Xinput
AC_ARG_WITH(xinput2, AS_HELP_STRING([--without-xinput2],[do not use the Xinput 2 extension]),
[if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_XInput2_h=no; fi])
AC_ARG_WITH(xml, AS_HELP_STRING([--without-xml],[do not use XML]))
+AC_ARG_WITH(xnvctrl, AS_HELP_STRING([--without-xnvctrl],[do not use the NV-CONTROL extension]),
+ [if test "x$withval" = "xno"; then ac_cv_header_NVCtrl_NVCtrlLib_h=no; fi])
AC_ARG_WITH(xrandr, AS_HELP_STRING([--without-xrandr],[do not use Xrandr (resolution changes)]),
[if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xrandr_h=no; fi])
AC_ARG_WITH(xrender, AS_HELP_STRING([--without-xrender],[do not use the Xrender extension]),
@@ -1108,7 +1110,8 @@ then
X11/extensions/Xrandr.h \
X11/extensions/Xrender.h \
X11/extensions/xf86vmode.h \
- X11/extensions/xf86vmproto.h],,,
+ X11/extensions/xf86vmproto.h \
+ NVCtrl/NVCtrlLib.h],,,
[#ifdef HAVE_X11_XLIB_H
# include <X11/Xlib.h>
#endif
@@ -1225,6 +1228,21 @@ then
#include <X11/Xlib.h>
#endif])
+ dnl *** Check for NV-CONTROL extension
+ if test "$ac_cv_header_NVCtrl_NVCtrlLib_h" = "yes"
+ then
+ AC_MSG_CHECKING([for -lXNVCtrl])
+ ac_check_soname_save_LIBS=$LIBS
+ LIBS="-lXNVCtrl $X_LIBS $X_EXTRA_LIBS $LIBS"
+ AC_LINK_IFELSE([AC_LANG_CALL([], [XNVCTRLIsNvScreen])], [AC_MSG_RESULT([-lXNVCtrl])
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lXNVCtrl"
+ AC_DEFINE_UNQUOTED(HAVE_NVCTRL,1,[Define to 1 if libXNVCtrl is available])
+ ac_cv_lib_XNVCtrl=1], [AC_MSG_RESULT([not found])])
+ LIBS=$ac_check_soname_save_LIBS
+ fi
+ WINE_NOTICE_WITH(xnvctrl,[test "x$ac_cv_lib_XNVCtrl" = "x"],
+ [XNVCtrl ${notice_platform}development files not found, the NV-CONTROL extension won't be supported.])
+
dnl *** End of X11/Xlib.h check
dnl Check for the presence of OpenGL
diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c
index 58e66d6..e7fbf91 100644
--- a/dlls/winex11.drv/xrandr.c
+++ b/dlls/winex11.drv/xrandr.c
@@ -32,6 +32,9 @@ WINE_DECLARE_DEBUG_CHANNEL(winediag);
#include <X11/Xlib.h>
#include <X11/extensions/Xrandr.h>
+#ifdef HAVE_NVCTRL_NVCTRLLIB_H
+# include <NVCtrl/NVCtrlLib.h>
+#endif
#include "x11drv.h"
#include "wine/library.h"
@@ -192,6 +195,22 @@ static LONG xrandr10_set_current_mode( int mode )
return DISP_CHANGE_FAILED;
}
+static void xrandr10_nvidia_rate(void)
+{
+#ifdef HAVE_NVCTRL
+ int major, minor, twinview;
+
+ if (!XNVCTRLIsNvScreen( gdi_display, DefaultScreen(gdi_display) )) return;
+ if (!XNVCTRLQueryVersion( gdi_display, &major, &minor )) return;
+ if (!XNVCTRLQueryAttribute( gdi_display, DefaultScreen(gdi_display), 0,
+ NV_CTRL_DYNAMIC_TWINVIEW, &twinview )) return;
+ if (!twinview) return;
+
+ ERR_(winediag)("NVIDIA Dynamic TwinView detected, XRandR will report inaccurate refresh rates. "
+ "Please consider disabling the \"DynamicTwinView\" option in your X config.\n");
+#endif
+}
+
static void xrandr10_init_modes(void)
{
XRRScreenSize *sizes;
@@ -201,6 +220,9 @@ static void xrandr10_init_modes(void)
sizes = pXRRSizes( gdi_display, DefaultScreen(gdi_display), &sizes_count );
if (sizes_count <= 0) return;
+ /* Output a warning about nVidia Dynamic TwinView (if applicable) */
+ xrandr10_nvidia_rate();
+
TRACE("XRandR: found %d sizes.\n", sizes_count);
for (i = 0; i < sizes_count; ++i)
{
--
1.9.1

View File

@ -0,0 +1,153 @@
From 92b4fb41e72479b418046098aa67fb5d24ebdab7 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
Date: Tue, 3 Mar 2015 10:33:38 -0700
Subject: winex11: Return the actual refresh rate for NVIDIA cards with Dynamic
TwinView enabled.
---
dlls/winex11.drv/xrandr.c | 55 +++++++++++++++++++++++++++++++++++------------
1 file changed, 41 insertions(+), 14 deletions(-)
diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c
index e7fbf91..d073c67 100644
--- a/dlls/winex11.drv/xrandr.c
+++ b/dlls/winex11.drv/xrandr.c
@@ -68,8 +68,12 @@ static int primary_crtc;
#undef MAKE_FUNCPTR
+struct xrandr10_mode {
+ SizeID id;
+ short rate;
+};
static struct x11drv_mode_info *dd_modes;
-static SizeID *xrandr10_modes;
+static struct xrandr10_mode *xrandr10_modes;
static unsigned int xrandr_mode_count;
static int xrandr_current_mode = -1;
@@ -139,7 +143,7 @@ static int xrandr10_get_current_mode(void)
for (i = 0; i < xrandr_mode_count; ++i)
{
- if (xrandr10_modes[i] == size && dd_modes[i].refresh_rate == rate)
+ if (xrandr10_modes[i].id == size && xrandr10_modes[i].rate == rate)
{
res = i;
break;
@@ -174,8 +178,8 @@ static LONG xrandr10_set_current_mode( int mode )
dd_modes[mode].height,
dd_modes[mode].refresh_rate);
- size = xrandr10_modes[mode];
- rate = dd_modes[mode].refresh_rate;
+ size = xrandr10_modes[mode].id;
+ rate = xrandr10_modes[mode].rate;
if (rate)
stat = pXRRSetScreenConfigAndRate( gdi_display, sc, root, size, rot, rate, CurrentTime );
@@ -195,10 +199,10 @@ static LONG xrandr10_set_current_mode( int mode )
return DISP_CHANGE_FAILED;
}
-static void xrandr10_nvidia_rate(void)
+static void xrandr10_nvidia_rate(short *override_rate)
{
#ifdef HAVE_NVCTRL
- int major, minor, twinview;
+ int major, minor, twinview, mask, devices;
if (!XNVCTRLIsNvScreen( gdi_display, DefaultScreen(gdi_display) )) return;
if (!XNVCTRLQueryVersion( gdi_display, &major, &minor )) return;
@@ -206,6 +210,25 @@ static void xrandr10_nvidia_rate(void)
NV_CTRL_DYNAMIC_TWINVIEW, &twinview )) return;
if (!twinview) return;
+ if (!XNVCTRLQueryAttribute( gdi_display, DefaultScreen(gdi_display), 0,
+ NV_CTRL_CONNECTED_DISPLAYS, &devices)) goto failed;
+ for (mask = 1; mask < (1 << 24); mask <<= 1)
+ {
+ int refresh_rate;
+
+ if (!(devices & mask)) continue;
+
+ if (!XNVCTRLQueryAttribute( gdi_display, DefaultScreen(gdi_display), mask,
+ NV_CTRL_REFRESH_RATE, &refresh_rate)) goto failed;
+ *override_rate = (short) round(refresh_rate / 100.0f);
+ /* The first device gives us the true refresh rate of the primary display, use this to
+ * override the false refresh rate the driver reports to XRandR. */
+ return;
+ }
+ ERR_(winediag)("NVIDIA Dynamic TwinView detected, replacing inaccurate XRandR refresh rates "
+ "with the true rate of the primary display.\n");
+
+failed:
ERR_(winediag)("NVIDIA Dynamic TwinView detected, XRandR will report inaccurate refresh rates. "
"Please consider disabling the \"DynamicTwinView\" option in your X config.\n");
#endif
@@ -213,6 +236,7 @@ static void xrandr10_nvidia_rate(void)
static void xrandr10_init_modes(void)
{
+ short override_rate = 0;
XRRScreenSize *sizes;
int sizes_count;
int i, j, nmodes = 0;
@@ -221,7 +245,7 @@ static void xrandr10_init_modes(void)
if (sizes_count <= 0) return;
/* Output a warning about nVidia Dynamic TwinView (if applicable) */
- xrandr10_nvidia_rate();
+ xrandr10_nvidia_rate(&override_rate);
TRACE("XRandR: found %d sizes.\n", sizes_count);
for (i = 0; i < sizes_count; ++i)
@@ -230,15 +254,15 @@ static void xrandr10_init_modes(void)
short *rates;
rates = pXRRRates( gdi_display, DefaultScreen(gdi_display), i, &rates_count );
+ rates_count = (rates_count && override_rate ? 1 : rates_count);
TRACE("- at %d: %dx%d (%d rates):", i, sizes[i].width, sizes[i].height, rates_count);
if (rates_count)
{
nmodes += rates_count;
for (j = 0; j < rates_count; ++j)
{
- if (j > 0)
- TRACE(",");
- TRACE(" %d", rates[j]);
+ short rate = (override_rate ? override_rate : rates[j]);
+ TRACE("%s %d", (j > 0 ? "," : ""), rate);
}
}
else
@@ -269,19 +293,22 @@ static void xrandr10_init_modes(void)
short *rates;
rates = pXRRRates( gdi_display, DefaultScreen(gdi_display), i, &rates_count );
-
+ rates_count = (rates_count && override_rate ? 1 : rates_count);
if (rates_count)
{
for (j = 0; j < rates_count; ++j)
{
- X11DRV_Settings_AddOneMode( sizes[i].width, sizes[i].height, 0, rates[j] );
- xrandr10_modes[xrandr_mode_count++] = i;
+ short rate = (override_rate ? override_rate : rates[j]);
+ X11DRV_Settings_AddOneMode( sizes[i].width, sizes[i].height, 0, rate );
+ xrandr10_modes[xrandr_mode_count].id = i;
+ xrandr10_modes[xrandr_mode_count++].rate = rates[j];
}
}
else
{
X11DRV_Settings_AddOneMode( sizes[i].width, sizes[i].height, 0, 0 );
- xrandr10_modes[xrandr_mode_count++] = i;
+ xrandr10_modes[xrandr_mode_count].id = i;
+ xrandr10_modes[xrandr_mode_count++].rate = 0;
}
}
--
1.9.1

View File

@ -0,0 +1 @@
Fixes: [34348] Some NVIDIA cards report fake refresh rates