[vlc-commits] [Git][videolan/vlc][master] 3 commits: build: assume dxgi1_6.h is always available

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Dec 14 08:00:59 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
1fc5b65a by Steve Lhomme at 2024-12-14T07:38:05+00:00
build: assume dxgi1_6.h is always available

It was added in mingw-w64 6 [1] which is the minimum version we support.

[1] https://github.com/mingw-w64/mingw-w64/commit/aa6ab47929a9cac6897f38e630ce0bb88458e288

- - - - -
4b765c3e by Steve Lhomme at 2024-12-14T07:38:05+00:00
build: assume d3d11_4.h is always available

It was added in mingw-w64 6 [1] which is the minimum version we support.

[1] https://github.com/mingw-w64/mingw-w64/commit/aa6ab47929a9cac6897f38e630ce0bb88458e288

- - - - -
4f760827 by Steve Lhomme at 2024-12-14T07:38:05+00:00
build: assume dcomp.h is always available

It was added in mingw-w64 5.0 [1] which is higher than the minimum version we support (6).

[1] https://github.com/mingw-w64/mingw-w64/commit/a0a180cc5242ab64dd0cc278b13bd73ec12f6b80

- - - - -


14 changed files:

- config.h.meson
- configure.ac
- meson.build
- modules/gui/qt/Makefile.am
- modules/gui/qt/maininterface/compositor.cpp
- modules/gui/qt/maininterface/compositor_accessibility.cpp
- modules/gui/qt/maininterface/compositor_dcomp.cpp
- modules/gui/qt/meson.build
- modules/gui/qt/qt.cpp
- modules/video_output/win32/d3d11_quad.cpp
- modules/video_output/win32/d3d11_quad.h
- modules/video_output/win32/direct3d11.cpp
- modules/video_output/win32/dxgi_swapchain.cpp
- modules/video_output/win32/dxgi_swapchain.h


Changes:

=====================================
config.h.meson
=====================================
@@ -107,21 +107,12 @@
 /* Define if the compiler supports typeof. */
 #mesondefine HAVE_CXX_TYPEOF
 
-/* Define to 1 if you have the <d3d11_4.h> header file. */
-#mesondefine HAVE_D3D11_4_H
-
-/* Define to 1 if you have the <dcomp.h> header file. */
-#mesondefine HAVE_DCOMP_H
-
 /* Define to 1 if you have the `dirfd' function. */
 #mesondefine HAVE_DIRFD
 
 /* Define to 1 if you have the `dup3' function. */
 #mesondefine HAVE_DUP3
 
-/* Define to 1 if you have the <dxgi1_6.h> header file. */
-#mesondefine HAVE_DXGI1_6_H
-
 /* Define to 1 if you have the <dxgidebug.h> header file. */
 #mesondefine HAVE_DXGIDEBUG_H
 


=====================================
configure.ac
=====================================
@@ -2761,7 +2761,7 @@ AM_CONDITIONAL([HAVE_AVCODEC_D3D11VA], [test "${have_avcodec_d3d11va}" = "yes"])
 dnl
 dnl DXGI debug
 dnl
-AC_CHECK_HEADERS([dxgidebug.h dxgi1_6.h d3d11_4.h])
+AC_CHECK_HEADERS([dxgidebug.h])
 
 dnl
 dnl IStorageFolder
@@ -2793,19 +2793,6 @@ __x_ABI_CWindows_CStorage_CIApplicationData2 *toto;
 
 AM_CONDITIONAL([HAVE_WINDOWS_STORAGE], [test "${have_iapplication_data2}" = "yes"])
 
-dnl
-dnl DirectComposition
-dnl
-AC_LANG_PUSH([C++])
-AC_CHECK_HEADERS([dcomp.h], [
-    have_dcomp="yes"
-], [], [
-  #include <windows.h>
-])
-AC_LANG_POP([C++])
-AM_CONDITIONAL([HAVE_DCOMP], [test "${have_dcomp}" = "yes"])
-
-
 dnl
 dnl  avformat demuxer/muxer plugin
 dnl


=====================================
meson.build
=====================================
@@ -267,19 +267,13 @@ check_c_headers = [
     ['xlocale.h'],
     ['zlib.h', { 'args' : [contrib_inc_args] }],
     ['wordexp.h'],
-    ['dxgi1_6.h'],
     ['dxgidebug.h'],
-    ['d3d11_4.h'],
     ['GL/wglew.h',
         { 'prefix' : ['#include <windows.h>', '#include <GL/glew.h>'],
           'args' : [contrib_inc_args] }],
 ]
 
-check_cpp_headers = [
-    ['dcomp.h',
-        { 'prefix' : ['#include <windows.h>'],
-          'args' : [contrib_inc_args]}],
-]
+check_cpp_headers = []
 
 foreach header : check_c_headers
     header_kwargs = header.get(1, {})


=====================================
modules/gui/qt/Makefile.am
=====================================
@@ -548,7 +548,6 @@ libqt_plugin_la_SOURCES += \
 nodist_libqt_plugin_la_SOURCES += maininterface/mainctx_win32.moc.cpp \
 	maininterface/compositor_win7.moc.cpp
 
-if HAVE_DCOMP
 libqt_plugin_la_SOURCES += \
 	maininterface/compositor_dcomp.cpp \
 	maininterface/compositor_dcomp.hpp \
@@ -561,7 +560,6 @@ nodist_libqt_plugin_la_SOURCES += \
 	maininterface/compositor_dcomp.moc.cpp
 
 endif
-endif
 
 # X11 compositor
 


=====================================
modules/gui/qt/maininterface/compositor.cpp
=====================================
@@ -26,10 +26,8 @@
 
 #ifdef _WIN32
 #include "mainctx_win32.hpp"
-#ifdef HAVE_DCOMP_H
-#  include "compositor_dcomp.hpp"
-#endif
-#  include "compositor_win7.hpp"
+#include "compositor_dcomp.hpp"
+#include "compositor_win7.hpp"
 #endif
 
 #ifdef QT_HAS_WAYLAND_COMPOSITOR
@@ -59,7 +57,7 @@ struct {
     const char* name;
     Compositor* (*instantiate)(qt_intf_t *p_intf);
 } static compositorList[] = {
-#if defined(_WIN32) && defined(HAVE_DCOMP_H)
+#if defined(_WIN32)
     {"dcomp", &instanciateCompositor<CompositorDirectComposition> },
 #endif
 #if defined(_WIN32) || defined(__APPLE__)


=====================================
modules/gui/qt/maininterface/compositor_accessibility.cpp
=====================================
@@ -32,7 +32,7 @@
 #ifdef QT_HAS_X11_COMPOSITOR
 #  include "compositor_x11_renderwindow.hpp"
 #endif
-#ifdef HAVE_DCOMP_H
+#ifdef _WIN32
 #  include "compositor_dcomp.hpp"
 #endif
 


=====================================
modules/gui/qt/maininterface/compositor_dcomp.cpp
=====================================
@@ -37,8 +37,6 @@
 #include <QtGui/qpa/qplatformnativeinterface.h>
 #include <QtCore/private/qsystemlibrary_p.h>
 
-#if __has_include(<dxgi1_6.h>)
-
 #if __has_include(<d3d11_1.h>)
 #define QRhiD3D11_ACTIVE
 #include <QtGui/private/qrhid3d11_p.h>
@@ -51,8 +49,6 @@
 #endif
 #endif
 
-#endif
-
 #if !defined(QRhiD3D11_ACTIVE) && !defined(QRhiD3D12_ACTIVE)
 #warning "Neither D3D11 nor D3D12 headers are available. compositor_dcomp will not work."
 #endif


=====================================
modules/gui/qt/meson.build
=====================================
@@ -158,13 +158,9 @@ if host_system == 'windows'
     moc_headers += files(
         'maininterface/mainctx_win32.hpp',
         'maininterface/compositor_win7.hpp',
+        'maininterface/compositor_dcomp.hpp',
+        'maininterface/compositor_dcomp_acrylicsurface.hpp',
     )
-    if cdata.has('HAVE_DCOMP_H')
-        moc_headers += files(
-            'maininterface/compositor_dcomp.hpp',
-            'maininterface/compositor_dcomp_acrylicsurface.hpp',
-        )
-    endif
 endif
 
 if (x11_dep.found() and
@@ -511,14 +507,9 @@ if host_system == 'windows'
         'style/windowsthemeprovider.cpp',
         'util/csdmenu_win32.c',
         'util/csdmenu_win32.h',
+        'maininterface/compositor_dcomp.cpp',
+        'maininterface/compositor_dcomp_acrylicsurface.cpp',
     )
-
-    if cdata.has('HAVE_DCOMP_H')
-        some_sources += files(
-            'maininterface/compositor_dcomp.cpp',
-            'maininterface/compositor_dcomp_acrylicsurface.cpp',
-        )
-    endif
 endif
 
 if (x11_dep.found() and


=====================================
modules/gui/qt/qt.cpp
=====================================
@@ -288,9 +288,7 @@ static const char *const psz_raise_list_text[] =
 static const char *const compositor_vlc[] = {
     "auto",
 #ifdef _WIN32
-#ifdef HAVE_DCOMP_H
     "dcomp",
-#endif
     "platform",
     "win7",
 #endif
@@ -305,9 +303,7 @@ static const char *const compositor_vlc[] = {
 static const char *const compositor_user[] = {
     N_("Automatic"),
 #ifdef _WIN32
-#ifdef HAVE_DCOMP_H
     "Direct Composition",
-#endif
     "Platform Composition",
     "Windows 7",
 #endif


=====================================
modules/video_output/win32/d3d11_quad.cpp
=====================================
@@ -376,7 +376,6 @@ void d3d11_quad_t::UpdateViewport(const vout_display_place_t *place, const d3d_f
     }
 }
 
-#ifdef HAVE_D3D11_4_H
 HRESULT D3D11_InitFence(d3d11_device_t & d3d_dev, d3d11_gpu_fence & fence)
 {
     HRESULT hr;
@@ -430,4 +429,3 @@ int D3D11_WaitFence(d3d11_gpu_fence & fence)
     }
     return VLC_ENOTSUP;
 }
-#endif // HAVE_D3D11_4_H


=====================================
modules/video_output/win32/d3d11_quad.h
=====================================
@@ -25,16 +25,13 @@
 
 #include "../../video_chroma/d3d11_fmt.h"
 #include "d3d11_shaders.h"
-#ifdef HAVE_D3D11_4_H
-# include <d3d11_4.h>
-#endif
+#include <d3d11_4.h>
 
 #define PS_CONST_LUMI_BOUNDS 0
 #define VS_CONST_VIEWPOINT   1
 
 typedef bool (*d3d11_select_plane_t)(void *opaque, size_t plane_index, ID3D11RenderTargetView **);
 
-#ifdef HAVE_D3D11_4_H
 struct d3d11_gpu_fence
 {
     Microsoft::WRL::ComPtr<ID3D11Fence>          d3dRenderFence;
@@ -46,7 +43,6 @@ struct d3d11_gpu_fence
 HRESULT D3D11_InitFence(d3d11_device_t &, d3d11_gpu_fence &);
 int D3D11_WaitFence(d3d11_gpu_fence &);
 void D3D11_ReleaseFence(d3d11_gpu_fence &);
-#endif
 
 
 void D3D11_RenderQuad(d3d11_device_t *, d3d11_quad_t *, d3d11_vertex_shader_t *,


=====================================
modules/video_output/win32/direct3d11.cpp
=====================================
@@ -53,9 +53,7 @@
 #include "common.h"
 #include "../../video_chroma/copy.h"
 
-#ifdef HAVE_DXGI1_6_H
-# include <dxgi1_6.h>
-#endif
+#include <dxgi1_6.h>
 
 using Microsoft::WRL::ComPtr;
 
@@ -131,9 +129,7 @@ typedef struct vout_display_sys_t
     d3d_shader_compiler_t    *shaders = nullptr;
     d3d11_quad_t             picQuad = {};
 
-#ifdef HAVE_D3D11_4_H
     d3d11_gpu_fence          fence = {};
-#endif
 
     bool                     use_staging_texture = false;
     picture_sys_d3d11_t      stagingSys = {};
@@ -452,7 +448,6 @@ static void InitTonemapProcessor(vout_display_t *vd, const video_format_t *fmt_i
     if (sys->hdrMode != hdr_Fake)
         return;
 
-#ifdef HAVE_DXGI1_6_H
     { // check the main display is in HDR mode
     HRESULT hr;
 
@@ -485,7 +480,6 @@ static void InitTonemapProcessor(vout_display_t *vd, const video_format_t *fmt_i
         goto error;
     }
     }
-#endif
 
     sys->tonemapProc = D3D11_TonemapperCreate(VLC_OBJECT(vd), sys->d3d_dev, fmt_in);
     if (sys->tonemapProc != NULL)
@@ -566,13 +560,11 @@ static int Open(vout_display_t *vd,
 
         /* use our internal swapchain callbacks */
         dxgi_swapchain *swap = nullptr;
-#if defined(HAVE_DCOMP_H)
         if (vd->cfg->window->type == VLC_WINDOW_TYPE_DCOMP)
             swap = DXGI_CreateLocalSwapchainHandleDComp(VLC_OBJECT(vd),
                                                         vd->cfg->window->display.dcomp_device,
                                                         vd->cfg->window->handle.dcomp_visual);
         else
-#endif //HAVE_DCOMP_H
             swap = DXGI_CreateLocalSwapchainHandleHwnd(VLC_OBJECT(vd), CommonVideoHWND(&sys->area));
         if (unlikely(swap == NULL))
             goto error;
@@ -913,7 +905,6 @@ static void PreparePicture(vout_display_t *vd, picture_t *picture,
         }
     }
 
-#ifdef HAVE_D3D11_4_H
     if (sys->log_level >= 4)
     {
         vlc_tick_t render_start = vlc_tick_now();
@@ -924,7 +915,6 @@ static void PreparePicture(vout_display_t *vd, picture_t *picture,
     {
         D3D11_WaitFence(sys->fence);
     }
-#endif
 }
 
 static void Prepare(vout_display_t *vd, picture_t *picture,
@@ -1470,13 +1460,11 @@ static int Direct3D11CreateGenericResources(vout_display_t *vd)
     vout_display_sys_t *sys = static_cast<vout_display_sys_t *>(vd->sys);
     HRESULT hr;
 
-#ifdef HAVE_D3D11_4_H
     hr = D3D11_InitFence(*sys->d3d_dev, sys->fence);
     if (SUCCEEDED(hr))
     {
         msg_Dbg(vd, "using GPU render fence");
     }
-#endif
 
     ComPtr<ID3D11BlendState> pSpuBlendState;
     D3D11_BLEND_DESC spuBlendDesc = { };
@@ -1593,9 +1581,7 @@ static void Direct3D11DestroyResources(vout_display_t *vd)
     D3D11_ReleaseVertexShader(&sys->flatVShader);
     D3D11_ReleaseVertexShader(&sys->projectionVShader);
 
-#ifdef HAVE_D3D11_4_H
     D3D11_ReleaseFence(sys->fence);
-#endif
 
     msg_Dbg(vd, "Direct3D11 resources destroyed");
 }


=====================================
modules/video_output/win32/dxgi_swapchain.cpp
=====================================
@@ -30,16 +30,12 @@
 #include <vlc_es.h>
 
 #include <windows.h>
-#if defined(HAVE_DCOMP_H)
-# include <dcomp.h>
-#endif
+#include <dcomp.h>
 
 #include <initguid.h>
 #include "dxgi_swapchain.h"
 
-#ifdef HAVE_DXGI1_6_H
-# include <dxgi1_6.h>
-#endif
+#include <dxgi1_6.h>
 
 #include "../../video_chroma/dxgi_fmt.h"
 
@@ -79,12 +75,10 @@ struct dxgi_swapchain
     swapchain_surface_type  swapchainSurfaceType;
     union {
         HWND                hwnd;
-#if defined(HAVE_DCOMP_H)
         struct {
             IDCompositionDevice  *device;
             IDCompositionVisual  *visual;
         } dcomp;
-#endif // HAVE_DCOMP_H
     } swapchainSurface;
 
     ComPtr<IDXGISwapChain1> dxgiswapChain;   /* DXGI 1.2 swap chain */
@@ -134,7 +128,6 @@ static const dxgi_color_space color_spaces[] = {
 #undef DXGIMAP
 };
 
-#ifdef HAVE_DXGI1_6_H
 static bool canHandleConversion(const dxgi_color_space *src, const dxgi_color_space *dst)
 {
     if (src == dst)
@@ -145,7 +138,6 @@ static bool canHandleConversion(const dxgi_color_space *src, const dxgi_color_sp
         return true; /* we can handle anything to 709 */
     return false; /* let Windows do the rest */
 }
-#endif
 
 void DXGI_SelectSwapchainColorspace(dxgi_swapchain *display, const libvlc_video_render_cfg_t *cfg, bool match_display)
 {
@@ -198,7 +190,6 @@ void DXGI_SelectSwapchainColorspace(dxgi_swapchain *display, const libvlc_video_
 
     display->dxgiswapChain.As(&display->dxgiswapChain4);
 
-#ifdef HAVE_DXGI1_6_H
     if (match_display)
     if (SUCCEEDED(display->dxgiswapChain->GetContainingOutput(&dxgiOutput)))
     {
@@ -229,7 +220,6 @@ void DXGI_SelectSwapchainColorspace(dxgi_swapchain *display, const libvlc_video_
             }
         }
     }
-#endif
 
     hr = dxgiswapChain3->SetColorSpace1(color_spaces[best].dxgi);
     if (SUCCEEDED(hr))
@@ -314,7 +304,6 @@ static void DXGI_CreateSwapchainHwnd(dxgi_swapchain *display,
     }
 }
 
-#if defined(HAVE_DCOMP_H)
 static void DXGI_CreateSwapchainDComp(dxgi_swapchain *display,
                                IDXGIAdapter *dxgiadapter, IUnknown *pFactoryDevice,
                                UINT width, UINT height)
@@ -355,7 +344,6 @@ static void DXGI_CreateSwapchainDComp(dxgi_swapchain *display,
         msg_Err(display->obj, "Could not create the SwapChain. (hr=0x%lX)", hr);
     }
 }
-#endif /* HAVE_DCOMP_H */
 
 void DXGI_LocalSwapchainSwap( dxgi_swapchain *display )
 {
@@ -411,7 +399,6 @@ dxgi_swapchain *DXGI_CreateLocalSwapchainHandleHwnd(vlc_object_t *o, HWND hwnd)
     return display;
 }
 
-#if defined(HAVE_DCOMP_H)
 dxgi_swapchain *DXGI_CreateLocalSwapchainHandleDComp(vlc_object_t *o, void* dcompDevice, void* dcompVisual)
 {
     dxgi_swapchain *display = new (std::nothrow) dxgi_swapchain();
@@ -425,7 +412,6 @@ dxgi_swapchain *DXGI_CreateLocalSwapchainHandleDComp(vlc_object_t *o, void* dcom
 
     return display;
 }
-#endif
 
 void DXGI_LocalSwapchainCleanupDevice( dxgi_swapchain *display )
 {
@@ -462,12 +448,10 @@ bool DXGI_UpdateSwapChain( dxgi_swapchain *display, IDXGIAdapter *dxgiadapter,
     {
         display->pixelFormat = newPixelFormat;
 
-#if defined(HAVE_DCOMP_H)
         if (display->swapchainSurfaceType == SWAPCHAIN_SURFACE_DCOMP)
             DXGI_CreateSwapchainDComp(display, dxgiadapter, pFactoryDevice,
                                       width, height);
         else // SWAPCHAIN_TARGET_HWND
-#endif // HAVE_DCOMP_H
             DXGI_CreateSwapchainHwnd(display, dxgiadapter, pFactoryDevice,
                                      width, height);
 


=====================================
modules/video_output/win32/dxgi_swapchain.h
=====================================
@@ -48,11 +48,9 @@ struct dxgi_swapchain;
 
 struct dxgi_swapchain *DXGI_CreateLocalSwapchainHandleHwnd(vlc_object_t *, HWND);
 
-#if defined(HAVE_DCOMP_H)
 struct dxgi_swapchain *DXGI_CreateLocalSwapchainHandleDComp(vlc_object_t *,
                                            void /*IDCompositionDevice*/ * dcompDevice,
                                            void /*IDCompositionVisual*/ * dcompVisual);
-#endif // HAVE_DCOMP_H
 
 Microsoft::WRL::ComPtr<IDXGISwapChain1> & DXGI_GetSwapChain1( struct dxgi_swapchain * );
 Microsoft::WRL::ComPtr<IDXGISwapChain4> & DXGI_GetSwapChain4( struct dxgi_swapchain * );



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b443fb28911d939990db9ec7d0a0ab1282027995...4f760827ccb6163de61adc927501fe398a62534f

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b443fb28911d939990db9ec7d0a0ab1282027995...4f760827ccb6163de61adc927501fe398a62534f
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