win32u: Store GPU luid in adapters cache.

This commit is contained in:
Paul Gofman 2022-10-24 17:04:05 -05:00 committed by Alexandre Julliard
parent 93ba92def7
commit 62f66c3da5

View file

@ -211,6 +211,7 @@ struct adapter
LONG refcount;
struct list entry;
struct display_device dev;
LUID gpu_luid;
unsigned int id;
const WCHAR *config_key;
unsigned int mode_count;
@ -565,6 +566,17 @@ static int mode_compare(const void *p1, const void *p2)
return 0;
}
static unsigned int query_reg_subkey_value( HKEY hkey, const WCHAR *name, unsigned int name_size,
KEY_VALUE_PARTIAL_INFORMATION *value, unsigned int size )
{
HKEY subkey;
if (!(subkey = reg_open_key( hkey, name, name_size ))) return 0;
size = query_reg_value( subkey, NULL, value, size );
NtClose( subkey );
return size;
}
static BOOL read_display_adapter_settings( unsigned int index, struct adapter *info )
{
char buffer[4096];
@ -637,6 +649,14 @@ static BOOL read_display_adapter_settings( unsigned int index, struct adapter *i
if (!(hkey = reg_open_key( enum_key, value_str, value->DataLength - sizeof(WCHAR) )))
return FALSE;
size = query_reg_subkey_value( hkey, devpropkey_gpu_luidW, sizeof(devpropkey_gpu_luidW), value, sizeof(buffer) );
if (size != sizeof(info->gpu_luid))
{
NtClose( hkey );
return FALSE;
}
memcpy( &info->gpu_luid, value->Data, sizeof(info->gpu_luid) );
size = query_reg_value( hkey, hardware_idW, value, sizeof(buffer) );
NtClose( hkey );
if (!size || (value->Type != REG_SZ && value->Type != REG_MULTI_SZ))
@ -646,17 +666,6 @@ static BOOL read_display_adapter_settings( unsigned int index, struct adapter *i
return TRUE;
}
static unsigned int query_reg_subkey_value( HKEY hkey, const WCHAR *name, unsigned int name_size,
KEY_VALUE_PARTIAL_INFORMATION *value, unsigned int size )
{
HKEY subkey;
if (!(subkey = reg_open_key( hkey, name, name_size ))) return 0;
size = query_reg_value( subkey, NULL, value, size );
NtClose( subkey );
return size;
}
static BOOL read_monitor_settings( struct adapter *adapter, DWORD index, struct monitor *monitor )
{
char buffer[4096];