This avoids opening multiple Vulkan instances when multiple D3D kernel mode adapters are open. Some tests that leak reference to D3D adapters crash because of out of memory errors before this patch.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53201 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53231 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53235 Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com
-- v2: mfplat/tests: Fix resource leaks. d2d1/tests: Fix resource leaks. evr/tests: Fix resource leaks. evr: Release buffer after adding it to sample.
From: Zhiyi Zhang zzhang@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53201 Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/evr/sample.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/dlls/evr/sample.c b/dlls/evr/sample.c index f03292704b5..6a1bbf564f5 100644 --- a/dlls/evr/sample.c +++ b/dlls/evr/sample.c @@ -1747,7 +1747,10 @@ HRESULT WINAPI MFCreateVideoSampleFromSurface(IUnknown *surface, IMFSample **sam }
if (buffer) + { IMFSample_AddBuffer(object->sample, buffer); + IMFMediaBuffer_Release(buffer); + }
video_sample_create_tracking_thread();
From: Zhiyi Zhang zzhang@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53201 Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/evr/tests/evr.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-)
diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c index fa9ad2a0b35..37bb55739d3 100644 --- a/dlls/evr/tests/evr.c +++ b/dlls/evr/tests/evr.c @@ -1061,10 +1061,11 @@ static void test_surface_sample(void) ok(flags == 0x123, "Unexpected flags %#lx.\n", flags);
IMFSample_Release(sample); - -done: if (backbuffer) IDirect3DSurface9_Release(backbuffer); + ok(!IDirect3DDevice9_Release(device), "Unexpected refcount.\n"); + +done: DestroyWindow(window); }
@@ -1455,6 +1456,7 @@ static void test_default_presenter(void)
hr = MFGetService((IUnknown *)presenter, &MR_VIDEO_ACCELERATION_SERVICE, &IID_IDirect3DDeviceManager9, (void **)&dm); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IDirect3DDeviceManager9_Release(dm);
hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFVideoDisplayControl, (void **)&display_control); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); @@ -1484,6 +1486,7 @@ static void test_default_presenter(void) hr = IMFVideoDisplayControl_GetVideoWindow(display_control, &hwnd2); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(hwnd2 == hwnd, "Unexpected window %p.\n", hwnd2); + IMFVideoDisplayControl_Release(display_control);
/* Rate support. */ hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFRateSupport, (void **)&rate_support); @@ -1511,7 +1514,7 @@ static void test_default_presenter(void)
IMFRateSupport_Release(rate_support);
- IMFVideoPresenter_Release(presenter); + ok(!IMFVideoPresenter_Release(presenter), "Unexpected refcount.\n");
DestroyWindow(hwnd); } @@ -1697,7 +1700,10 @@ static void test_MFCreateVideoSampleAllocator(void) if (!(device = create_device(window))) { skip("Failed to create a D3D device, skipping tests.\n"); - goto done; + IMFMediaType_Release(video_type); + IMFMediaType_Release(media_type); + DestroyWindow(window); + return; }
hr = DXVA2CreateDirect3DDeviceManager9(&token, &manager); @@ -1735,14 +1741,13 @@ static void test_MFCreateVideoSampleAllocator(void) hr = IMFMediaBuffer_Unlock(buffer); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
+ IMFMediaBuffer_Release(buffer); IMFSample_Release(sample); - IMFVideoSampleAllocator_Release(allocator); - + IMFMediaType_Release(video_type); IMFMediaType_Release(media_type); IDirect3DDeviceManager9_Release(manager); IDirect3DDevice9_Release(device); -done: DestroyWindow(window); }
@@ -2067,6 +2072,7 @@ static void test_presenter_native_video_size(void)
hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFTopologyServiceLookupClient, (void **)&lookup_client); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFTopologyServiceLookupClient_Release(lookup_client);
hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFVideoDisplayControl, (void **)&display_control); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); @@ -2141,6 +2147,7 @@ static void test_presenter_native_video_size(void) ok((ratio.cx == 4 && ratio.cy == 3) || broken(!memcmp(&ratio, &size, sizeof(ratio))) /* < Win10 */, "Unexpected ratio %lu x %lu.\n", ratio.cx, ratio.cy);
+ IMFTopologyServiceLookupClient_Release(lookup_client); IMFMediaType_Release(video_type); IMFVideoDisplayControl_Release(display_control); IMFVideoPresenter_Release(presenter); @@ -2259,7 +2266,8 @@ static void test_presenter_video_window(void) hr = IDirect3DDeviceManager9_CloseDeviceHandle(dm, hdevice); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- IMFVideoDisplayControl_Release(display_control); + IDirect3DDeviceManager9_Release(dm); + ok(!IMFVideoDisplayControl_Release(display_control), "Unexpected refcount.\n");
DestroyWindow(window); } @@ -2420,6 +2428,7 @@ static void test_presenter_media_type(void)
hr = IMFTopologyServiceLookupClient_InitServicePointers(lookup_client, &host.IMFTopologyServiceLookup_iface); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFTopologyServiceLookupClient_Release(lookup_client);
hr = IMFVideoDisplayControl_SetVideoWindow(display_control, window); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); @@ -2431,6 +2440,7 @@ static void test_presenter_media_type(void)
hr = IMFTransform_SetInputType(mixer, 0, input_type, 0); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFMediaType_Release(input_type);
hr = IMFVideoPresenter_ProcessMessage(presenter, MFVP_MESSAGE_INVALIDATEMEDIATYPE, 0); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); @@ -2463,6 +2473,8 @@ static void test_presenter_media_type(void) IMFVideoDisplayControl_Release(display_control); IMFVideoPresenter_Release(presenter); IMFTransform_Release(mixer); + IDirect3DDeviceManager9_Release(manager); + IDirect3DDevice9_Release(device);
done: DestroyWindow(window); @@ -2949,6 +2961,7 @@ static void test_mixer_samples(void) ok(hr == MF_E_INVALIDSTREAMNUMBER, "Unexpected hr %#lx.\n", hr);
IMFDesiredSample_Clear(desired); + IMFDesiredSample_Release(desired);
hr = IMFTransform_ProcessInput(mixer, 0, NULL, 0); ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr); @@ -3045,8 +3058,8 @@ static void test_mixer_samples(void) IMFVideoProcessor_Release(processor); IMFTransform_Release(mixer);
- IDirect3DDevice9_Release(device); IDirect3DDeviceManager9_Release(manager); + ok(!IDirect3DDevice9_Release(device), "Unexpected refcount.\n");
done: DestroyWindow(window); @@ -3120,9 +3133,11 @@ static void test_mixer_render(void)
hr = IMFTransform_QueryInterface(mixer, &IID_IMFVideoProcessor, (void **)&processor); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFVideoProcessor_Release(processor);
hr = IMFTransform_QueryInterface(mixer, &IID_IMFVideoMixerControl, (void **)&mixer_control); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFVideoMixerControl_Release(mixer_control);
/* Configure device and media types. */ hr = DXVA2CreateDirect3DDeviceManager9(&token, &manager); @@ -3197,8 +3212,8 @@ static void test_mixer_render(void) IDirect3DSurface9_Release(surface); IMFTransform_Release(mixer);
- IDirect3DDevice9_Release(device); IDirect3DDeviceManager9_Release(manager); + ok(!IDirect3DDevice9_Release(device), "Unexpected refcount.\n");
done: DestroyWindow(window);
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 full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=117953
Your paranoid android.
=== w8adm (32 bit report) ===
evr: 0aa0:evr: unhandled exception c0000005 at 67E8E07D
From: Zhiyi Zhang zzhang@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53231 Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/d2d1/tests/d2d1.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 6ba4d8cec59..960d4480747 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -1168,7 +1168,8 @@ static void release_test_context_(unsigned int line, struct d2d1_test_context *c IDXGISurface_Release(ctx->surface); IDXGISwapChain_Release(ctx->swapchain); DestroyWindow(ctx->window); - IDXGIDevice_Release(ctx->device); + ref = IDXGIDevice_Release(ctx->device); + ok_(__FILE__, line)(!ref, "Device has %lu references left.\n", ref); }
#define init_test_context(ctx, d3d11) init_test_context_(__LINE__, ctx, d3d11) @@ -5182,16 +5183,17 @@ static void test_shared_bitmap(BOOL d3d11) todo_wine_if(i == 2 || i == 3 || i == 5 || i == 6) ok(hr == bitmap_format_tests[i].hr, "%u: Got unexpected hr %#lx.\n", i, hr);
- if (SUCCEEDED(bitmap_format_tests[i].hr)) + if (SUCCEEDED(hr) && hr == bitmap_format_tests[i].hr) { pixel_format = ID2D1Bitmap_GetPixelFormat(bitmap2); ok(pixel_format.format == bitmap_format_tests[i].result.format, "%u: unexpected pixel format %#x.\n", i, pixel_format.format); ok(pixel_format.alphaMode == bitmap_format_tests[i].result.alphaMode, "%u: unexpected alpha mode %d.\n", i, pixel_format.alphaMode); + }
+ if (SUCCEEDED(hr)) ID2D1Bitmap_Release(bitmap2); - } } }
@@ -5723,6 +5725,8 @@ static void test_draw_text_layout(BOOL d3d11) IDWriteRenderingParams_Release(rendering_params); }
+ ID2D1SolidColorBrush_Release(brush2); + ID2D1SolidColorBrush_Release(brush); IDWriteTextFormat_Release(text_format); IDWriteTextLayout_Release(text_layout); IDWriteFactory_Release(dwrite_factory); @@ -8899,7 +8903,7 @@ static void test_bitmap_surface(BOOL d3d11) todo_wine_if(bitmap_format_tests[i].hr == WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT) ok(hr == bitmap_format_tests[i].hr, "%u: Got unexpected hr %#lx.\n", i, hr);
- if (SUCCEEDED(bitmap_format_tests[i].hr)) + if (SUCCEEDED(hr) && hr == bitmap_format_tests[i].hr) { pixel_format = ID2D1Bitmap1_GetPixelFormat(bitmap);
@@ -8907,9 +8911,10 @@ static void test_bitmap_surface(BOOL d3d11) i, pixel_format.format); ok(pixel_format.alphaMode == bitmap_format_tests[i].result.alphaMode, "%u: unexpected alpha mode %d.\n", i, pixel_format.alphaMode); + }
+ if (SUCCEEDED(hr)) ID2D1Bitmap1_Release(bitmap); - } }
/* A8 surface */ @@ -8943,6 +8948,7 @@ static void test_bitmap_surface(BOOL d3d11) ID2D1DeviceContext_SetTarget(device_context, (ID2D1Image *)bitmap); ID2D1DeviceContext_GetTarget(device_context, &target); ok(target == (ID2D1Image *)bitmap, "Unexpected target.\n"); + ID2D1Image_Release(target);
check_rt_bitmap_surface((ID2D1RenderTarget *)device_context, TRUE, D2D1_BITMAP_OPTIONS_NONE);
@@ -9036,6 +9042,7 @@ static void test_bitmap_surface(BOOL d3d11)
hr = ID2D1Factory1_CreateWicBitmapRenderTarget(factory, wic_bitmap, &rt_desc, &rt); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + IWICBitmap_Release(wic_bitmap);
check_rt_bitmap_surface(rt, FALSE, D2D1_BITMAP_OPTIONS_NONE); ID2D1RenderTarget_Release(rt); @@ -9423,6 +9430,7 @@ static void test_command_list(BOOL d3d11) { ID2D1DeviceContext_Release(device_context); ID2D1Factory1_Release(factory); + release_test_context(&ctx); return; }
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=117954
Your paranoid android.
=== debian11 (64 bit WoW report) ===
d2d1: d2d1: Timeout
From: Zhiyi Zhang zzhang@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53235 Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/mfplat/tests/mfplat.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 48f7a444add..deed2408a41 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -6639,11 +6639,12 @@ static void test_MFCreateDXSurfaceBuffer(void) IMF2DBuffer2_Release(_2dbuffer2);
IMFMediaBuffer_Release(buffer); + IDirect3DDevice9_Release(device);
done: if (backbuffer) IDirect3DSurface9_Release(backbuffer); - IDirect3D9_Release(d3d); + ok(!IDirect3D9_Release(d3d), "Unexpected refcount.\n"); DestroyWindow(window); }
@@ -7618,6 +7619,8 @@ static void test_sample_allocator_d3d9(void)
IMFVideoSampleAllocator_Release(allocator); IMFMediaType_Release(video_type); + IDirect3DDeviceManager9_Release(d3d9_manager); + IDirect3DDevice9_Release(d3d9_device);
done: IDirect3D9_Release(d3d9); @@ -7725,6 +7728,7 @@ static void test_sample_allocator_d3d11(void) hr = IMFMediaBuffer_Unlock(buffer); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
+ IMFMediaBuffer_Release(buffer); IMFSample_Release(sample);
IMFVideoSampleAllocator_Release(allocator); @@ -7867,7 +7871,7 @@ static void test_sample_allocator_d3d11(void)
static void test_sample_allocator_d3d12(void) { - IMFVideoSampleAllocator *allocator; + IMFVideoSampleAllocator *allocator = NULL; D3D12_HEAP_PROPERTIES heap_props; IMFDXGIDeviceManager *manager; D3D12_HEAP_FLAGS heap_flags; @@ -7955,11 +7959,12 @@ static void test_sample_allocator_d3d12(void)
ID3D12Resource_Release(resource); IMFDXGIBuffer_Release(dxgi_buffer); + IMFMediaBuffer_Release(buffer); IMFSample_Release(sample);
- IMFVideoSampleAllocator_Release(allocator); - done: + if (allocator) + IMFVideoSampleAllocator_Release(allocator); IMFDXGIDeviceManager_Release(manager); ID3D12Device_Release(device); }
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=117955
Your paranoid android.
=== w7u_el (32 bit report) ===
mfplat: 085c:mfplat: unhandled exception c0000005 at 71EF7D1C
This merge request was approved by Nikolay Sivov.