[vlc-commits] [Git][videolan/vlc][3.0.x] direct3d11: find a usable IDXGIOutput in UWP
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sat Feb 22 08:38:45 UTC 2025
Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC
Commits:
5c0f4941 by Steve Lhomme at 2025-02-22T08:02:35+00:00
direct3d11: find a usable IDXGIOutput in UWP
GetContainingOutput fails in UWP so we pick any IDXGIOutput for the D3D11 device.
We can't tell where it is in the screen so we most likely get the first display.
Fixes #29039
Co-authored-by: Tung Huynh <tung75605 at gmail.com>
- - - - -
1 changed file:
- modules/video_output/win32/direct3d11.c
Changes:
=====================================
modules/video_output/win32/direct3d11.c
=====================================
@@ -1300,6 +1300,29 @@ static bool canHandleConversion(const dxgi_color_space *src, const dxgi_color_sp
}
#endif
+static IDXGIOutput *GetDXGIOutput(IDXGISwapChain1 *dxgiswapChain, d3d11_device_t *d3d_dev)
+{
+ IDXGIOutput *dxgiOutput = NULL;
+ if (FAILED(IDXGISwapChain_GetContainingOutput( dxgiswapChain, &dxgiOutput )))
+ {
+ // GetContainingOutput fails in UWP
+ IDXGIAdapter *dxgiadapter = D3D11DeviceAdapter(d3d_dev->d3ddevice);
+ if (likely(dxgiadapter!=NULL)) {
+ // Get the first usable output (monitor)
+ for (UINT adapter=0;;adapter++)
+ {
+ HRESULT hr = IDXGIAdapter_EnumOutputs(dxgiadapter, adapter, &dxgiOutput);
+ if (SUCCEEDED(hr))
+ break;
+ if (hr == DXGI_ERROR_NOT_FOUND) // no more adapters
+ break;
+ }
+ IDXGIAdapter_Release(dxgiadapter);
+ }
+ }
+ return dxgiOutput;
+}
+
static void D3D11SetColorSpace(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
@@ -1371,7 +1394,7 @@ static void D3D11SetColorSpace(vout_display_t *vd)
#ifdef HAVE_DXGI1_6_H
if (sys->hdrMode == hdr_Auto || sys->hdrMode == hdr_Fake) // match the screen
- if (SUCCEEDED(IDXGISwapChain_GetContainingOutput( sys->dxgiswapChain, &dxgiOutput )))
+ if ((dxgiOutput = GetDXGIOutput( sys->dxgiswapChain, &sys->d3d_dev )) != NULL)
{
IDXGIOutput6 *dxgiOutput6 = NULL;
if (SUCCEEDED(IDXGIOutput_QueryInterface( dxgiOutput, &IID_IDXGIOutput6, (void **)&dxgiOutput6 )))
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/5c0f49410deab34af4f37a1327aeb51d9ac007a7
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/5c0f49410deab34af4f37a1327aeb51d9ac007a7
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