[vlc-commits] [Git][videolan/vlc][master] 4 commits: qt: dcomp: do not wait for backdrop effect fallback to signal readiness

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Jun 23 14:04:55 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
69189df4 by Fatih Uzunoglu at 2026-06-23T12:52:51+00:00
qt: dcomp: do not wait for backdrop effect fallback to signal readiness

This can improve the starting time* on Windows 10 where dwm native
backdrop effect is not available, when VLC starts with input video.

(*) starting time is defined as the time it takes to start playing
the input file.

- - - - -
c0a3986b by Fatih Uzunoglu at 2026-06-23T12:52:51+00:00
qt: dcomp: do not wait for device commit to signal readiness

- - - - -
8d8a9421 by Fatih Uzunoglu at 2026-06-23T12:52:51+00:00
qt: dcomp: reorder dcomp availability probing in `::init()`.

- - - - -
d735affe by Fatih Uzunoglu at 2026-06-23T12:52:51+00:00
qt: dcomp: asynchronously initialize fallback backdrop effect

Unlike the native effect, initialization of the fallback effect
is expensive, so it makes sense to initialize it asynchronously.

- - - - -


1 changed file:

- modules/gui/qt/maininterface/compositor_dcomp.cpp


Changes:

=====================================
modules/gui/qt/maininterface/compositor_dcomp.cpp
=====================================
@@ -119,27 +119,6 @@ bool CompositorDirectComposition::init()
             return false;
     }
 
-    std::unique_ptr<std::remove_pointer_t<HMODULE>, BOOL WINAPI (*)(HMODULE)>
-        dcomplib(::LoadLibraryEx(TEXT("dcomp.dll"), nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32), ::FreeLibrary);
-
-    typedef HRESULT (__stdcall *DCompositionCreateDeviceFuncPtr)(
-        _In_opt_ IDXGIDevice *dxgiDevice,
-        _In_ REFIID iid,
-        _Outptr_ void **dcompositionDevice);
-    DCompositionCreateDeviceFuncPtr func = nullptr;
-    if (dcomplib)
-    {
-        func = reinterpret_cast<DCompositionCreateDeviceFuncPtr>(
-            GetProcAddress(dcomplib.get(), "DCompositionCreateDevice"));
-    }
-
-    Microsoft::WRL::ComPtr<IDCompositionDevice> device;
-    if (!func || FAILED(func(nullptr, IID_PPV_ARGS(&device))))
-    {
-        msg_Warn(m_intf, "Can not create DCompositionDevice. CompositorDirectComposition will not work.");
-        return false;
-    }
-
     QString sceneGraphBackend = qEnvironmentVariable("QT_QUICK_BACKEND");
     if (!sceneGraphBackend.isEmpty() /* if empty, RHI is used */ &&
         sceneGraphBackend != QLatin1String("rhi"))
@@ -177,6 +156,27 @@ bool CompositorDirectComposition::init()
         return false;
     }
 
+    std::unique_ptr<std::remove_pointer_t<HMODULE>, BOOL WINAPI (*)(HMODULE)>
+        dcomplib(::LoadLibraryEx(TEXT("dcomp.dll"), nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32), ::FreeLibrary);
+
+    typedef HRESULT (__stdcall *DCompositionCreateDeviceFuncPtr)(
+        _In_opt_ IDXGIDevice *dxgiDevice,
+        _In_ REFIID iid,
+        _Outptr_ void **dcompositionDevice);
+    DCompositionCreateDeviceFuncPtr func = nullptr;
+    if (dcomplib)
+    {
+        func = reinterpret_cast<DCompositionCreateDeviceFuncPtr>(
+            GetProcAddress(dcomplib.get(), "DCompositionCreateDevice"));
+    }
+
+    Microsoft::WRL::ComPtr<IDCompositionDevice> device;
+    if (!func || FAILED(func(nullptr, IID_PPV_ARGS(&device))))
+    {
+        msg_Warn(m_intf, "Can not create DCompositionDevice. CompositorDirectComposition will not work.");
+        return false;
+    }
+
     return true;
 }
 
@@ -231,29 +231,34 @@ void CompositorDirectComposition::setup()
     res = m_rootVisual->AddVisual(m_uiVisual, FALSE, NULL);
     assert(res == S_OK);
 
+    {
+        QMutexLocker lock(&m_setupStateLock);
+        m_setupState = SetupState::Success;
+        m_setupStateCond.notify_all();
+    }
+
     m_dcompDevice->Commit();
 
     if (!m_mainCtx->hasAcrylicSurface())
     {
         if (var_InheritBool(m_intf, "qt-backdrop-blur"))
         {
-            try
-            {
-                m_acrylicSurface = std::make_unique<CompositorDCompositionAcrylicSurface>(m_intf, this, m_mainCtx, m_dcompDevice);
-            }
-            catch (const std::exception& exception)
-            {
-                if (const auto what = exception.what())
-                    msg_Warn(m_intf, "%s", what);
-            }
+            QMetaObject::invokeMethod(this, [this]() {
+                if (Q_UNLIKELY(!m_dcompDevice || !interfaceMainWindow()))
+                    return;
+
+                try
+                {
+                    m_acrylicSurface = std::make_unique<CompositorDCompositionAcrylicSurface>(m_intf, this, m_mainCtx, m_dcompDevice);
+                }
+                catch (const std::exception& exception)
+                {
+                    if (const auto what = exception.what())
+                        msg_Warn(m_intf, "%s", what);
+                }
+            }, Qt::QueuedConnection);
         }
     }
-
-    {
-        QMutexLocker lock(&m_setupStateLock);
-        m_setupState = SetupState::Success;
-        m_setupStateCond.notify_all();
-    }
 }
 
 void CompositorDirectComposition::cleanup()



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a83a803dc3a0e1dbf7a11dc237653e03533fa3af...d735affe9b8e3a3d8e23390588b79fe1c9e82518

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