Diablo IV (closed beta) depends on DEVPKEY_Device_MatchingDeviceId being present for GPUs (once it is able to match GPU luid to the one obtained from dxgi). It also depends on the MatchingDeviceId conating "ven_" and "dev_" substrings. Without those it doesn't consider the gpu as valid, which currently results in the game complaining about no GPUs found. I guess that maybe it is trying to filter out software GPUs and such this way.
As far as my testing goes, DEVPKEY_Device_MatchingDeviceId has this form with hardware GPUs only and maybe with the recent enough Win10 or Win11.
The other two device properties being added are also queried by the game although they are not strictly needed for it.
From: Paul Gofman pgofman@codeweavers.com
--- dlls/gdi32/tests/driver.c | 41 +++++++++++++++++++++++++++++++++++++++ dlls/win32u/sysparams.c | 19 ++++++++++++++++++ 2 files changed, 60 insertions(+)
diff --git a/dlls/gdi32/tests/driver.c b/dlls/gdi32/tests/driver.c index 94f93d61207..1b05c21ec65 100644 --- a/dlls/gdi32/tests/driver.c +++ b/dlls/gdi32/tests/driver.c @@ -32,6 +32,7 @@ #include "initguid.h" #include "setupapi.h" #include "ntddvdeo.h" +#include "devpkey.h"
#include "wine/test.h"
@@ -996,6 +997,45 @@ static void test_D3DKMTQueryVideoMemoryInfo(void) ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status); }
+static void test_gpu_device_properties(void) +{ + BYTE iface_detail_buffer[sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W) + 256 * sizeof(WCHAR)]; + SP_DEVINFO_DATA device_data = {sizeof(device_data)}; + SP_DEVICE_INTERFACE_DATA iface = {sizeof(iface)}; + SP_DEVICE_INTERFACE_DETAIL_DATA_W *iface_data; + WCHAR device_id[256]; + DEVPROPTYPE type; + unsigned int i; + HDEVINFO set; + BOOL ret; + + /* Make sure display devices are initialized. */ + SendMessageW(GetDesktopWindow(), WM_NULL, 0, 0); + + set = SetupDiGetClassDevsW(&GUID_DEVINTERFACE_DISPLAY_ADAPTER, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT); + ok(set != INVALID_HANDLE_VALUE, "SetupDiGetClassDevs failed, error %lu.\n", GetLastError()); + + iface_data = (SP_DEVICE_INTERFACE_DETAIL_DATA_W *)iface_detail_buffer; + iface_data->cbSize = sizeof(*iface_data); + + i = 0; + while (SetupDiEnumDeviceInterfaces(set, NULL, &GUID_DEVINTERFACE_DISPLAY_ADAPTER, i, &iface)) + { + ret = SetupDiGetDeviceInterfaceDetailW(set, &iface, iface_data, + sizeof(iface_detail_buffer), NULL, &device_data ); + ok(ret, "Got unexpected ret %d, GetLastError() %lu.\n", ret, GetLastError()); + + ret = SetupDiGetDevicePropertyW(set, &device_data, &DEVPKEY_Device_MatchingDeviceId, &type, + (BYTE *)device_id, sizeof(device_id), NULL, 0); + ok(ret, "Got unexpected ret %d, GetLastError() %lu.\n", ret, GetLastError()); + ok(type == DEVPROP_TYPE_STRING, "Got type %ld.\n", type); + + ++i; + } + SetupDiDestroyDeviceInfoList( set ); +} + + START_TEST(driver) { HMODULE gdi32 = GetModuleHandleA("gdi32.dll"); @@ -1025,6 +1065,7 @@ START_TEST(driver) test_D3DKMTCheckOcclusion(); test_D3DKMTOpenAdapterFromDeviceName(); test_D3DKMTQueryVideoMemoryInfo(); + test_gpu_device_properties();
FreeLibrary(dwmapi); } diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 60b12321953..a02158a17a0 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -93,6 +93,14 @@ static const WCHAR devpropkey_gpu_luidW[] = '\','0','0','0','2' };
+static const WCHAR devpkey_device_matching_device_id[] = +{ + 'P','r','o','p','e','r','t','i','e','s', + '\','{','A','8','B','8','6','5','D','D','-','2','E','3','D','-','4','0','9','4', + '-','A','D','9','7','-','E','5','9','3','A','7','0','C','7','5','D','6','}', + '\','0','0','0','8' +}; + static const WCHAR devpropkey_device_ispresentW[] = { 'P','r','o','p','e','r','t','i','e','s', @@ -1218,6 +1226,17 @@ static void add_gpu( const struct gdi_gpu *gpu, void *param ) bufferW[size / sizeof(WCHAR)] = 0; /* for REG_MULTI_SZ */ set_reg_value( hkey, hardware_idW, REG_MULTI_SZ, bufferW, size + sizeof(WCHAR) );
+ if ((subkey = reg_create_key( hkey, devpkey_device_matching_device_id, + sizeof(devpkey_device_matching_device_id), 0, NULL ))) + { + if (gpu->vendor_id && gpu->device_id) + set_reg_value( subkey, NULL, 0xffff0000 | DEVPROP_TYPE_STRING, bufferW, size ); + else + set_reg_value( subkey, NULL, 0xffff0000 | DEVPROP_TYPE_STRING, bufferW, + asciiz_to_unicode( bufferW, "ROOT\BasicRender" )); + NtClose( subkey ); + } + desc = gpu->name; if (!desc[0]) desc = wine_adapterW; set_reg_value( hkey, device_descW, REG_SZ, desc, (lstrlenW( desc ) + 1) * sizeof(WCHAR) );
From: Paul Gofman pgofman@codeweavers.com
--- dlls/gdi32/tests/driver.c | 12 ++++++++++++ dlls/win32u/sysparams.c | 16 ++++++++++++++++ 2 files changed, 28 insertions(+)
diff --git a/dlls/gdi32/tests/driver.c b/dlls/gdi32/tests/driver.c index 1b05c21ec65..dd333777ba6 100644 --- a/dlls/gdi32/tests/driver.c +++ b/dlls/gdi32/tests/driver.c @@ -1006,6 +1006,7 @@ static void test_gpu_device_properties(void) WCHAR device_id[256]; DEVPROPTYPE type; unsigned int i; + UINT32 value; HDEVINFO set; BOOL ret;
@@ -1030,6 +1031,17 @@ static void test_gpu_device_properties(void) ok(ret, "Got unexpected ret %d, GetLastError() %lu.\n", ret, GetLastError()); ok(type == DEVPROP_TYPE_STRING, "Got type %ld.\n", type);
+ ret = SetupDiGetDevicePropertyW(set, &device_data, &DEVPKEY_Device_BusNumber, &type, + (BYTE *)&value, sizeof(value), NULL, 0); + if (!wcsicmp(device_id, L"root\basicdisplay")) + { + ok(!ret, "Found Bus Id.\n"); + } + else + { + ok(ret, "Got unexpected ret %d, GetLastError() %lu, %s.\n", ret, GetLastError(), debugstr_w(device_id)); + ok(type == DEVPROP_TYPE_UINT32, "Got type %ld.\n", type); + } ++i; } SetupDiDestroyDeviceInfoList( set ); diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index a02158a17a0..b9ca5fce439 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -101,6 +101,14 @@ static const WCHAR devpkey_device_matching_device_id[] = '\','0','0','0','8' };
+static const WCHAR devpkey_device_bus_number[] = +{ + 'P','r','o','p','e','r','t','i','e','s', + '\','{','A','4','5','C','2','5','4','E','-','D','F','1','C','-','4','E','F','D', + '-','8','0','2','0','-','6','7','D','1','4','6','A','8','5','0','E','0','}', + '\','0','0','1','7' +}; + static const WCHAR devpropkey_device_ispresentW[] = { 'P','r','o','p','e','r','t','i','e','s', @@ -1237,6 +1245,14 @@ static void add_gpu( const struct gdi_gpu *gpu, void *param ) NtClose( subkey ); }
+ if (gpu->vendor_id && gpu->device_id) + { + if ((subkey = reg_create_key( hkey, devpkey_device_bus_number, + sizeof(devpkey_device_bus_number), 0, NULL ))) + set_reg_value( subkey, NULL, 0xffff0000 | DEVPROP_TYPE_UINT32, + &gpu_index, sizeof(gpu_index) ); + } + desc = gpu->name; if (!desc[0]) desc = wine_adapterW; set_reg_value( hkey, device_descW, REG_SZ, desc, (lstrlenW( desc ) + 1) * sizeof(WCHAR) );
From: Paul Gofman pgofman@codeweavers.com
--- dlls/gdi32/tests/driver.c | 7 +++++++ dlls/win32u/sysparams.c | 17 +++++++++++++++++ include/cfgmgr32.h | 4 ++++ 3 files changed, 28 insertions(+)
diff --git a/dlls/gdi32/tests/driver.c b/dlls/gdi32/tests/driver.c index dd333777ba6..ddefea9c2ac 100644 --- a/dlls/gdi32/tests/driver.c +++ b/dlls/gdi32/tests/driver.c @@ -33,6 +33,7 @@ #include "setupapi.h" #include "ntddvdeo.h" #include "devpkey.h" +#include "cfgmgr32.h"
#include "wine/test.h"
@@ -1042,6 +1043,12 @@ static void test_gpu_device_properties(void) ok(ret, "Got unexpected ret %d, GetLastError() %lu, %s.\n", ret, GetLastError(), debugstr_w(device_id)); ok(type == DEVPROP_TYPE_UINT32, "Got type %ld.\n", type); } + + ret = SetupDiGetDevicePropertyW(set, &device_data, &DEVPKEY_Device_RemovalPolicy, &type, + (BYTE *)&value, sizeof(value), NULL, 0); + ok(ret, "Got unexpected ret %d, GetLastError() %lu, %s.\n", ret, GetLastError(), debugstr_w(device_id)); + ok(value == CM_REMOVAL_POLICY_EXPECT_NO_REMOVAL || value == CM_REMOVAL_POLICY_EXPECT_ORDERLY_REMOVAL + || value == CM_REMOVAL_POLICY_EXPECT_SURPRISE_REMOVAL, "Got value %d.\n", value); ++i; } SetupDiDestroyDeviceInfoList( set ); diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index b9ca5fce439..5b63fd04d03 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -109,6 +109,14 @@ static const WCHAR devpkey_device_bus_number[] = '\','0','0','1','7' };
+static const WCHAR devpkey_device_removal_policy[] = +{ + 'P','r','o','p','e','r','t','i','e','s', + '\','{','A','4','5','C','2','5','4','E','-','D','F','1','C','-','4','E','F','D', + '-','8','0','2','0','-','6','7','D','1','4','6','A','8','5','0','E','0','}', + '\','0','0','2','1' +}; + static const WCHAR devpropkey_device_ispresentW[] = { 'P','r','o','p','e','r','t','i','e','s', @@ -1253,6 +1261,15 @@ static void add_gpu( const struct gdi_gpu *gpu, void *param ) &gpu_index, sizeof(gpu_index) ); }
+ if ((subkey = reg_create_key( hkey, devpkey_device_removal_policy, + sizeof(devpkey_device_removal_policy), 0, NULL ))) + { + unsigned int removal_policy = 1; + + set_reg_value( subkey, NULL, 0xffff0000 | DEVPROP_TYPE_UINT32, + &removal_policy, sizeof(removal_policy) ); + } + desc = gpu->name; if (!desc[0]) desc = wine_adapterW; set_reg_value( hkey, device_descW, REG_SZ, desc, (lstrlenW( desc ) + 1) * sizeof(WCHAR) ); diff --git a/include/cfgmgr32.h b/include/cfgmgr32.h index d300c4babaa..bff32fe1c08 100644 --- a/include/cfgmgr32.h +++ b/include/cfgmgr32.h @@ -180,6 +180,10 @@ typedef DWORD CONFIGRET; #define CM_REGISTRY_USER 0x0100 #define CM_REGISTRY_CONFIG 0x0200
+#define CM_REMOVAL_POLICY_EXPECT_NO_REMOVAL 1 +#define CM_REMOVAL_POLICY_EXPECT_ORDERLY_REMOVAL 2 +#define CM_REMOVAL_POLICY_EXPECT_SURPRISE_REMOVAL 3 + typedef DWORD DEVINST, *PDEVINST; typedef DWORD DEVNODE, *PDEVNODE; typedef HANDLE HMACHINE, *PHMACHINE;
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=130846
Your paranoid android.
=== debian11 (32 bit report) ===
gdi32: driver.c:1043: Test failed: Got unexpected ret 0, GetLastError() 1168, L"ROOT\BasicRender". driver.c:1044: Test failed: Got type 0.
=== debian11 (32 bit ar:MA report) ===
gdi32: driver.c:1043: Test failed: Got unexpected ret 0, GetLastError() 1168, L"ROOT\BasicRender". driver.c:1044: Test failed: Got type 0.
=== debian11 (32 bit de report) ===
gdi32: driver.c:1043: Test failed: Got unexpected ret 0, GetLastError() 1168, L"ROOT\BasicRender". driver.c:1044: Test failed: Got type 0.
=== debian11 (32 bit fr report) ===
gdi32: driver.c:1043: Test failed: Got unexpected ret 0, GetLastError() 1168, L"ROOT\BasicRender". driver.c:1044: Test failed: Got type 0.
=== debian11 (32 bit he:IL report) ===
gdi32: driver.c:1043: Test failed: Got unexpected ret 0, GetLastError() 1168, L"ROOT\BasicRender". driver.c:1044: Test failed: Got type 0.
=== debian11 (32 bit hi:IN report) ===
gdi32: driver.c:1043: Test failed: Got unexpected ret 0, GetLastError() 1168, L"ROOT\BasicRender". driver.c:1044: Test failed: Got type 0.
=== debian11 (32 bit ja:JP report) ===
gdi32: driver.c:1043: Test failed: Got unexpected ret 0, GetLastError() 1168, L"ROOT\BasicRender". driver.c:1044: Test failed: Got type 0.
=== debian11 (32 bit zh:CN report) ===
gdi32: driver.c:1043: Test failed: Got unexpected ret 0, GetLastError() 1168, L"ROOT\BasicRender". driver.c:1044: Test failed: Got type 0.
=== debian11b (32 bit WoW report) ===
gdi32: driver.c:1043: Test failed: Got unexpected ret 0, GetLastError() 1168, L"ROOT\BasicRender". driver.c:1044: Test failed: Got type 0.
=== debian11b (64 bit WoW report) ===
gdi32: driver.c:1043: Test failed: Got unexpected ret 0, GetLastError() 1168, L"ROOT\BasicRender". driver.c:1044: Test failed: Got type 0.
unsigned int removal_policy = 1;
Shouldn't we use the symbolic constant (CM_REMOVAL_POLICY_EXPECT_NO_REMOVAL) here?