Some games specifically ignore the last adapter from the adapter list, as it's always WARP on Windows. This makes them fail to detect GPUs correctly on Wine, as they drop one of the reported adapters.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com ---
I also have a patch to add a WARP adapter to the list in wined3d, but I think there's some multi-adapter work under way that will conflict, so I'll wait before sending it.
dlls/dxgi/tests/dxgi.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
diff --git a/dlls/dxgi/tests/dxgi.c b/dlls/dxgi/tests/dxgi.c index ce1aee5ee3b..589364271b1 100644 --- a/dlls/dxgi/tests/dxgi.c +++ b/dlls/dxgi/tests/dxgi.c @@ -5325,11 +5325,14 @@ static void test_multi_adapter(void) { unsigned int output_count = 0, expected_output_count = 0; unsigned int adapter_index, output_index, device_index; + DXGI_ADAPTER_DESC1 adapter_desc1; + DXGI_ADAPTER_DESC adapter_desc; DXGI_OUTPUT_DESC old_output_desc, output_desc; DISPLAY_DEVICEW display_device; MONITORINFO monitor_info; DEVMODEW old_mode, mode; IDXGIFactory *factory; + IDXGIAdapter1 *adapter1; IDXGIAdapter *adapter; IDXGIOutput *output; HMONITOR monitor; @@ -5530,6 +5533,35 @@ static void test_multi_adapter(void) IDXGIAdapter_Release(adapter); }
+ todo_wine ok(adapter_index >= 2, "Unexpected adapter count %u\n", adapter_index); + + hr = IDXGIFactory_EnumAdapters(factory, adapter_index - 1, &adapter); + ok(SUCCEEDED(hr), "Failed to get last adapter %u, hr %#x.\n", adapter_index - 1, hr); + + hr = IDXGIAdapter_GetDesc(adapter, &adapter_desc); + ok(SUCCEEDED(hr), "GetDesc failed, hr %#x.\n", hr); + + todo_wine ok(!lstrcmpW(adapter_desc.Description, L"Microsoft Basic Render Driver"), + "Unexpected name for last adapter %s\n", wine_dbgstr_w(adapter_desc.Description)); + ok(adapter_desc.SubSysId == 0x0000, "Expected SubSysId 0x0000, got %#x\n", adapter_desc.SubSysId); + todo_wine ok(adapter_desc.VendorId == 0x1414, "Expected VendorId 0x1414, got %#x\n", adapter_desc.VendorId); + todo_wine ok(adapter_desc.DeviceId == 0x008c, "Expected DeviceId 0x008c, got %#x\n", adapter_desc.DeviceId); + ok(adapter_desc.Revision == 0x0000, "Expected Revision 0x0000, got %#x\n", adapter_desc.Revision); + todo_wine ok(adapter_desc.DedicatedVideoMemory == 0, "Expected DedicatedVideoMemory 0, got %#lx\n", adapter_desc.DedicatedVideoMemory); + ok(adapter_desc.DedicatedSystemMemory == 0, "Expected DedicatedSystemMemory 0, got %#lx\n", adapter_desc.DedicatedSystemMemory); + + hr = IDXGIAdapter_QueryInterface(adapter, &IID_IDXGIAdapter1, (void **)&adapter1); + ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE), "Got unexpected hr %#x.\n", hr); + if (hr != E_NOINTERFACE) + { + hr = IDXGIAdapter1_GetDesc1(adapter1, &adapter_desc1); + ok(SUCCEEDED(hr), "GetDesc1 failed, hr %#x.\n", hr); + todo_wine ok(adapter_desc1.Flags == DXGI_ADAPTER_FLAG_SOFTWARE, "Expected flags DXGI_ADAPTER_FLAG_SOFTWARE, got %#x\n", adapter_desc1.Flags); + IDXGIAdapter1_Release(adapter1); + } + + IDXGIAdapter_Release(adapter); + IDXGIFactory_Release(factory);
expected_output_count = GetSystemMetrics(SM_CMONITORS);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=79525
Your paranoid android.
=== w2008s64 (32 bit report) ===
dxgi: dxgi.c:5602: Test failed: Got unexpected message 0x1a, hwnd 001200FA, wparam 0x18, lparam 0x7e518.
Hi Rémi,
I sent a v2 with some minor changes.
I have some questions. WARP is only always present on Win8+[1], if the game depends on the case, what will happen on win7? I checked a Win7 machine and there is no WARP adapter in DXGI.
My multi-GPU work mostly contains changes to wined3d code. I think only DXGI reports such an extra WARP adapter when a hardware GPU is present. So if you want to add a WARP adapter in DXGI, there should be no conflicts.
Thanks, Zhiyi
[1]: https://docs.microsoft.com/en-us/windows/win32/direct3ddxgi/d3d10-graphics-p...
On 9/30/20 4:20 PM, Rémi Bernon wrote:
Some games specifically ignore the last adapter from the adapter list, as it's always WARP on Windows. This makes them fail to detect GPUs correctly on Wine, as they drop one of the reported adapters.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com
I also have a patch to add a WARP adapter to the list in wined3d, but I think there's some multi-adapter work under way that will conflict, so I'll wait before sending it.
dlls/dxgi/tests/dxgi.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
diff --git a/dlls/dxgi/tests/dxgi.c b/dlls/dxgi/tests/dxgi.c index ce1aee5ee3b..589364271b1 100644 --- a/dlls/dxgi/tests/dxgi.c +++ b/dlls/dxgi/tests/dxgi.c @@ -5325,11 +5325,14 @@ static void test_multi_adapter(void) { unsigned int output_count = 0, expected_output_count = 0; unsigned int adapter_index, output_index, device_index;
- DXGI_ADAPTER_DESC1 adapter_desc1;
- DXGI_ADAPTER_DESC adapter_desc; DXGI_OUTPUT_DESC old_output_desc, output_desc; DISPLAY_DEVICEW display_device; MONITORINFO monitor_info; DEVMODEW old_mode, mode; IDXGIFactory *factory;
- IDXGIAdapter1 *adapter1; IDXGIAdapter *adapter; IDXGIOutput *output; HMONITOR monitor;
@@ -5530,6 +5533,35 @@ static void test_multi_adapter(void) IDXGIAdapter_Release(adapter); }
todo_wine ok(adapter_index >= 2, "Unexpected adapter count %u\n", adapter_index);
hr = IDXGIFactory_EnumAdapters(factory, adapter_index - 1, &adapter);
ok(SUCCEEDED(hr), "Failed to get last adapter %u, hr %#x.\n", adapter_index - 1, hr);
hr = IDXGIAdapter_GetDesc(adapter, &adapter_desc);
ok(SUCCEEDED(hr), "GetDesc failed, hr %#x.\n", hr);
todo_wine ok(!lstrcmpW(adapter_desc.Description, L"Microsoft Basic Render Driver"),
"Unexpected name for last adapter %s\n", wine_dbgstr_w(adapter_desc.Description));
ok(adapter_desc.SubSysId == 0x0000, "Expected SubSysId 0x0000, got %#x\n", adapter_desc.SubSysId);
todo_wine ok(adapter_desc.VendorId == 0x1414, "Expected VendorId 0x1414, got %#x\n", adapter_desc.VendorId);
todo_wine ok(adapter_desc.DeviceId == 0x008c, "Expected DeviceId 0x008c, got %#x\n", adapter_desc.DeviceId);
ok(adapter_desc.Revision == 0x0000, "Expected Revision 0x0000, got %#x\n", adapter_desc.Revision);
todo_wine ok(adapter_desc.DedicatedVideoMemory == 0, "Expected DedicatedVideoMemory 0, got %#lx\n", adapter_desc.DedicatedVideoMemory);
ok(adapter_desc.DedicatedSystemMemory == 0, "Expected DedicatedSystemMemory 0, got %#lx\n", adapter_desc.DedicatedSystemMemory);
hr = IDXGIAdapter_QueryInterface(adapter, &IID_IDXGIAdapter1, (void **)&adapter1);
ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE), "Got unexpected hr %#x.\n", hr);
if (hr != E_NOINTERFACE)
{
hr = IDXGIAdapter1_GetDesc1(adapter1, &adapter_desc1);
ok(SUCCEEDED(hr), "GetDesc1 failed, hr %#x.\n", hr);
todo_wine ok(adapter_desc1.Flags == DXGI_ADAPTER_FLAG_SOFTWARE, "Expected flags DXGI_ADAPTER_FLAG_SOFTWARE, got %#x\n", adapter_desc1.Flags);
IDXGIAdapter1_Release(adapter1);
}
IDXGIAdapter_Release(adapter);
IDXGIFactory_Release(factory);
expected_output_count = GetSystemMetrics(SM_CMONITORS);
On 9/30/20 11:39 AM, Zhiyi Zhang wrote:
Hi Rémi,
I sent a v2 with some minor changes.
I saw that, thanks!
I have some questions. WARP is only always present on Win8+[1], if the game depends on the case, what will happen on win7? I checked a Win7 machine and there is no WARP adapter in DXGI.
Well, no idea actually. I believe they may print a warning in that case, I saw that only with Mafia III DE launcher, which is quite recent and probably doesn't care about old Windows versions. Also most likely the case where there's a single adapter means there's only an integrated GPU, which will probably trigger a warning anyway.
My multi-GPU work mostly contains changes to wined3d code. I think only DXGI reports such an extra WARP adapter when a hardware GPU is present. So if you want to add a WARP adapter in DXGI, there should be no conflicts.
Alright, I was actually trying to add it to the wined3d adapter list, as it was easier that way, but I don't know exactly what adding it there implies. Maybe it should indeed only be reported by DXGI, so I'll see if we can safely report a dummy adapter here.
Thanks, Zhiyi