winemac.drv: Set GPU LUID property for monitors.

Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Brendan Shanks 2020-05-28 18:09:40 +08:00 committed by Alexandre Julliard
parent 707fcb99a6
commit c36e26f41d
1 changed files with 14 additions and 5 deletions

View File

@ -52,6 +52,7 @@ 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);
DEFINE_DEVPROPKEY(DEVPROPKEY_MONITOR_GPU_LUID, 0xca085853, 0x16ce, 0x48aa, 0xb1, 0x14, 0xde, 0x9c, 0x72, 0x33, 0x42, 0x23, 1);
/* Wine specific monitor properties */
DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_STATEFLAGS, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 2);
@ -1361,12 +1362,13 @@ void macdrv_displays_changed(const macdrv_event *event)
/***********************************************************************
* macdrv_init_gpu
*
* Initialize a GPU instance and return its GUID string in guid_string and driver value in driver parameter.
* Initialize a GPU instance.
* Return its GUID string in guid_string, driver value in driver parameter and LUID in gpu_luid.
*
* Return FALSE on failure and TRUE on success.
*/
static BOOL macdrv_init_gpu(HDEVINFO devinfo, const struct macdrv_gpu *gpu, int gpu_index, WCHAR *guid_string,
WCHAR *driver)
WCHAR *driver, LUID *gpu_luid)
{
static const BOOL present = TRUE;
SP_DEVINFO_DATA device_data = {sizeof(device_data)};
@ -1414,6 +1416,7 @@ static BOOL macdrv_init_gpu(HDEVINFO devinfo, const struct macdrv_gpu *gpu, int
DEVPROP_TYPE_UINT64, (const BYTE *)&luid, sizeof(luid), 0))
goto done;
}
*gpu_luid = luid;
TRACE("GPU id:0x%s name:%s LUID:%08x:%08x.\n", wine_dbgstr_longlong(gpu->id), gpu->name,
luid.HighPart, luid.LowPart);
@ -1541,7 +1544,7 @@ done:
* Return FALSE on failure and TRUE on success.
*/
static BOOL macdrv_init_monitor(HDEVINFO devinfo, const struct macdrv_monitor *monitor, int monitor_index,
int video_index)
int video_index, const LUID *gpu_luid)
{
SP_DEVINFO_DATA device_data = {sizeof(SP_DEVINFO_DATA)};
WCHAR nameW[MAX_PATH];
@ -1562,6 +1565,11 @@ static BOOL macdrv_init_monitor(HDEVINFO devinfo, const struct macdrv_monitor *m
(const BYTE *)monitor_hardware_idW, sizeof(monitor_hardware_idW)))
goto done;
/* Write DEVPROPKEY_MONITOR_GPU_LUID */
if (!SetupDiSetDevicePropertyW(devinfo, &device_data, &DEVPROPKEY_MONITOR_GPU_LUID,
DEVPROP_TYPE_INT64, (const BYTE *)gpu_luid, sizeof(*gpu_luid), 0))
goto done;
/* Create driver key */
hkey = SetupDiCreateDevRegKeyW(devinfo, &device_data, DICS_FLAG_GLOBAL, 0, DIREG_DRV, NULL, NULL);
RegCloseKey(hkey);
@ -1670,6 +1678,7 @@ void macdrv_init_display_devices(BOOL force)
DWORD disposition = 0;
WCHAR guidW[40];
WCHAR driverW[1024];
LUID gpu_luid;
mutex = CreateMutexW(NULL, FALSE, init_mutexW);
WaitForSingleObject(mutex, INFINITE);
@ -1699,7 +1708,7 @@ void macdrv_init_display_devices(BOOL force)
for (gpu = 0; gpu < gpu_count; gpu++)
{
if (!macdrv_init_gpu(gpu_devinfo, &gpus[gpu], gpu, guidW, driverW))
if (!macdrv_init_gpu(gpu_devinfo, &gpus[gpu], gpu, guidW, driverW, &gpu_luid))
goto done;
/* Initialize adapters */
@ -1721,7 +1730,7 @@ void macdrv_init_display_devices(BOOL force)
for (monitor = 0; monitor < monitor_count; monitor++)
{
TRACE("monitor: %#x %s\n", monitor, monitors[monitor].name);
if (!macdrv_init_monitor(monitor_devinfo, &monitors[monitor], monitor, video_index))
if (!macdrv_init_monitor(monitor_devinfo, &monitors[monitor], monitor, video_index, &gpu_luid))
goto done;
}