diff --git a/patches/dxva2-Video_Decoder/0006-dxva2-tests-Add-tests-for-dxva2-decoder.patch b/patches/dxva2-Video_Decoder/0006-dxva2-tests-Add-tests-for-dxva2-decoder.patch index e209a607..f25f9f32 100644 --- a/patches/dxva2-Video_Decoder/0006-dxva2-tests-Add-tests-for-dxva2-decoder.patch +++ b/patches/dxva2-Video_Decoder/0006-dxva2-tests-Add-tests-for-dxva2-decoder.patch @@ -1,78 +1,20 @@ -From c861c2026ec36ad285138e4036919874bd25c60f Mon Sep 17 00:00:00 2001 +From 82fe90e800334e5cede6ce7865012131427596d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= -Date: Sun, 22 Feb 2015 01:21:18 +0100 +Date: Tue, 15 Dec 2020 11:16:42 +1100 Subject: [PATCH] dxva2/tests: Add tests for dxva2 decoder. --- - configure.ac | 1 + - dlls/dxva2/tests/Makefile.in | 5 + - dlls/dxva2/tests/dxva2.c | 371 +++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 377 insertions(+) - create mode 100644 dlls/dxva2/tests/Makefile.in - create mode 100644 dlls/dxva2/tests/dxva2.c + dlls/dxva2/tests/dxva2.c | 292 +++++++++++++++++++++++++++++++++++++++ + 1 file changed, 292 insertions(+) -diff --git a/configure.ac b/configure.ac -index d719536..c6c7653 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -3231,6 +3231,7 @@ WINE_CONFIG_MAKEFILE(dlls/dxgi) - WINE_CONFIG_MAKEFILE(dlls/dxgi/tests) - WINE_CONFIG_MAKEFILE(dlls/dxguid) - WINE_CONFIG_MAKEFILE(dlls/dxva2) -+WINE_CONFIG_MAKEFILE(dlls/dxva2/tests) - WINE_CONFIG_MAKEFILE(dlls/esent) - WINE_CONFIG_MAKEFILE(dlls/evr) - WINE_CONFIG_MAKEFILE(dlls/evr/tests) -diff --git a/dlls/dxva2/tests/Makefile.in b/dlls/dxva2/tests/Makefile.in -new file mode 100644 -index 0000000..10d6af5 ---- /dev/null -+++ b/dlls/dxva2/tests/Makefile.in -@@ -0,0 +1,5 @@ -+TESTDLL = dxva2.dll -+IMPORTS = d3d9 user32 ole32 -+ -+C_SRCS = \ -+ dxva2.c diff --git a/dlls/dxva2/tests/dxva2.c b/dlls/dxva2/tests/dxva2.c -new file mode 100644 -index 0000000..dcbb990 ---- /dev/null +index a49635e7596..565f5481684 100644 +--- a/dlls/dxva2/tests/dxva2.c +++ b/dlls/dxva2/tests/dxva2.c -@@ -0,0 +1,371 @@ -+/* -+ * Unit tests for dxva2 functions -+ * -+ * Copyright 2015 Michael Müller -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA -+ */ -+ -+#include -+#include -+#include "wine/test.h" -+#include "windef.h" -+#include "winbase.h" -+#include "winerror.h" -+ -+#define COBJMACROS -+#define INITGUID -+#include "d3d9.h" -+#include "dxva2api.h" -+#include "dxva.h" -+ +@@ -23,6 +23,73 @@ + #include "initguid.h" + #include "dxva2api.h" + +DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); + +struct decoder_name @@ -140,42 +82,13 @@ index 0000000..dcbb990 + return wine_dbgstr_guid(guid); +} + -+HRESULT (WINAPI* pDXVA2CreateVideoService)(IDirect3DDevice9 *device, REFIID riid, void **ppv); -+ -+static BOOL init_dxva2(void) -+{ -+ HMODULE dxva2 = LoadLibraryA("dxva2.dll"); -+ if (!dxva2) -+ { -+ win_skip("dxva2.dll not available\n"); -+ return FALSE; -+ } -+ -+ pDXVA2CreateVideoService = (void *)GetProcAddress(dxva2, "DXVA2CreateVideoService"); -+ return TRUE; -+} -+ -+static IDirect3DDevice9 *create_device(IDirect3D9 *d3d9, HWND focus_window) -+{ -+ D3DPRESENT_PARAMETERS present_parameters = {0}; -+ IDirect3DDevice9 *device; -+ DWORD behavior_flags = D3DCREATE_HARDWARE_VERTEXPROCESSING; -+ -+ present_parameters.BackBufferWidth = 640; -+ present_parameters.BackBufferHeight = 480; -+ present_parameters.BackBufferFormat = D3DFMT_A8R8G8B8; -+ present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD; -+ present_parameters.hDeviceWindow = focus_window; -+ present_parameters.Windowed = TRUE; -+ present_parameters.EnableAutoDepthStencil = FALSE; -+ -+ if (SUCCEEDED(IDirect3D9_CreateDevice(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, focus_window, -+ behavior_flags, &present_parameters, &device))) -+ return device; -+ -+ return NULL; -+} -+ + static unsigned int get_refcount(void *object) + { + IUnknown *iface = object; +@@ -60,6 +127,27 @@ static IDirect3DDevice9 *create_device(IDirect3D9 *d3d9, HWND focus_window) + return device; + } + +static BOOL create_video_service(HWND focus_window, REFIID riid, void **service) +{ + IDirect3DDevice9 *device; @@ -190,13 +103,20 @@ index 0000000..dcbb990 + if(!device) + return FALSE; + -+ hr = pDXVA2CreateVideoService(device, riid, service); ++ hr = DXVA2CreateVideoService(device, riid, service); + IDirect3DDevice9_Release(device); + if (hr) return FALSE; + + return TRUE; +} + + static void test_surface_desc(IDirect3DSurface9 *surface) + { + D3DSURFACE_DESC desc = { 0 }; +@@ -462,8 +550,212 @@ done: + DestroyWindow(window); + } + +static inline void test_buffer(IDirectXVideoDecoder *decoder, UINT type, const char *name) +{ + void *buffer; @@ -347,15 +267,18 @@ index 0000000..dcbb990 + test_decoder_resolution(service, guid, test_format, width, height, surface_count); +} + -+static void test_decoder_service(HWND focus_window) ++static void test_decoder_service(void) +{ + IDirectXVideoDecoderService *service; + unsigned int i, j; + HRESULT hr; + UINT count; + GUID *guids; ++ HWND window; + -+ if (!create_video_service(focus_window, &IID_IDirectXVideoDecoderService, (void**)&service)) ++ window = create_window(); ++ ++ if (!create_video_service(window, &IID_IDirectXVideoDecoderService, (void**)&service)) + { + skip("Failed to create video decoder service, skipping decoder service tests\n"); + return; @@ -394,23 +317,15 @@ index 0000000..dcbb990 + } + + IDirectXVideoDecoderService_Release(service); ++ DestroyWindow(window); +} + -+START_TEST(dxva2) -+{ -+ HWND window; -+ -+ if (!init_dxva2()) -+ return; -+ -+ window = CreateWindowA("static", "dxva2_test", WS_OVERLAPPEDWINDOW, -+ 0, 0, 640, 480, NULL, NULL, NULL, NULL); -+ -+ ok(window != NULL, "couldn't create window\n"); -+ if (!window) return; -+ -+ test_decoder_service(window); -+} + START_TEST(dxva2) + { + test_device_manager(); + test_video_processor(); ++ test_decoder_service(); + } -- -1.9.1 +2.29.2