[PATCH] win32u: Set BAD_EDID registry value for empty EDID.

Paul Gofman pgofman at codeweavers.com
Wed Mar 2 10:02:43 CST 2022


Fixes a regression introduced by commit
548bc54bf396d74b5b928bf9be835272ddda1886.

Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
---
     Fixes regression in Vampyr and The Beast Inside games (which have broken window size if they find invalid EDID
     but are fine if EDID is absent or BAD_EDID is present).

     The effect of the blamed commit is that it started setting EDID registry field even if it is empty
     (which can be the case even if winex11/xrandr is used when running under XWayland). BAD_EDID registry
     field is not arbitrary, that's what Windows has if the display EDID is not available for some reason.

     I also have a patch which implements EDID manual generation in winex11/xrandr if the raw EDID is not
     available based on the available xrand data. I am not sure yet if that is the best thing to do or maybe
     it is better to implement that in win32u in a backend-agnostic way. While it is possible to pull some
     specific display synchonization data from xrandr it is not apparent that this data is needed or if XWayland
     actually provides us the real info there. In any case, I suppose it makes sense to revert this part to
     previous behaviour first.

 dlls/win32u/sysparams.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c
index cd4ff91255e..b981faef335 100644
--- a/dlls/win32u/sysparams.c
+++ b/dlls/win32u/sysparams.c
@@ -1120,8 +1120,13 @@ static void add_monitor( const struct gdi_monitor *monitor, void *param )
 
     if ((subkey = reg_create_key( hkey, device_parametersW, sizeof(device_parametersW), 0, NULL )))
     {
+        static const WCHAR bad_edidW[] = {'B','A','D','_','E','D','I','D',0};
         static const WCHAR edidW[] = {'E','D','I','D',0};
-        set_reg_value( subkey, edidW, REG_BINARY, monitor->edid, monitor->edid_len );
+
+        if (monitor->edid_len)
+            set_reg_value( subkey, edidW, REG_BINARY, monitor->edid, monitor->edid_len );
+        else
+            set_reg_value( subkey, bad_edidW, REG_BINARY, NULL, 0 );
         NtClose( subkey );
     }
 
@@ -1327,7 +1332,6 @@ static BOOL update_display_cache(void)
         ERR( "failed to read display config\n" );
         return FALSE;
     }
-
     return TRUE;
 }
 
-- 
2.35.1




More information about the wine-devel mailing list