Zhiyi Zhang : winemac.drv: Allocate LUID for GPUs.

Alexandre Julliard julliard at winehq.org
Wed Apr 22 15:29:26 CDT 2020


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

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Tue Apr 21 20:12:43 2020 +0800

winemac.drv: Allocate LUID for GPUs.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Ken Thomases <ken at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winemac.drv/display.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/dlls/winemac.drv/display.c b/dlls/winemac.drv/display.c
index 4c610c4573..851d549d5f 100644
--- a/dlls/winemac.drv/display.c
+++ b/dlls/winemac.drv/display.c
@@ -51,6 +51,8 @@ struct display_mode_descriptor
 
 BOOL CDECL macdrv_EnumDisplaySettingsEx(LPCWSTR devname, DWORD mode, LPDEVMODEW devmode, DWORD flags);
 
+DEFINE_DEVPROPKEY(DEVPROPKEY_GPU_LUID, 0x60b193cb, 0x5276, 0x4d0f, 0x96, 0xfc, 0xf1, 0x73, 0xab, 0xad, 0x3e, 0xc6, 2);
+
 /* Wine specific monitor properties */
 DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_STATEFLAGS, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 2);
 DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_RCMONITOR, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 3);
@@ -1313,11 +1315,13 @@ static BOOL macdrv_init_gpu(HDEVINFO devinfo, const struct macdrv_gpu *gpu, int
     static const BOOL present = TRUE;
     SP_DEVINFO_DATA device_data = {sizeof(device_data)};
     WCHAR instanceW[MAX_PATH];
+    DEVPROPTYPE property_type;
     WCHAR nameW[MAX_PATH];
     WCHAR bufferW[1024];
     FILETIME filetime;
     HKEY hkey = NULL;
     GUID guid;
+    LUID luid;
     INT written;
     DWORD size;
     BOOL ret = FALSE;
@@ -1343,6 +1347,20 @@ static BOOL macdrv_init_gpu(HDEVINFO devinfo, const struct macdrv_gpu *gpu, int
                                    (const BYTE *)&present, sizeof(present), 0))
         goto done;
 
+    /* Write DEVPROPKEY_GPU_LUID property */
+    if (!SetupDiGetDevicePropertyW(devinfo, &device_data, &DEVPROPKEY_GPU_LUID, &property_type,
+                                   (BYTE *)&luid, sizeof(luid), NULL, 0))
+    {
+        if (!AllocateLocallyUniqueId(&luid))
+            goto done;
+
+        if (!SetupDiSetDevicePropertyW(devinfo, &device_data, &DEVPROPKEY_GPU_LUID,
+                                       DEVPROP_TYPE_UINT64, (const BYTE *)&luid, sizeof(luid), 0))
+            goto done;
+    }
+    TRACE("GPU id:0x%s name:%s LUID:%08x:%08x.\n", wine_dbgstr_longlong(gpu->id), gpu->name,
+          luid.HighPart, luid.LowPart);
+
     /* Open driver key.
      * This is where HKLM\System\CurrentControlSet\Control\Video\{GPU GUID}\{Adapter Index} links to */
     hkey = SetupDiCreateDevRegKeyW(devinfo, &device_data, DICS_FLAG_GLOBAL, 0, DIREG_DRV, NULL, NULL);




More information about the wine-cvs mailing list