winex11.drv: Allocate LUID for GPUs.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2020-04-21 20:12:30 +08:00 committed by Alexandre Julliard
parent c2e3c8ec93
commit de94f8a1d6
1 changed files with 18 additions and 0 deletions

View File

@ -39,6 +39,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(x11drv); WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
DEFINE_DEVPROPKEY(DEVPROPKEY_GPU_LUID, 0x60b193cb, 0x5276, 0x4d0f, 0x96, 0xfc, 0xf1, 0x73, 0xab, 0xad, 0x3e, 0xc6, 2);
/* Wine specific monitor properties */ /* 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_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); DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_RCMONITOR, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 3);
@ -278,9 +280,11 @@ static BOOL X11DRV_InitGpu(HDEVINFO devinfo, const struct x11drv_gpu *gpu, INT g
static const BOOL present = TRUE; static const BOOL present = TRUE;
SP_DEVINFO_DATA device_data = {sizeof(device_data)}; SP_DEVINFO_DATA device_data = {sizeof(device_data)};
WCHAR instanceW[MAX_PATH]; WCHAR instanceW[MAX_PATH];
DEVPROPTYPE property_type;
WCHAR bufferW[1024]; WCHAR bufferW[1024];
HKEY hkey = NULL; HKEY hkey = NULL;
GUID guid; GUID guid;
LUID luid;
INT written; INT written;
DWORD size; DWORD size;
BOOL ret = FALSE; BOOL ret = FALSE;
@ -306,6 +310,20 @@ static BOOL X11DRV_InitGpu(HDEVINFO devinfo, const struct x11drv_gpu *gpu, INT g
(const BYTE *)&present, sizeof(present), 0)) (const BYTE *)&present, sizeof(present), 0))
goto done; 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),
wine_dbgstr_w(gpu->name), luid.HighPart, luid.LowPart);
/* Open driver key. /* Open driver key.
* This is where HKLM\System\CurrentControlSet\Control\Video\{GPU GUID}\{Adapter Index} links to */ * 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); hkey = SetupDiCreateDevRegKeyW(devinfo, &device_data, DICS_FLAG_GLOBAL, 0, DIREG_DRV, NULL, NULL);