Nikolay Sivov : dxva2: Add GetVideoProcessorCaps() for software device.

Alexandre Julliard julliard at winehq.org
Tue Nov 2 17:27:46 CDT 2021


Module: wine
Branch: master
Commit: ef5846794c92f3e68ee6c2890f9c4a18041109f0
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=ef5846794c92f3e68ee6c2890f9c4a18041109f0

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Tue Nov  2 22:05:38 2021 +0300

dxva2: Add GetVideoProcessorCaps() for software device.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dxva2/main.c        | 21 +++++++++++++++++++--
 dlls/dxva2/tests/dxva2.c | 45 +++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 60 insertions(+), 6 deletions(-)

diff --git a/dlls/dxva2/main.c b/dlls/dxva2/main.c
index 2fab82ff476..81c32692f7f 100644
--- a/dlls/dxva2/main.c
+++ b/dlls/dxva2/main.c
@@ -204,9 +204,26 @@ static HRESULT WINAPI video_processor_GetCreationParameters(IDirectXVideoProcess
 static HRESULT WINAPI video_processor_GetVideoProcessorCaps(IDirectXVideoProcessor *iface,
         DXVA2_VideoProcessorCaps *caps)
 {
-    FIXME("%p, %p.\n", iface, caps);
+    struct video_processor *processor = impl_from_IDirectXVideoProcessor(iface);
 
-    return E_NOTIMPL;
+    TRACE("%p, %p.\n", iface, caps);
+
+    if (IsEqualGUID(&processor->device, &DXVA2_VideoProcSoftwareDevice))
+    {
+        memset(caps, 0, sizeof(*caps));
+        caps->DeviceCaps = DXVA2_VPDev_SoftwareDevice;
+        caps->InputPool = D3DPOOL_SYSTEMMEM;
+        caps->VideoProcessorOperations = DXVA2_VideoProcess_PlanarAlpha | DXVA2_VideoProcess_YUV2RGB |
+                DXVA2_VideoProcess_StretchX | DXVA2_VideoProcess_StretchY | DXVA2_VideoProcess_SubRects |
+                DXVA2_VideoProcess_SubStreams | DXVA2_VideoProcess_SubStreamsExtended | DXVA2_VideoProcess_YUV2RGBExtended;
+    }
+    else
+    {
+        FIXME("Unsupported device %s.\n", debugstr_guid(&processor->device));
+        return E_FAIL;
+    }
+
+    return S_OK;
 }
 
 static HRESULT WINAPI video_processor_GetProcAmpRange(IDirectXVideoProcessor *iface, UINT cap, DXVA2_ValueRange *range)
diff --git a/dlls/dxva2/tests/dxva2.c b/dlls/dxva2/tests/dxva2.c
index ab0a2769bd2..75c23dfdcda 100644
--- a/dlls/dxva2/tests/dxva2.c
+++ b/dlls/dxva2/tests/dxva2.c
@@ -420,17 +420,18 @@ done:
 static void test_video_processor(void)
 {
     IDirectXVideoProcessorService *service, *service2;
-    IDirect3DDevice9 *device;
+    IDirectXVideoProcessor *processor, *processor2;
     IDirect3DDeviceManager9 *manager;
+    DXVA2_VideoProcessorCaps caps;
+    DXVA2_VideoDesc video_desc;
+    IDirect3DDevice9 *device;
     HANDLE handle, handle1;
+    D3DFORMAT format;
     IDirect3D9 *d3d;
     HWND window;
     UINT token;
     HRESULT hr;
-    IDirectXVideoProcessor *processor, *processor2;
-    DXVA2_VideoDesc video_desc;
     GUID guid;
-    D3DFORMAT format;
 
     window = create_window();
     d3d = Direct3DCreate9(D3D_SDK_VERSION);
@@ -466,10 +467,46 @@ static void test_video_processor(void)
     video_desc.SampleHeight = 64;
     video_desc.Format = D3DFMT_A8R8G8B8;
 
+    /* Number of substreams does not include reference stream. */
+    hr = IDirectXVideoProcessorService_CreateVideoProcessor(service, &DXVA2_VideoProcSoftwareDevice, &video_desc,
+            D3DFMT_A8R8G8B8, 16, &processor);
+todo_wine
+    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    if (SUCCEEDED(hr)) IDirectXVideoProcessor_Release(processor);
+
+    hr = IDirectXVideoProcessorService_CreateVideoProcessor(service, &DXVA2_VideoProcSoftwareDevice, &video_desc,
+            D3DFMT_A8R8G8B8, 15, &processor);
+    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    IDirectXVideoProcessor_Release(processor);
+
+    hr = IDirectXVideoProcessorService_CreateVideoProcessor(service, &DXVA2_VideoProcSoftwareDevice, &video_desc,
+            D3DFMT_A8R8G8B8, 0, &processor);
+    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    IDirectXVideoProcessor_Release(processor);
+
     hr = IDirectXVideoProcessorService_CreateVideoProcessor(service, &DXVA2_VideoProcSoftwareDevice, &video_desc,
             D3DFMT_A8R8G8B8, 1, &processor);
     ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
 
+    hr = IDirectXVideoProcessor_GetVideoProcessorCaps(processor, &caps);
+    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(caps.DeviceCaps == DXVA2_VPDev_SoftwareDevice, "Unexpected device type %#x.\n", caps.DeviceCaps);
+    ok(caps.InputPool == D3DPOOL_SYSTEMMEM, "Unexpected input pool %#x.\n", caps.InputPool);
+    ok(!caps.NumForwardRefSamples, "Unexpected sample count.\n");
+    ok(!caps.NumBackwardRefSamples, "Unexpected sample count.\n");
+    ok(!caps.Reserved, "Unexpected field.\n");
+    ok(caps.DeinterlaceTechnology == DXVA2_DeinterlaceTech_Unknown, "Unexpected deinterlace technology %#x.\n",
+            caps.DeinterlaceTechnology);
+    ok(!caps.ProcAmpControlCaps, "Unexpected proc amp mask %#x.\n", caps.ProcAmpControlCaps);
+    ok(caps.VideoProcessorOperations == (DXVA2_VideoProcess_PlanarAlpha | DXVA2_VideoProcess_YUV2RGB |
+            DXVA2_VideoProcess_StretchX | DXVA2_VideoProcess_StretchY | DXVA2_VideoProcess_SubRects |
+            DXVA2_VideoProcess_SubStreams | DXVA2_VideoProcess_SubStreamsExtended | DXVA2_VideoProcess_YUV2RGBExtended),
+            "Unexpected processor operations %#x.\n", caps.VideoProcessorOperations);
+    ok(caps.NoiseFilterTechnology == DXVA2_NoiseFilterTech_Unsupported, "Unexpected noise filter technology %#x.\n",
+            caps.NoiseFilterTechnology);
+    ok(caps.DetailFilterTechnology == DXVA2_DetailFilterTech_Unsupported, "Unexpected detail filter technology %#x.\n",
+            caps.DetailFilterTechnology);
+
     hr = IDirectXVideoProcessorService_CreateVideoProcessor(service, &DXVA2_VideoProcSoftwareDevice, &video_desc,
             D3DFMT_A8R8G8B8, 1, &processor2);
     ok(hr == S_OK, "Unexpected hr %#x.\n", hr);




More information about the wine-cvs mailing list