[vlc-commits] [Git][videolan/vlc][3.0.x] 2 commits: d3d11_scaler: select the output format with D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_OUTPUT

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Mon Feb 26 15:20:28 UTC 2024



Jean-Baptiste Kempf pushed to branch 3.0.x at VideoLAN / VLC


Commits:
3caa45bc by Steve Lhomme at 2024-02-26T15:06:14+00:00
d3d11_scaler: select the output format with D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_OUTPUT

The selected format is used for output, not input.

(cherry picked from commit 6e47593b22bee9ffc2535e90741561dbe31c5124) (rebased)
rebased:
- the FindD3D11Format call is different on 3.0
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
f3d178c2 by Steve Lhomme at 2024-02-26T15:06:14+00:00
d3d11_scaler: detect if NVIDIA upscaler is available

We only need to check is super resolution is used.

(cherry picked from commit 2ccd91d9b296e435dcb1b20759071bfdaacca04d)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -


1 changed file:

- modules/video_output/win32/d3d11_scaler.cpp


Changes:

=====================================
modules/video_output/win32/d3d11_scaler.cpp
=====================================
@@ -65,7 +65,7 @@ struct d3d11_scaler
 
 static const d3d_format_t *GetDirectRenderingFormat(vlc_object_t *vd, d3d11_device_t *d3d_dev, vlc_fourcc_t i_src_chroma)
 {
-    UINT supportFlags = D3D11_FORMAT_SUPPORT_SHADER_LOAD | D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_INPUT;
+    UINT supportFlags = D3D11_FORMAT_SUPPORT_SHADER_LOAD | D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_OUTPUT;
     return (FindD3D11Format)( vd, d3d_dev, i_src_chroma, false, 0, 0, 0, is_d3d11_opaque(i_src_chroma), supportFlags );
 }
 
@@ -83,12 +83,50 @@ d3d11_scaler *D3D11_UpscalerCreate(vlc_object_t *vd, d3d11_device_t *d3d_dev, vl
     struct vlc_amf_context amf = {};
     amf::AMFComponent *amf_scaler = nullptr;
 #endif
+    if (super_res)
+    {
     // NVIDIA 530+ driver
     if (d3d_dev->adapterDesc.VendorId == GPU_MANUFACTURER_NVIDIA &&
         (d3d_dev->WDDM.revision * 10000 + d3d_dev->WDDM.build) > 153000)
     {
-        // TODO refine which GPU can do it
-        canProcess = true;
+        constexpr GUID kNvidiaPPEInterfaceGUID{ 0xd43ce1b3, 0x1f4b, 0x48ac, {0xba, 0xee, 0xc3, 0xc2, 0x53, 0x75, 0xe6, 0xf7} };
+        HRESULT hr;
+        UINT available = 0;
+        D3D11_VIDEO_PROCESSOR_CONTENT_DESC processorDesc{};
+
+        ComPtr<ID3D11VideoContext>              d3dvidctx;
+        ComPtr<ID3D11VideoDevice>               d3dviddev;
+        ComPtr<ID3D11VideoProcessorEnumerator>  enumerator;
+        ComPtr<ID3D11VideoProcessor>            processor;
+
+        d3d11_device_lock(d3d_dev);
+        hr = d3d_dev->d3dcontext->QueryInterface(IID_GRAPHICS_PPV_ARGS(&d3dvidctx));
+        if (unlikely(FAILED(hr)))
+            goto checked;
+        hr = d3d_dev->d3ddevice->QueryInterface(IID_GRAPHICS_PPV_ARGS(&d3dviddev));
+        if (unlikely(FAILED(hr)))
+            goto checked;
+
+        processorDesc.InputFrameFormat = D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE;
+        processorDesc.InputFrameRate = { 1, 25 };
+        processorDesc.InputWidth   = 1280;
+        processorDesc.InputHeight  = 720;
+        processorDesc.OutputWidth  = 1920;
+        processorDesc.OutputHeight = 1080;
+        processorDesc.OutputFrameRate = { 1, 25 };
+        processorDesc.Usage = D3D11_VIDEO_USAGE_PLAYBACK_NORMAL;
+        hr = d3dviddev->CreateVideoProcessorEnumerator(&processorDesc, &enumerator);
+        if (unlikely(FAILED(hr)))
+            goto checked;
+        hr = d3dviddev->CreateVideoProcessor(enumerator.Get(), 0, &processor);
+        if (unlikely(FAILED(hr)))
+            goto checked;
+
+        hr = d3dvidctx->VideoProcessorGetStreamExtension(processor.Get(),
+                    0, &kNvidiaPPEInterfaceGUID, sizeof(available), &available);
+        d3d11_device_unlock(d3d_dev);
+checked:
+        canProcess = available != 0;
     }
     else if (d3d_dev->adapterDesc.VendorId == GPU_MANUFACTURER_INTEL)
     {
@@ -96,7 +134,7 @@ d3d11_scaler *D3D11_UpscalerCreate(vlc_object_t *vd, d3d11_device_t *d3d_dev, vl
         canProcess = true;
     }
 #ifdef HAVE_AMF_SCALER
-    else if (d3d_dev->adapterDesc.VendorId == GPU_MANUFACTURER_AMD && !canProcess)
+    else if (d3d_dev->adapterDesc.VendorId == GPU_MANUFACTURER_AMD)
     {
         int res = vlc_AMFCreateContext(&amf);
         if (res == VLC_SUCCESS)
@@ -110,6 +148,7 @@ d3d11_scaler *D3D11_UpscalerCreate(vlc_object_t *vd, d3d11_device_t *d3d_dev, vl
         }
     }
 #endif
+    }
 
     d3d11_scaler *scaleProc = nullptr;
     const d3d_format_t *fmt = nullptr;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/81ed74ad51d1f3c80818d9553c60021dada95afb...f3d178c2f0788da6c6cc2352d39c5f66f8e75d25

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/81ed74ad51d1f3c80818d9553c60021dada95afb...f3d178c2f0788da6c6cc2352d39c5f66f8e75d25
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list