[vlc-commits] [Git][videolan/vlc][master] 3 commits: dxgi_swapchain: remove unused DXGI_GetSwapChain4()

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Thu Oct 29 16:53:36 UTC 2026



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
4f968ed9 by Steve Lhomme at 2026-10-29T17:29:09+01:00
dxgi_swapchain: remove unused DXGI_GetSwapChain4()

- - - - -
9e194bc0 by Steve Lhomme at 2026-10-29T17:29:09+01:00
dxgi_swapchain: use a temporary object to send HDR metadata

No need to keep a reference if we're not even going to use HDR.

- - - - -
9f393e57 by Steve Lhomme at 2026-10-29T17:29:09+01:00
d3d11_surface: remove legacy mingw-w64 check

VideoProcessorBlt() was added in mingw-w64 v5 and we require version 8.

- - - - -


3 changed files:

- modules/hw/d3d11/d3d11_surface.c
- modules/video_output/win32/dxgi_swapchain.cpp
- modules/video_output/win32/dxgi_swapchain.h


Changes:

=====================================
modules/hw/d3d11/d3d11_surface.c
=====================================
@@ -44,12 +44,6 @@
 #include "d3d11_processor.h"
 #include "../../video_chroma/d3d11_fmt.h"
 
-#ifdef ID3D11VideoContext_VideoProcessorBlt
-#define CAN_PROCESSOR 1
-#else
-#define CAN_PROCESSOR 0
-#endif
-
 typedef struct
 {
     copy_cache_t     cache;
@@ -59,7 +53,6 @@ typedef struct
     };
     vlc_mutex_t      staging_lock;
 
-#if CAN_PROCESSOR
     union {
         ID3D11Texture2D  *procOutTexture;
         ID3D11Resource   *procOutResource;
@@ -67,7 +60,6 @@ typedef struct
     /* 420_OPAQUE processor */
     ID3D11VideoProcessorOutputView *processorOutput;
     d3d11_processor_t              d3d_proc;
-#endif
     d3d11_device_t                 *d3d_dev;
 
     /* CPU to GPU */
@@ -75,7 +67,6 @@ typedef struct
     picture_t  *staging_pic;
 } filter_sys_t;
 
-#if CAN_PROCESSOR
 static int SetupProcessor(filter_t *p_filter, d3d11_device_t *d3d_dev,
                           DXGI_FORMAT srcFormat, DXGI_FORMAT dstFormat)
 {
@@ -140,7 +131,6 @@ error:
     d3d11_device_unlock(d3d_dev);
     return VLC_EGENERIC;
 }
-#endif
 
 static HRESULT can_map(filter_sys_t *sys, ID3D11DeviceContext *context)
 {
@@ -190,7 +180,6 @@ static int assert_staging(filter_t *p_filter, filter_sys_t *sys,
                 DxgiFormatToStr(texDesc.Format), (const char*)&cpu_chroma);
         hr = E_FAIL;
     }
-#if CAN_PROCESSOR
     if (FAILED(hr)) {
         /* convert to the exact layout the CPU copy reads, any other one would
          * be interpreted with the wrong pitches or bit depth */
@@ -234,7 +223,6 @@ static int assert_staging(filter_t *p_filter, filter_sys_t *sys,
             }
         }
     }
-#endif
     if (FAILED(hr)) {
         msg_Err(p_filter, "Failed to create a %s staging texture to extract surface pixels (hr=0x%lX)", DxgiFormatToStr(texDesc.Format), hr );
         return VLC_EGENERIC;
@@ -262,7 +250,6 @@ static void D3D11_YUY2(filter_t *p_filter, picture_t *src, picture_t *dst)
     UINT srcSlice = p_sys->slice_index;
     ID3D11Resource *srcResource = p_sys->resource[KNOWN_DXGI_INDEX];
 
-#if CAN_PROCESSOR
     if (sys->d3d_proc.procEnumerator)
     {
         HRESULT hr;
@@ -289,7 +276,6 @@ static void D3D11_YUY2(filter_t *p_filter, picture_t *src, picture_t *dst)
         srcResource = sys->procOutResource;
         srcSlice = 0;
     }
-#endif
     ID3D11DeviceContext_CopySubresourceRegion(sys->d3d_dev->d3dcontext, sys->staging_resource,
                                               0, 0, 0, 0,
                                               srcResource,
@@ -359,7 +345,6 @@ static void D3D11_NV12(filter_t *p_filter, picture_t *src, picture_t *dst)
     UINT srcSlice = p_sys->slice_index;
     ID3D11Resource *srcResource = p_sys->resource[KNOWN_DXGI_INDEX];
 
-#if CAN_PROCESSOR
     if (sys->d3d_proc.procEnumerator)
     {
         HRESULT hr;
@@ -386,7 +371,6 @@ static void D3D11_NV12(filter_t *p_filter, picture_t *src, picture_t *dst)
         srcResource = sys->procOutResource;
         srcSlice = 0;
     }
-#endif
     ID3D11DeviceContext_CopySubresourceRegion(sys->d3d_dev->d3dcontext, sys->staging_resource,
                                               0, 0, 0, 0,
                                               srcResource,
@@ -602,11 +586,9 @@ static void NV12_D3D11(filter_t *p_filter, picture_t *src, picture_t *dst)
 static void D3D11CloseConverter( filter_t *p_filter )
 {
     filter_sys_t *p_sys = p_filter->p_sys;
-#if CAN_PROCESSOR
     if (p_sys->procOutTexture)
         ID3D11Texture2D_Release(p_sys->procOutTexture);
     D3D11_ReleaseProcessor( &p_sys->d3d_proc );
-#endif
     CopyCleanCache(&p_sys->cache);
     if (p_sys->staging)
         ID3D11Texture2D_Release(p_sys->staging);


=====================================
modules/video_output/win32/dxgi_swapchain.cpp
=====================================
@@ -82,7 +82,6 @@ struct dxgi_swapchain
     } swapchainSurface;
 
     ComPtr<IDXGISwapChain1> dxgiswapChain;   /* DXGI 1.2 swap chain */
-    ComPtr<IDXGISwapChain4> dxgiswapChain4;  /* DXGI 1.5 for HDR metadata */
     bool                    send_metadata;
     DXGI_HDR_METADATA_HDR10 hdr10;
 
@@ -188,8 +187,6 @@ void DXGI_SelectSwapchainColorspace(dxgi_swapchain *display, const libvlc_video_
         msg_Warn(display->obj, "no matching colorspace found force %s", color_spaces[best].name);
     }
 
-    display->dxgiswapChain.As(&display->dxgiswapChain4);
-
     if (match_display)
     if (SUCCEEDED(display->dxgiswapChain->GetContainingOutput(&dxgiOutput)))
     {
@@ -369,8 +366,12 @@ void DXGI_LocalSwapchainSetMetadata( dxgi_swapchain *display, libvlc_video_metad
 {
     assert(type == libvlc_video_metadata_frame_hdr10);
     if ( type == libvlc_video_metadata_frame_hdr10 && metadata &&
-         display->send_metadata && display->dxgiswapChain4.Get() )
+         display->send_metadata )
     {
+        ComPtr<IDXGISwapChain4> dxgiswapChain4;  /* DXGI 1.5 for HDR metadata */
+        if ( FAILED(display->dxgiswapChain.As(&dxgiswapChain4)) )
+            return;
+
         const libvlc_video_frame_hdr10_metadata_t *p_hdr10 = static_cast<const libvlc_video_frame_hdr10_metadata_t *>(metadata);
         DXGI_HDR_METADATA_HDR10 hdr10 = { };
         hdr10.GreenPrimary[0] = p_hdr10->GreenPrimary[0];
@@ -388,7 +389,7 @@ void DXGI_LocalSwapchainSetMetadata( dxgi_swapchain *display, libvlc_video_metad
         if (memcmp(&display->hdr10, &hdr10, sizeof(hdr10)))
         {
             memcpy(&display->hdr10, &hdr10, sizeof(hdr10));
-            display->dxgiswapChain4->SetHDRMetaData(DXGI_HDR_METADATA_TYPE_HDR10,
+            dxgiswapChain4->SetHDRMetaData(DXGI_HDR_METADATA_TYPE_HDR10,
                                             sizeof( &display->hdr10 ), &display->hdr10 );
         }
     }
@@ -485,11 +486,6 @@ Microsoft::WRL::ComPtr<IDXGISwapChain1> & DXGI_GetSwapChain1( dxgi_swapchain *di
     return display->dxgiswapChain;
 }
 
-Microsoft::WRL::ComPtr<IDXGISwapChain4> & DXGI_GetSwapChain4( dxgi_swapchain *display )
-{
-    return display->dxgiswapChain4;
-}
-
 const d3d_format_t  *DXGI_GetPixelFormat( dxgi_swapchain *display )
 {
     return display->pixelFormat;


=====================================
modules/video_output/win32/dxgi_swapchain.h
=====================================
@@ -53,7 +53,6 @@ struct dxgi_swapchain *DXGI_CreateLocalSwapchainHandleDComp(vlc_object_t *,
                                            void /*IDCompositionVisual*/ * dcompVisual);
 
 Microsoft::WRL::ComPtr<IDXGISwapChain1> & DXGI_GetSwapChain1( struct dxgi_swapchain * );
-Microsoft::WRL::ComPtr<IDXGISwapChain4> & DXGI_GetSwapChain4( struct dxgi_swapchain * );
 const d3d_format_t  *DXGI_GetPixelFormat( struct dxgi_swapchain * );
 
 void DXGI_SelectSwapchainColorspace( struct dxgi_swapchain *, const libvlc_video_render_cfg_t *, bool match_display );



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/86262aaceebf24429db5a5bd759c17b7434b8498...9f393e57191f4ca9a24f3eca873f88e2b73ac027

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/86262aaceebf24429db5a5bd759c17b7434b8498...9f393e57191f4ca9a24f3eca873f88e2b73ac027
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list