Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/d3d12/tests/d3d12.c | 2 +- dlls/dxgi/tests/dxgi.c | 4 +-- dlls/wined3d/directx.c | 54 ++++++++++++++++++++++++++++++++++------ 3 files changed, 49 insertions(+), 11 deletions(-)
diff --git a/dlls/d3d12/tests/d3d12.c b/dlls/d3d12/tests/d3d12.c index 0200047fd17..8c57f07357c 100644 --- a/dlls/d3d12/tests/d3d12.c +++ b/dlls/d3d12/tests/d3d12.c @@ -139,7 +139,7 @@ static void print_adapter_info(void) hr = CreateDXGIFactory2(0, &IID_IDXGIFactory4, (void **)&factory); ok(hr == S_OK, "Failed to create factory, hr %#x.\n", hr); hr = IDXGIFactory4_EnumAdapterByLuid(factory, luid, &IID_IDXGIAdapter, (void **)&adapter); - todo_wine ok(hr == S_OK, "Failed to enum adapter by LUID, hr %#x.\n", hr); + ok(hr == S_OK, "Failed to enum adapter by LUID, hr %#x.\n", hr); IDXGIFactory4_Release(factory);
if (FAILED(hr)) diff --git a/dlls/dxgi/tests/dxgi.c b/dlls/dxgi/tests/dxgi.c index 8f52e1d9e72..d50c4f14566 100644 --- a/dlls/dxgi/tests/dxgi.c +++ b/dlls/dxgi/tests/dxgi.c @@ -958,7 +958,7 @@ static void test_adapter_luid(void) ok(hr == DXGI_ERROR_NOT_FOUND, "Got unexpected hr %#x.\n", hr);
/* Older versions of WARP aren't enumerated by IDXGIFactory_EnumAdapters(). */ - todo_wine ok(found_adapter_count == 1 || broken(is_null_luid_adapter), + ok(found_adapter_count == 1 || broken(is_null_luid_adapter), "Found %u adapters for LUID %08x:%08x.\n", found_adapter_count, device_adapter_desc.AdapterLuid.HighPart, device_adapter_desc.AdapterLuid.LowPart); @@ -981,7 +981,7 @@ static void test_adapter_luid(void)
hr = IDXGIFactory4_EnumAdapterByLuid(factory4, device_adapter_desc.AdapterLuid, &IID_IDXGIAdapter, (void **)&adapter); - todo_wine ok(hr == S_OK, "Failed to enum adapter by LUID, hr %#x.\n", hr); + ok(hr == S_OK, "Failed to enum adapter by LUID, hr %#x.\n", hr); if (SUCCEEDED(hr)) { hr = IDXGIAdapter_GetDesc(adapter, &desc); diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 456cb9ad124..e77283832ca 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -2942,6 +2942,41 @@ static struct wined3d_adapter *wined3d_adapter_no3d_create(unsigned int ordinal, return adapter; }
+static BOOL get_primary_display(WCHAR *display) +{ + DISPLAY_DEVICEW display_device; + DWORD device_idx = 0; + + display_device.cb = sizeof(display_device); + while (EnumDisplayDevicesW(NULL, device_idx++, &display_device, 0)) + { + if (display_device.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) + { + lstrcpyW(display, display_device.DeviceName); + return TRUE; + } + } + + return FALSE; +} + +static BOOL wined3d_adapter_init_luid(struct wined3d_adapter *adapter) +{ + D3DKMT_OPENADAPTERFROMGDIDISPLAYNAME open_adapter_param; + D3DKMT_CLOSEADAPTER close_adapter_param; + + if (!get_primary_display(open_adapter_param.DeviceName)) + return FALSE; + + if (D3DKMTOpenAdapterFromGdiDisplayName(&open_adapter_param)) + return FALSE; + + adapter->luid = open_adapter_param.AdapterLuid; + close_adapter_param.hAdapter = open_adapter_param.hAdapter; + D3DKMTCloseAdapter(&close_adapter_param); + return TRUE; +} + BOOL wined3d_adapter_init(struct wined3d_adapter *adapter, unsigned int ordinal, const struct wined3d_adapter_ops *adapter_ops) { @@ -2953,6 +2988,17 @@ BOOL wined3d_adapter_init(struct wined3d_adapter *adapter, unsigned int ordinal, adapter->ordinal = ordinal; adapter->output_count = 0;
+ if (!wined3d_adapter_init_luid(adapter)) + { + WARN("Allocating a random LUID.\n"); + if (!AllocateLocallyUniqueId(&adapter->luid)) + { + ERR("Failed to allocate a LUID, error %#x.\n", GetLastError()); + return FALSE; + } + } + TRACE("adapter %p LUID %08x:%08x.\n", adapter, adapter->luid.HighPart, adapter->luid.LowPart); + display_device.cb = sizeof(display_device); EnumDisplayDevicesW(NULL, ordinal, &display_device, 0); TRACE("Display device: %s.\n", debugstr_w(display_device.DeviceName)); @@ -2972,14 +3018,6 @@ BOOL wined3d_adapter_init(struct wined3d_adapter *adapter, unsigned int ordinal, } adapter->output_count = 1;
- if (!AllocateLocallyUniqueId(&adapter->luid)) - { - ERR("Failed to set adapter LUID (%#x).\n", GetLastError()); - goto done; - } - TRACE("Allocated LUID %08x:%08x for adapter %p.\n", - adapter->luid.HighPart, adapter->luid.LowPart, adapter); - memset(&adapter->driver_uuid, 0, sizeof(adapter->driver_uuid)); memset(&adapter->device_uuid, 0, sizeof(adapter->device_uuid));
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=74847
Your paranoid android.
=== debiant (32 bit report) ===
dxgi: dxgi: Timeout
=== debiant (32 bit French report) ===
dxgi: dxgi: Timeout
=== debiant (build log) ===
0024:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 0024:err:winediag:nodrv_CreateWindow The explorer process failed to start. Task: WineTest did not produce the win32_ja_JP report
=== debiant (32 bit WoW report) ===
dxgi: dxgi: Timeout
=== debiant (64 bit WoW report) ===
dxgi: dxgi: Timeout
On 7/6/20 5:07 PM, Marvin wrote:
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=74847
Your paranoid android.
=== debiant (32 bit report) ===
dxgi: dxgi: Timeout
=== debiant (32 bit French report) ===
dxgi: dxgi: Timeout
=== debiant (build log) ===
0024:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 0024:err:winediag:nodrv_CreateWindow The explorer process failed to start. Task: WineTest did not produce the win32_ja_JP report
=== debiant (32 bit WoW report) ===
dxgi: dxgi: Timeout
=== debiant (64 bit WoW report) ===
dxgi: dxgi: Timeout
No sure what's wrong yet. But an empty test also triggers such errors. See https://testbot.winehq.org/JobDetails.pl?Key=74856#k101 And the errors seem to be a regression. I will take a look.
On 2020-07-06 11:52, Zhiyi Zhang wrote:
On 7/6/20 5:07 PM, Marvin wrote:
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=74847
Your paranoid android.
=== debiant (32 bit report) ===
dxgi: dxgi: Timeout
=== debiant (32 bit French report) ===
dxgi: dxgi: Timeout
=== debiant (build log) ===
0024:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 0024:err:winediag:nodrv_CreateWindow The explorer process failed to start. Task: WineTest did not produce the win32_ja_JP report
=== debiant (32 bit WoW report) ===
dxgi: dxgi: Timeout
=== debiant (64 bit WoW report) ===
dxgi: dxgi: Timeout
No sure what's wrong yet. But an empty test also triggers such errors. See https://testbot.winehq.org/JobDetails.pl?Key=74856#k101 And the errors seem to be a regression. I will take a look.
I tracked down some timeout issues with the user32 monitor test here:
https://www.winehq.org/pipermail/wine-devel/2020-July/169357.html
I believe the dxgi test also alter display modes so could it be the same thing?