[PATCH 1/2] ddraw/tests: Treat refresh rates with 1 hz difference as equal.

Stefan Dösinger stefan at codeweavers.com
Wed Jan 26 02:52:25 CST 2022


Signed-off-by: Stefan Dösinger <stefan at codeweavers.com>

---

This fixes test failures on Win7, Geforce 9600.

The MS doc I am referring to is https://support.microsoft.com/en-us/topic/screen-refresh-rate-in-windows-does-not-apply-the-user-selected-settings-on-monitors-tvs-that-report-specific-tv-compatible-timings-0a7a6a38-6c6a-2aec-debc-5183a76b9e1d.
---
 dlls/ddraw/tests/ddraw2.c |  3 ++-
 dlls/ddraw/tests/ddraw4.c |  3 ++-
 dlls/ddraw/tests/ddraw7.c | 11 ++++++++++-
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index 00c8f820edb..8a6c4b41ac1 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -15114,8 +15114,9 @@ static HRESULT CALLBACK find_different_mode_callback(DDSURFACEDESC *surface_desc
     if (U1(U4(*surface_desc).ddpfPixelFormat).dwRGBBitCount != registry_mode.dmBitsPerPel)
         return DDENUMRET_OK;
 
+    /* See comment in ddraw7 about the frequency. */
     if (surface_desc->dwWidth != param->old_width && surface_desc->dwHeight != param->old_height &&
-            surface_desc->dwRefreshRate != param->old_frequency)
+            !compare_uint(surface_desc->dwRefreshRate, param->old_frequency, 1))
     {
         param->new_width = surface_desc->dwWidth;
         param->new_height = surface_desc->dwHeight;
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index a8b68b8a20b..c229ab66341 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -18151,8 +18151,9 @@ static HRESULT CALLBACK find_different_mode_callback(DDSURFACEDESC2 *surface_des
     if (U1(U4(*surface_desc).ddpfPixelFormat).dwRGBBitCount != registry_mode.dmBitsPerPel)
         return DDENUMRET_OK;
 
+    /* See comment in ddraw7 about the frequency. */
     if (surface_desc->dwWidth != param->old_width && surface_desc->dwHeight != param->old_height &&
-            surface_desc->dwRefreshRate != param->old_frequency)
+            !compare_uint(surface_desc->dwRefreshRate, param->old_frequency, 1))
     {
         param->new_width = surface_desc->dwWidth;
         param->new_height = surface_desc->dwHeight;
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index f4388296702..18ebf849391 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -18417,8 +18417,17 @@ static HRESULT CALLBACK find_different_mode_callback(DDSURFACEDESC2 *surface_des
     if (U1(U4(*surface_desc).ddpfPixelFormat).dwRGBBitCount != registry_mode.dmBitsPerPel)
         return DDENUMRET_OK;
 
+    /* Windows will advertise 59hz (for 59.94) and 60hz (for proper 60hz) on monitors that support
+     * only one of the two (usually 59.94). If an application requests 60hz windows will apply 59.94.
+     * Thus if we think we found a different refresh rate, we get 59hz instead of the 60hz we
+     * requested.
+     *
+     * The same is true of other 1% slowed-down TV compatible refresh rates according to a Microsoft
+     * support document: 23.976 vs 24, 30, 48, 72 and 120 hz. It can be reproduced by attempting to
+     * set 60hz in the advanced display properties manually. Usually the restriction to one refresh
+     * rate applies to laptop panels. */
     if (surface_desc->dwWidth != param->old_width && surface_desc->dwHeight != param->old_height &&
-            surface_desc->dwRefreshRate != param->old_frequency)
+            !compare_uint(surface_desc->dwRefreshRate, param->old_frequency, 1))
     {
         param->new_width = surface_desc->dwWidth;
         param->new_height = surface_desc->dwHeight;
-- 
2.34.1




More information about the wine-devel mailing list