Stefan Dösinger : ddraw/tests: Treat refresh rates with 1 hz difference as equal.

Alexandre Julliard julliard at winehq.org
Wed Jan 26 15:57:32 CST 2022


Module: wine
Branch: master
Commit: dc79534a6d2c6e1e73194ff4ab5f7f34a4363ff7
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=dc79534a6d2c6e1e73194ff4ab5f7f34a4363ff7

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Wed Jan 26 11:52:25 2022 +0300

ddraw/tests: Treat refresh rates with 1 hz difference as equal.

Signed-off-by: Stefan Dösinger <stefan at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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;




More information about the wine-cvs mailing list