[vlc-commits] [Git][videolan/vlc][master] contrib: qtbase: add patch to not use `DXGI_SWAP_EFFECT_FLIP_DISCARD` on Windows 8

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed May 20 16:08:05 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
a30c922a by Fatih Uzunoglu at 2026-05-20T15:15:49+00:00
contrib: qtbase: add patch to not use `DXGI_SWAP_EFFECT_FLIP_DISCARD` on Windows 8

This fixes rhi d3d11 not being available on Windows 8. Instead of using legacy
swapchain model, this has the advantage of making `CompositorDirectComposition`
being available on Windows 8 (since with the legacy swapchain model Qt does not
use Direct Composition).

I have tested this patch on up-to-date Windows 8.1.

- - - - -


2 changed files:

- + contrib/src/qt/0001-rhi-d3d11-Use-DXGI_SWAP_EFFECT_FLIP_DISCARD-only-on-.patch
- contrib/src/qt/rules.mak


Changes:

=====================================
contrib/src/qt/0001-rhi-d3d11-Use-DXGI_SWAP_EFFECT_FLIP_DISCARD-only-on-.patch
=====================================
@@ -0,0 +1,44 @@
+From 9084d185fa110b17633e520fbb90906a3bdbf0ee Mon Sep 17 00:00:00 2001
+From: Fatih Uzunoglu <fuzun54 at outlook.com>
+Date: Sun, 5 Apr 2026 19:05:07 +0300
+Subject: [PATCH] rhi: d3d11: Use `DXGI_SWAP_EFFECT_FLIP_DISCARD` only on
+ Windows 10 and above
+
+According to Microsoft's documentation [1], flip discard is only
+available starting with Windows 10. However, we can simply use
+flip sequential instead.
+
+The difference is explained that the back buffer would be discarded
+when present is called, while with sequential it is preserved.
+
+[1] https://learn.microsoft.com/en-us/windows/win32/api/dxgi/ne-dxgi-dxgi_swap_effect
+---
+ src/gui/rhi/qrhid3d11.cpp | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp
+index 9a0b5721abc..5053559959f 100644
+--- a/src/gui/rhi/qrhid3d11.cpp
++++ b/src/gui/rhi/qrhid3d11.cpp
+@@ -7,6 +7,7 @@
+ #include <QWindow>
+ #include <qmath.h>
+ #include <QtCore/qcryptographichash.h>
++#include <QtCore/qoperatingsystemversion.h>
+ #include <QtCore/private/qsystemerror_p.h>
+ #include <QtCore/private/qsystemlibrary_p.h>
+ #include "qrhid3dhelpers_p.h"
+@@ -5219,7 +5220,9 @@ bool QD3D11SwapChain::createOrResize()
+         desc.BufferCount = BUFFER_COUNT;
+         desc.Flags = swapChainFlags;
+         desc.Scaling = rhiD->useLegacySwapchainModel ? DXGI_SCALING_STRETCH : DXGI_SCALING_NONE;
+-        desc.SwapEffect = rhiD->useLegacySwapchainModel ? DXGI_SWAP_EFFECT_DISCARD : DXGI_SWAP_EFFECT_FLIP_DISCARD;
++        desc.SwapEffect = rhiD->useLegacySwapchainModel ? DXGI_SWAP_EFFECT_DISCARD
++                                                        : ((QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows10) ? DXGI_SWAP_EFFECT_FLIP_DISCARD
++                                                                                                                                      : DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL);
+         desc.Stereo = stereo;
+ 
+         if (dcompVisual) {
+-- 
+2.53.0
+


=====================================
contrib/src/qt/rules.mak
=====================================
@@ -57,6 +57,7 @@ qt: qtbase-everywhere-src-$(QTBASE_VERSION_FULL).tar.xz .sum-qt
 	$(APPLY) $(SRC)/qt/0001-WIP-Core-Add-operator-to-our-bidirectional-meta-iter.patch
 	$(APPLY) $(SRC)/qt/0001-macos-guard-text-html.patch
 	$(APPLY) $(SRC)/qt/0001-QEventDispatcherWin32-treat-posted-events-fairly.patch
+	$(APPLY) $(SRC)/qt/0001-rhi-d3d11-Use-DXGI_SWAP_EFFECT_FLIP_DISCARD-only-on-.patch
 	$(MOVE)
 
 ifdef HAVE_WIN32



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/a30c922a9f3519e77f67d70951a62e11670530c4

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