[vlc-commits] [Git][videolan/vlc][master] 10 commits: vlc_tick: include vlc_common to get VLC_API

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sun Mar 17 23:43:28 UTC 2024



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


Commits:
e6f6390b by Steve Lhomme at 2024-03-17T17:05:54+00:00
vlc_tick: include vlc_common to get VLC_API

- - - - -
622450a1 by Steve Lhomme at 2024-03-17T17:05:54+00:00
d3d11_swapchain: fix RGB with alpha selection

We don't need any alpha, so any value will do. Otherwise RGB10A2 can't be selected.

- - - - -
f5af7cd1 by Steve Lhomme at 2024-03-17T17:05:54+00:00
direct3d11: assume VLC_CODEC_RGBA10LE use 10 bits

It can't be deduced with the current chroma description.

- - - - -
52aecbb7 by Steve Lhomme at 2024-03-17T17:05:54+00:00
direct3d11: use proper initializer for internal structure

- - - - -
c462263f by Steve Lhomme at 2024-03-17T17:05:54+00:00
direct3d11: use d3d format width/height denominator to tell if a texture needs padding

- - - - -
90a08835 by Steve Lhomme at 2024-03-17T17:05:54+00:00
direct3d11: use a function to select the output format

This avoids a bit of indentation and makes it clearer what the goal of the code block is.

- - - - -
e654267d by Steve Lhomme at 2024-03-17T17:05:54+00:00
direct3d11: add an option to select the HDR output mode

- - - - -
9fb4b706 by Steve Lhomme at 2024-03-17T17:05:54+00:00
d3d11: add a VideoProcessor to handle tone mapping

- - - - -
ccf432ff by Steve Lhomme at 2024-03-17T17:05:54+00:00
direct3d11: allow setting the quad_fmt differently than the decoder format

- - - - -
1da233f1 by Steve Lhomme at 2024-03-17T17:05:54+00:00
direct3d11: add an option to force HDR output from SDR source

- - - - -


10 changed files:

- include/vlc_tick.h
- modules/video_output/Makefile.am
- modules/video_output/win32/d3d11_shaders.h
- modules/video_output/win32/d3d11_swapchain.cpp
- + modules/video_output/win32/d3d11_tonemap.cpp
- + modules/video_output/win32/d3d11_tonemap.h
- modules/video_output/win32/direct3d11.cpp
- modules/video_output/win32/dxgi_swapchain.cpp
- modules/video_output/win32/dxgi_swapchain.h
- modules/video_output/win32/meson.build


Changes:

=====================================
include/vlc_tick.h
=====================================
@@ -32,6 +32,7 @@
 struct timespec;
 
 #include <vlc_config.h>
+#include <vlc_common.h>
 
 /**
  * High precision date or time interval
@@ -307,7 +308,7 @@ VLC_API vlc_tick_t date_Decrement(date_t *restrict date, uint32_t count);
 
 /**
  * Gets the current wallclock time as 64-bit NTP timestamp.
- * 
+ *
  * \return NTP 64-bits timestamp in host byte order
  */
 VLC_API uint64_t vlc_ntp_time( void );


=====================================
modules/video_output/Makefile.am
=====================================
@@ -201,6 +201,7 @@ libdirect3d11_plugin_la_SOURCES = video_output/win32/direct3d11.cpp \
  video_output/win32/d3d11_quad.cpp video_output/win32/d3d11_quad.h \
  video_output/win32/d3d11_scaler.cpp video_output/win32/d3d11_scaler.h \
  video_output/win32/d3d11_shaders.cpp video_output/win32/d3d11_shaders.h \
+ video_output/win32/d3d11_tonemap.cpp video_output/win32/d3d11_tonemap.h \
  video_output/win32/d3d_shaders.c video_output/win32/d3d_shaders.h \
  video_output/win32/d3d_dynamic_shader.c video_output/win32/d3d_dynamic_shader.h \
  video_output/win32/common.c video_output/win32/common.h


=====================================
modules/video_output/win32/d3d11_shaders.h
=====================================
@@ -95,4 +95,27 @@ void D3D11_ClearRenderTargets(d3d11_device_t *, const d3d_format_t *,
 
 void D3D11_ReleaseVertexShader(d3d11_vertex_shader_t *);
 
+enum d3d11_hdr
+{
+    hdr_Auto,
+    hdr_Never,
+    hdr_Always,
+    hdr_Fake,
+};
+
+static inline enum d3d11_hdr HdrModeFromString(vlc_logger *logger, const char *psz_hdr)
+{
+    if (strcmp("auto", psz_hdr) == 0)
+        return hdr_Auto;
+    if (strcmp("never", psz_hdr) == 0)
+        return hdr_Never;
+    if (strcmp("always", psz_hdr) == 0)
+        return hdr_Always;
+    if (strcmp("generate", psz_hdr) == 0)
+        return hdr_Fake;
+
+    vlc_warning(logger, "unknown HDR mode %s, using auto mode", psz_hdr);
+    return hdr_Auto;
+}
+
 #endif /* VLC_D3D11_SHADERS_H */


=====================================
modules/video_output/win32/d3d11_swapchain.cpp
=====================================
@@ -90,7 +90,7 @@ static bool UpdateSwapchain( d3d11_local_swapchain *display, const libvlc_video_
         // try with alpha
         newPixelFormat = FindD3D11Format( display->obj, display->d3d_dev, 0, DXGI_RGB_FORMAT,
                                         cfg->bitdepth > 8 ? 10 : 8,
-                                        0, 0, 8,
+                                        0, 0, 1,
                                         DXGI_CHROMA_CPU, D3D11_FORMAT_SUPPORT_DISPLAY );
     if (unlikely(newPixelFormat == NULL))
         // try YUV without alpha
@@ -114,7 +114,12 @@ static bool UpdateSwapchain( d3d11_local_swapchain *display, const libvlc_video_
         return false;
     }
 
-    if (!DXGI_UpdateSwapChain( display->sys, dxgiadapter.Get(), display->d3d_dev->d3ddevice, newPixelFormat, cfg ))
+    char *psz_hdr = var_InheritString(display->obj, "d3d11-hdr-mode");
+    auto hdrMode = HdrModeFromString(vlc_object_logger(display->obj), psz_hdr);
+    free(psz_hdr);
+
+    if (!DXGI_UpdateSwapChain( display->sys, dxgiadapter.Get(), display->d3d_dev->d3ddevice,
+                               newPixelFormat, cfg, hdrMode == hdr_Auto ))
         return false;
 
     ComPtr<ID3D11Resource> pBackBuffer;


=====================================
modules/video_output/win32/d3d11_tonemap.cpp
=====================================
@@ -0,0 +1,266 @@
+// SPDX-License-Identifier: LGPL-2.1-or-later
+/*****************************************************************************
+ * d3d11_tonemap: Direct3D11 VideoProcessor to handle tonemapping
+ *****************************************************************************
+ * Copyright © 2024 Videolabs, VLC authors and VideoLAN
+ *
+ * Authors: Steve Lhomme <robux4 at videolabs.io>
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "d3d11_tonemap.h"
+
+#include <cassert>
+
+#include <wrl/client.h>
+using Microsoft::WRL::ComPtr;
+
+struct d3d11_tonemapper
+{
+    ComPtr<ID3D11VideoDevice>               d3dviddev;
+    ComPtr<ID3D11VideoContext>              d3dvidctx;
+    ComPtr<ID3D11VideoProcessorEnumerator>  enumerator;
+    ComPtr<ID3D11VideoProcessor>            processor;
+
+    ComPtr<ID3D11VideoProcessorOutputView>  outputView;
+    ComPtr<ID3D11ShaderResourceView>        SRV;
+    picture_sys_d3d11_t                     picsys{};
+};
+
+d3d11_tonemapper *D3D11_TonemapperCreate(vlc_object_t *vd, d3d11_device_t *d3d_dev,
+                                         const video_format_t *in)
+{
+    if (!is_d3d11_opaque(in->i_chroma))
+    {
+        msg_Dbg(vd, "VideoProcessor tone mapping not supported by CPU formats");
+        return nullptr;
+    }
+
+    if (in->transfer == TRANSFER_FUNC_SMPTE_ST2084 ||
+        in->transfer == TRANSFER_FUNC_HLG)
+    {
+        return nullptr; // the source is already in HDR
+    }
+
+    ComPtr<ID3D11Texture2D> texture;
+    ID3D11Texture2D *_texture[DXGI_MAX_SHADER_VIEW] = {};
+    D3D11_TEXTURE2D_DESC texDesc { };
+    D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC outDesc{ };
+    d3d11_tonemapper *tonemapProc = new d3d11_tonemapper();
+    const auto d3d_fmt = D3D11_RenderFormat(DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_UNKNOWN, false);
+    assert(d3d_fmt != nullptr);
+
+    HRESULT hr;
+    hr = d3d_dev->d3ddevice->QueryInterface(IID_GRAPHICS_PPV_ARGS(&tonemapProc->d3dviddev));
+    if (unlikely(FAILED(hr)))
+    {
+        msg_Err(vd, "Could not Query ID3D11VideoDevice Interface. (hr=0x%lX)", hr);
+        goto error;
+    }
+
+    hr = d3d_dev->d3dcontext->QueryInterface(IID_GRAPHICS_PPV_ARGS(&tonemapProc->d3dvidctx));
+    if (unlikely(FAILED(hr)))
+    {
+        msg_Err(vd, "Could not Query ID3D11VideoContext Interface. (hr=0x%lX)", hr);
+        goto error;
+    }
+
+    {
+        D3D11_VIDEO_PROCESSOR_CONTENT_DESC processorDesc{};
+        processorDesc.InputFrameFormat = D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE;
+        processorDesc.InputFrameRate = {
+            in->i_frame_rate, in->i_frame_rate_base,
+        };
+        processorDesc.InputWidth   = in->i_width;
+        processorDesc.InputHeight  = in->i_height;
+        processorDesc.OutputWidth  = in->i_width;
+        processorDesc.OutputHeight = in->i_height;
+        processorDesc.OutputFrameRate = {
+            in->i_frame_rate, in->i_frame_rate_base,
+        };
+        processorDesc.Usage = D3D11_VIDEO_USAGE_PLAYBACK_NORMAL;
+        hr = tonemapProc->d3dviddev->CreateVideoProcessorEnumerator(&processorDesc, &tonemapProc->enumerator);
+        if (FAILED(hr))
+        {
+            msg_Dbg(vd, "Can't get a video processor for the video (error 0x%lx).", hr);
+            goto error;
+        }
+
+        hr = tonemapProc->d3dviddev->CreateVideoProcessor(tonemapProc->enumerator.Get(), 0,
+                                                            &tonemapProc->processor);
+        if (FAILED(hr))
+        {
+            msg_Dbg(vd, "failed to create the processor (error 0x%lx).", hr);
+            goto error;
+        }
+    }
+
+    // we can only use this filter with the NVIDIA extension as the VideoProcessor
+    // doesn't provide a proper API to set the input and output colorimetry
+
+    // NVIDIA 545+ driver
+    if (d3d_dev->adapterDesc.VendorId != GPU_MANUFACTURER_NVIDIA ||
+        (d3d_dev->WDDM.revision * 10000 + d3d_dev->WDDM.build) < 154500)
+            goto error;
+
+    {
+        constexpr GUID kNvidiaTrueHDRInterfaceGUID{ 0xfdd62bb4, 0x620b, 0x4fd7, {0x9a, 0xb3, 0x1e, 0x59, 0xd0, 0xd5, 0x44, 0xb3} };
+        UINT available = 0;
+        d3d11_device_lock(d3d_dev);
+        hr = tonemapProc->d3dvidctx->VideoProcessorGetStreamExtension(tonemapProc->processor.Get(),
+                    0, &kNvidiaTrueHDRInterfaceGUID, sizeof(available), &available);
+
+        if (!available)
+        {
+            d3d11_device_unlock(d3d_dev);
+            goto error;
+        }
+
+        constexpr UINT kStreamExtensionMethodTrueHDR = 0x3;
+        constexpr UINT TrueHDRVersion4 = 4;
+        struct {
+            UINT version;
+            UINT method;
+            UINT enable : 1;
+            UINT reserved : 31;
+        } stream_extension_info = {TrueHDRVersion4,
+                                    kStreamExtensionMethodTrueHDR,
+                                    1u,
+                                    0u};
+        hr = tonemapProc->d3dvidctx->VideoProcessorSetStreamExtension(
+                tonemapProc->processor.Get(),
+                0, &kNvidiaTrueHDRInterfaceGUID,
+                sizeof(stream_extension_info), &stream_extension_info);
+        if (unlikely(FAILED(hr)))
+        {
+            msg_Warn(vd, "Failed to enable NVIDIA True HDR");
+        }
+        d3d11_device_unlock(d3d_dev);
+    }
+
+    // we need a texture that will receive the upscale version
+    texDesc.MipLevels = 1;
+    texDesc.SampleDesc.Count = 1;
+    texDesc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
+    texDesc.Usage = D3D11_USAGE_DEFAULT;
+    texDesc.CPUAccessFlags = 0;
+    texDesc.ArraySize = 1;
+    texDesc.Format = d3d_fmt->formatTexture;
+    texDesc.Width = in->i_width;
+    texDesc.Height = in->i_height;
+    texDesc.MiscFlags = 0;
+    hr = d3d_dev->d3ddevice->CreateTexture2D(&texDesc, nullptr, texture.GetAddressOf());
+    if (FAILED(hr))
+    {
+        msg_Err(vd, "Failed to create the tonemap texture. (hr=0x%lX)", hr);
+        goto error;
+    }
+
+    outDesc.ViewDimension = D3D11_VPOV_DIMENSION_TEXTURE2D;
+    outDesc.Texture2D.MipSlice = 0;
+
+    hr = tonemapProc->d3dviddev->CreateVideoProcessorOutputView(
+                                                            texture.Get(),
+                                                            tonemapProc->enumerator.Get(),
+                                                            &outDesc,
+                                                            tonemapProc->outputView.ReleaseAndGetAddressOf());
+    if (FAILED(hr))
+    {
+        msg_Dbg(vd,"Failed to create processor output. (hr=0x%lX)", hr);
+        goto error;
+    }
+
+    _texture[0] = texture.Get();
+    _texture[1] = texture.Get();
+    _texture[2] = texture.Get();
+    _texture[3] = texture.Get();
+    if (D3D11_AllocateResourceView(vlc_object_logger(vd), d3d_dev->d3ddevice, d3d_fmt,
+                                   _texture, 0, tonemapProc->SRV.GetAddressOf()) != VLC_SUCCESS)
+        goto error;
+
+    {
+        RECT srcRect;
+        srcRect.left   = 0;
+        srcRect.top    = 0;
+        srcRect.right  = texDesc.Width;
+        srcRect.bottom = texDesc.Height;
+
+        RECT dstRect = srcRect;
+
+        d3d11_device_lock(d3d_dev);
+        tonemapProc->d3dvidctx->VideoProcessorSetStreamSourceRect(tonemapProc->processor.Get(),
+                                                                  0, TRUE, &srcRect);
+
+        tonemapProc->d3dvidctx->VideoProcessorSetStreamDestRect(tonemapProc->processor.Get(),
+                                                                0, TRUE, &dstRect);
+
+        d3d11_device_unlock(d3d_dev);
+    }
+
+    tonemapProc->picsys.texture[0] = texture.Get();
+    tonemapProc->picsys.renderSrc[0] = tonemapProc->SRV.Get();
+
+    return tonemapProc;
+error:
+    delete tonemapProc;
+    return nullptr;
+}
+
+void D3D11_TonemapperDestroy(d3d11_tonemapper *tonemapProc)
+{
+    delete tonemapProc;
+}
+
+picture_sys_d3d11_t *D3D11_TonemapperGetOutput(d3d11_tonemapper *tonemapProc)
+{
+    return &tonemapProc->picsys;
+}
+
+static HRESULT assert_ProcessorInput(vlc_object_t *vd, d3d11_tonemapper *tonemapProc, picture_sys_d3d11_t *p_sys_src)
+{
+    if (!p_sys_src->processorInput)
+    {
+        D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC inDesc{};
+        inDesc.FourCC = 0;
+        inDesc.ViewDimension = D3D11_VPIV_DIMENSION_TEXTURE2D;
+        inDesc.Texture2D.MipSlice = 0;
+        inDesc.Texture2D.ArraySlice = p_sys_src->slice_index;
+
+        HRESULT hr;
+
+        hr = tonemapProc->d3dviddev->CreateVideoProcessorInputView(
+                                                             p_sys_src->resource[KNOWN_DXGI_INDEX],
+                                                             tonemapProc->enumerator.Get(),
+                                                             &inDesc,
+                                                             &p_sys_src->processorInput);
+        if (FAILED(hr))
+        {
+#ifndef NDEBUG
+            msg_Dbg(vd,"Failed to create processor input for slice %d. (hr=0x%lX)", p_sys_src->slice_index, hr);
+#endif
+            return hr;
+        }
+    }
+    return S_OK;
+}
+
+HRESULT D3D11_TonemapperProcess(vlc_object_t *vd, d3d11_tonemapper *tonemapProc, picture_sys_d3d11_t *in)
+{
+    HRESULT hr = assert_ProcessorInput(vd, tonemapProc, in);
+    if (FAILED(hr))
+        return hr;
+
+    D3D11_VIDEO_PROCESSOR_STREAM stream{};
+    stream.Enable = TRUE;
+    stream.pInputSurface = in->processorInput;
+
+    hr = tonemapProc->d3dvidctx->VideoProcessorBlt(tonemapProc->processor.Get(),
+                                                   tonemapProc->outputView.Get(),
+                                                   0, 1, &stream);
+    if (FAILED(hr))
+        msg_Err(vd, "Failed to render the texture. (hr=0x%lX)", hr);
+    return hr;
+}


=====================================
modules/video_output/win32/d3d11_tonemap.h
=====================================
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: LGPL-2.1-or-later
+/*****************************************************************************
+ * d3d11_tonemap: Direct3D11 VideoProcessor to handle tonemapping
+ *****************************************************************************
+ * Copyright © 2024 Videolabs, VLC authors and VideoLAN
+ *
+ * Authors: Steve Lhomme <robux4 at videolabs.io>
+ *****************************************************************************/
+
+#ifndef VLC_D3D11_TONEMAP_H
+#define VLC_D3D11_TONEMAP_H
+
+#include "d3d11_quad.h"
+#include "../../video_chroma/d3d11_fmt.h"
+#include <vlc_vout_display.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct d3d11_tonemapper;
+
+struct d3d11_tonemapper *D3D11_TonemapperCreate(vlc_object_t *, d3d11_device_t *,
+                                                const video_format_t * in);
+void D3D11_TonemapperDestroy(struct d3d11_tonemapper *);
+HRESULT D3D11_TonemapperProcess(vlc_object_t *, struct d3d11_tonemapper *, picture_sys_d3d11_t *);
+picture_sys_d3d11_t *D3D11_TonemapperGetOutput(struct d3d11_tonemapper *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // VLC_D3D11_TONEMAP_H


=====================================
modules/video_output/win32/direct3d11.cpp
=====================================
@@ -45,6 +45,7 @@
 #include "d3d11_quad.h"
 #include "d3d11_shaders.h"
 #include "d3d11_scaler.h"
+#include "d3d11_tonemap.h"
 #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
 #include "d3d11_swapchain.h"
 #endif
@@ -71,6 +72,14 @@ static const char *const ppsz_upscale_mode[] = {
 static const char *const ppsz_upscale_mode_text[] = {
     N_("Linear Sampler"), N_("Point Sampler"), N_("Video Processor"), N_("Super Resolution") };
 
+#define HDR_MODE_TEXT N_("HDR Output Mode")
+#define HDR_MODE_LONGTEXT N_("Use HDR output even if the source is SDR.")
+
+static const char *const ppsz_hdr_mode[] = {
+    "auto", "never", "always", "generate" };
+static const char *const ppsz_hdr_mode_text[] = {
+    N_("Auto"), N_("Never out HDR"), N_("Always output HDR"), N_("Generate HDR from SDR") };
+
 vlc_module_begin ()
     set_shortname("Direct3D11")
     set_description(N_("Direct3D11 video output"))
@@ -82,6 +91,9 @@ vlc_module_begin ()
     add_string("d3d11-upscale-mode", "linear", UPSCALE_MODE_TEXT, UPSCALE_MODE_LONGTEXT)
         change_string_list(ppsz_upscale_mode, ppsz_upscale_mode_text)
 
+    add_string("d3d11-hdr-mode", "auto", HDR_MODE_TEXT, HDR_MODE_LONGTEXT)
+        change_string_list(ppsz_hdr_mode, ppsz_hdr_mode_text)
+
     add_shortcut("direct3d11")
     set_callback_display(Open, 300)
 vlc_module_end ()
@@ -96,48 +108,52 @@ enum d3d11_upscale
 
 typedef struct vout_display_sys_t
 {
-    display_win32_area_t     area;
+    display_win32_area_t     area = {};
 
-    int                      log_level;
+    int                      log_level = 1;
 
     display_info_t           display = {};
 
     d3d11_device_t           *d3d_dev = NULL;
     d3d11_decoder_device_t   *local_d3d_dev = NULL; // when opened without a video context
     d3d_shader_compiler_t    *shaders = nullptr;
-    d3d11_quad_t             picQuad;
+    d3d11_quad_t             picQuad = {};
 
 #ifdef HAVE_D3D11_4_H
-    d3d11_gpu_fence          fence;
+    d3d11_gpu_fence          fence = {};
 #endif
 
-    picture_sys_d3d11_t      stagingSys;
+    picture_sys_d3d11_t      stagingSys = {};
     plane_t                  stagingPlanes[PICTURE_PLANE_MAX];
 
-    d3d11_vertex_shader_t    projectionVShader;
-    d3d11_vertex_shader_t    flatVShader;
+    d3d11_vertex_shader_t    projectionVShader = {};
+    d3d11_vertex_shader_t    flatVShader = {};
 
     /* copy from the decoder pool into picSquad before display
      * Uses a Texture2D with slices rather than a Texture2DArray for the decoder */
     bool                     legacy_shader = false;
 
     // SPU
-    vlc_fourcc_t             pSubpictureChromas[2];
-    d3d11_quad_t             regionQuad;
+    vlc_fourcc_t             pSubpictureChromas[2] = {};
+    d3d11_quad_t             regionQuad = {};
     int                      d3dregion_count = 0;
-    picture_t                **d3dregions = NULL;
+    picture_t                **d3dregions = nullptr;
 
     /* outside rendering */
-    void *outside_opaque = NULL;
-    libvlc_video_update_output_cb            updateOutputCb;
-    libvlc_video_swap_cb                     swapCb;
-    libvlc_video_makeCurrent_cb              startEndRenderingCb;
-    libvlc_video_frameMetadata_cb            sendMetadataCb;
-    libvlc_video_output_select_plane_cb      selectPlaneCb;
+    void *outside_opaque = nullptr;
+    libvlc_video_update_output_cb            updateOutputCb = nullptr;
+    libvlc_video_swap_cb                     swapCb = nullptr;
+    libvlc_video_makeCurrent_cb              startEndRenderingCb = nullptr;
+    libvlc_video_frameMetadata_cb            sendMetadataCb = nullptr;
+    libvlc_video_output_select_plane_cb      selectPlaneCb = nullptr;
 
     // upscaling
-    enum d3d11_upscale       upscaleMode;
-    d3d11_scaler             *scaleProc;
+    enum d3d11_upscale       upscaleMode = upscale_LinearSampler;
+    d3d11_scaler             *scaleProc = nullptr;
+
+    // HDR mode
+    enum d3d11_hdr           hdrMode = hdr_Auto;
+    d3d11_tonemapper         *tonemapProc = nullptr;
 } vout_display_sys_t;
 
 static void Prepare(vout_display_t *, picture_t *, const vlc_render_subpicture *, vlc_tick_t);
@@ -146,7 +162,7 @@ static void Display(vout_display_t *, picture_t *);
 static int  Direct3D11Open (vout_display_t *, video_format_t *, vlc_video_context *);
 static void Direct3D11Close(vout_display_t *);
 
-static int SetupOutputFormat(vout_display_t *, video_format_t *, vlc_video_context *);
+static int SetupOutputFormat(vout_display_t *, video_format_t *, vlc_video_context *, video_format_t *quad);
 static int  Direct3D11CreateFormatResources (vout_display_t *, const video_format_t *);
 static int  Direct3D11CreateGenericResources(vout_display_t *);
 static void Direct3D11DestroyResources(vout_display_t *);
@@ -165,6 +181,27 @@ static int UpdateDisplayFormat(vout_display_t *vd, const video_format_t *fmt)
     cfg.width  = vd->cfg->display.width;
     cfg.height = vd->cfg->display.height;
 
+    if (sys->hdrMode == hdr_Always || sys->hdrMode == hdr_Fake)
+    {
+        // force a fake HDR source
+        // corresponds to DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020
+        cfg.bitdepth = 10;
+        cfg.full_range = true;
+        cfg.primaries  = libvlc_video_primaries_BT2020;
+        cfg.colorspace = libvlc_video_colorspace_BT2020;
+        cfg.transfer   = libvlc_video_transfer_func_PQ;
+    }
+    else if (sys->hdrMode == hdr_Never)
+    {
+        // corresponds to DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
+        cfg.bitdepth = 8;
+        cfg.full_range = true;
+        cfg.primaries  = libvlc_video_primaries_BT709;
+        cfg.colorspace = libvlc_video_colorspace_BT709;
+        cfg.transfer   = libvlc_video_transfer_func_BT709;
+    }
+    else
+    {
     switch (fmt->i_chroma)
     {
     case VLC_CODEC_D3D11_OPAQUE:
@@ -175,6 +212,7 @@ static int UpdateDisplayFormat(vout_display_t *vd, const video_format_t *fmt)
     case VLC_CODEC_D3D11_OPAQUE_BGRA:
         cfg.bitdepth = 8;
         break;
+    case VLC_CODEC_RGBA10LE:
     case VLC_CODEC_D3D11_OPAQUE_10B:
         cfg.bitdepth = 10;
         break;
@@ -193,13 +231,14 @@ static int UpdateDisplayFormat(vout_display_t *vd, const video_format_t *fmt)
         }
         break;
     }
-    cfg.full_range = fmt->color_range == COLOR_RANGE_FULL ||
+    cfg.full_range = sys->picQuad.quad_fmt.color_range == COLOR_RANGE_FULL ||
                      /* the YUV->RGB conversion already output full range */
-                     is_d3d11_opaque(fmt->i_chroma) ||
-                     vlc_fourcc_IsYUV(fmt->i_chroma);
-    cfg.primaries  = (libvlc_video_color_primaries_t) fmt->primaries;
-    cfg.colorspace = (libvlc_video_color_space_t)     fmt->space;
-    cfg.transfer   = (libvlc_video_transfer_func_t)   fmt->transfer;
+                     is_d3d11_opaque(sys->picQuad.quad_fmt.i_chroma) ||
+                     vlc_fourcc_IsYUV(sys->picQuad.quad_fmt.i_chroma);
+    cfg.primaries  = (libvlc_video_color_primaries_t) sys->picQuad.quad_fmt.primaries;
+    cfg.colorspace = (libvlc_video_color_space_t)     sys->picQuad.quad_fmt.space;
+    cfg.transfer   = (libvlc_video_transfer_func_t)   sys->picQuad.quad_fmt.transfer;
+    }
 
     libvlc_video_output_cfg_t out;
     if (!sys->updateOutputCb( sys->outside_opaque, &cfg, &out ))
@@ -599,7 +638,12 @@ static void PreparePicture(vout_display_t *vd, picture_t *picture,
         D3D11_TEXTURE2D_DESC srcDesc;
         p_sys->texture[KNOWN_DXGI_INDEX]->GetDesc(&srcDesc);
 
-        if (sys->scaleProc && D3D11_UpscalerUsed(sys->scaleProc))
+        if (sys->tonemapProc)
+        {
+            if (FAILED(D3D11_TonemapperProcess(VLC_OBJECT(vd), sys->tonemapProc, p_sys)))
+                return;
+        }
+        else if (sys->scaleProc && D3D11_UpscalerUsed(sys->scaleProc))
         {
             if (D3D11_UpscalerScale(VLC_OBJECT(vd), sys->scaleProc, p_sys) != VLC_SUCCESS)
                 return;
@@ -674,6 +718,8 @@ static void PreparePicture(vout_display_t *vd, picture_t *picture,
         renderSrc = sys->stagingSys.renderSrc;
     else {
         picture_sys_d3d11_t *p_sys = ActiveD3D11PictureSys(picture);
+        if (sys->tonemapProc)
+            p_sys = D3D11_TonemapperGetOutput(sys->tonemapProc);
         renderSrc = p_sys->renderSrc;
     }
     D3D11_RenderQuad(sys->d3d_dev, &sys->picQuad,
@@ -795,6 +841,23 @@ static const d3d_format_t *GetBlendableFormat(vout_display_t *vd, vlc_fourcc_t i
     return FindD3D11Format( vd, sys->d3d_dev, i_src_chroma, DXGI_RGB_FORMAT|DXGI_YUV_FORMAT, 0, 0, 0, 8, DXGI_CHROMA_CPU, supportFlags );
 }
 
+static void InitTonemapProcessor(vout_display_t *vd, const video_format_t *fmt_in)
+{
+    vout_display_sys_t *sys = static_cast<vout_display_sys_t *>(vd->sys);
+    if (sys->hdrMode != hdr_Fake)
+        return;
+
+    sys->tonemapProc = D3D11_TonemapperCreate(VLC_OBJECT(vd), sys->d3d_dev, fmt_in);
+    if (sys->tonemapProc == NULL)
+    {
+        sys->hdrMode = hdr_Auto;
+        msg_Dbg(vd, "failed to create the tone mapper, using default HDR mode");
+        return;
+    }
+
+    msg_Dbg(vd, "Using tonemapper");
+}
+
 static void InitScaleProcessor(vout_display_t *vd)
 {
     vout_display_sys_t *sys = static_cast<vout_display_sys_t *>(vd->sys);
@@ -816,8 +879,16 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmtp, vlc_video_co
 {
     vout_display_sys_t *sys = static_cast<vout_display_sys_t *>(vd->sys);
     video_format_t fmt;
+
+    char *psz_hdr = var_InheritString(vd, "d3d11-hdr-mode");
+    sys->hdrMode = HdrModeFromString(vlc_object_logger(vd), psz_hdr);
+    free(psz_hdr);
+
+    InitTonemapProcessor(vd, vd->source);
+
     video_format_Copy(&fmt, vd->source);
-    int err = SetupOutputFormat(vd, &fmt, vctx);
+    video_format_Copy(&sys->picQuad.quad_fmt, &fmt);
+    int err = SetupOutputFormat(vd, &fmt, vctx, &sys->picQuad.quad_fmt);
     if (err != VLC_SUCCESS)
     {
         if (!is_d3d11_opaque(vd->source->i_chroma)
@@ -831,7 +902,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmtp, vlc_video_co
                 if (list[i] == vd->source->i_chroma)
                     continue;
                 fmt.i_chroma = list[i];
-                err = SetupOutputFormat(vd, &fmt, NULL);
+                err = SetupOutputFormat(vd, &fmt, nullptr, &sys->picQuad.quad_fmt);
                 if (err == VLC_SUCCESS)
                     break;
             }
@@ -846,15 +917,14 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmtp, vlc_video_co
         }
     }
 
-    video_format_Copy(&sys->picQuad.quad_fmt, &fmt);
     if (!is_d3d11_opaque(fmt.i_chroma))
     {
         sys->picQuad.quad_fmt.i_chroma = sys->picQuad.generic.textureFormat->fourcc;
     }
 
     /* adjust the decoder sizes to have proper padding */
-    if ( sys->picQuad.generic.textureFormat->formatTexture != DXGI_FORMAT_R8G8B8A8_UNORM &&
-         sys->picQuad.generic.textureFormat->formatTexture != DXGI_FORMAT_B5G6R5_UNORM )
+    if ( sys->picQuad.generic.textureFormat->heightDenominator != 1 ||
+         sys->picQuad.generic.textureFormat->widthDenominator != 1 )
     {
         sys->picQuad.quad_fmt.i_width  = (sys->picQuad.quad_fmt.i_width  + 0x01) & ~0x01;
         sys->picQuad.quad_fmt.i_height = (sys->picQuad.quad_fmt.i_height + 0x01) & ~0x01;
@@ -882,7 +952,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmtp, vlc_video_co
 
     CommonPlacePicture(vd, &sys->area);
 
-    err = UpdateDisplayFormat(vd, &fmt);
+    err = UpdateDisplayFormat(vd, &sys->picQuad.quad_fmt);
     if (err != VLC_SUCCESS) {
         msg_Err(vd, "Could not update the backbuffer");
         return err;
@@ -905,107 +975,135 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmtp, vlc_video_co
     return VLC_SUCCESS;
 }
 
-static int SetupOutputFormat(vout_display_t *vd, video_format_t *fmt, vlc_video_context *vctx)
+static const d3d_format_t *SelectOutputFormat(vout_display_t *vd, const video_format_t *fmt, vlc_video_context *vctx,
+                                              const d3d_format_t * & decoder_format)
 {
     vout_display_sys_t *sys = static_cast<vout_display_sys_t *>(vd->sys);
 
+    const d3d_format_t *res = nullptr;
+
     d3d11_video_context_t *vtcx_sys = GetD3D11ContextPrivate(vctx);
     if (vtcx_sys != NULL &&
         D3D11_DeviceSupportsFormat( sys->d3d_dev, vtcx_sys->format, D3D11_FORMAT_SUPPORT_SHADER_LOAD ))
     {
-        sys->picQuad.generic.textureFormat = D3D11_RenderFormat(vtcx_sys->format, vtcx_sys->secondary ,true);
+        res = D3D11_RenderFormat(vtcx_sys->format, vtcx_sys->secondary ,true);
+        if (res != nullptr)
+            return res;
     }
 
     // look for the requested pixel format first
-    if ( !sys->picQuad.generic.textureFormat )
-        sys->picQuad.generic.textureFormat = GetDirectRenderingFormat(vd, fmt->i_chroma);
+    res = GetDirectRenderingFormat(vd, fmt->i_chroma);
+    if (res != nullptr)
+        return res;
 
     // look for any pixel format that we can handle with enough pixels per channel
-    const d3d_format_t *decoder_format = nullptr;
-    if ( !sys->picQuad.generic.textureFormat )
-    {
-        uint8_t bits_per_channel;
-        uint8_t widthDenominator, heightDenominator;
-        uint8_t alpha_bits = 0;
-        vlc_fourcc_t cpu_chroma;
-        if (is_d3d11_opaque(fmt->i_chroma))
-            cpu_chroma = DxgiFormatFourcc(vtcx_sys->format);
-        else if (is_nvdec_opaque(fmt->i_chroma))
-            cpu_chroma = NVDECToVlcChroma(fmt->i_chroma);
-        else
-            cpu_chroma = fmt->i_chroma;
+    uint8_t bits_per_channel;
+    uint8_t widthDenominator, heightDenominator;
+    uint8_t alpha_bits = 0;
+    vlc_fourcc_t cpu_chroma;
+    if (is_d3d11_opaque(fmt->i_chroma))
+        cpu_chroma = DxgiFormatFourcc(vtcx_sys->format);
+    else if (is_nvdec_opaque(fmt->i_chroma))
+        cpu_chroma = NVDECToVlcChroma(fmt->i_chroma);
+    else
+        cpu_chroma = fmt->i_chroma;
 
-        const auto *p_format = vlc_fourcc_GetChromaDescription(cpu_chroma);
-        if (unlikely(p_format == NULL || p_format->plane_count == 0))
+    const auto *p_format = vlc_fourcc_GetChromaDescription(cpu_chroma);
+    if (unlikely(p_format == NULL || p_format->plane_count == 0))
+    {
+        bits_per_channel = 8;
+        widthDenominator = heightDenominator = 2;
+    }
+    else
+    {
+        bits_per_channel = p_format->pixel_bits /
+                            (p_format->plane_count==1 ? p_format->pixel_size : 1);
+        widthDenominator = heightDenominator = 1;
+        for (size_t i=0; i<p_format->plane_count; i++)
         {
-            bits_per_channel = 8;
-            widthDenominator = heightDenominator = 2;
+            if (widthDenominator < p_format->p[i].w.den)
+                widthDenominator = p_format->p[i].w.den;
+            if (heightDenominator < p_format->p[i].h.den)
+                heightDenominator = p_format->p[1].h.den;
         }
-        else
-        {
-            bits_per_channel = p_format->pixel_bits /
-                               (p_format->plane_count==1 ? p_format->pixel_size : 1);
-            widthDenominator = heightDenominator = 1;
-            for (size_t i=0; i<p_format->plane_count; i++)
-            {
-                if (widthDenominator < p_format->p[i].w.den)
-                    widthDenominator = p_format->p[i].w.den;
-                if (heightDenominator < p_format->p[i].h.den)
-                    heightDenominator = p_format->p[1].h.den;
-            }
 
-            switch (cpu_chroma) // FIXME get this info from the core
-            {
-            case VLC_CODEC_YUVA:
-            case VLC_CODEC_YUV422A:
-            case VLC_CODEC_YUV420A:
-            case VLC_CODEC_VUYA:
-            case VLC_CODEC_RGBA:
-            case VLC_CODEC_ARGB:
-            case VLC_CODEC_BGRA:
-            case VLC_CODEC_ABGR:
-            case VLC_CODEC_D3D11_OPAQUE_RGBA:
-            case VLC_CODEC_D3D11_OPAQUE_BGRA:
-            case VLC_CODEC_D3D11_OPAQUE_ALPHA:
-                alpha_bits = 8;
-                break;
-            case VLC_CODEC_YUVA_444_10L:
-            case VLC_CODEC_YUVA_444_10B:
-                alpha_bits = 10;
-                break;
-            case VLC_CODEC_RGBA10LE:
-                alpha_bits = 2;
-                break;
-            case VLC_CODEC_YUVA_444_12L:
-            case VLC_CODEC_YUVA_444_12B:
-                alpha_bits = 12;
-                break;
-            case VLC_CODEC_RGBA64:
-                alpha_bits = 16;
-                break;
-            }
+        switch (cpu_chroma) // FIXME get this info from the core
+        {
+        case VLC_CODEC_YUVA:
+        case VLC_CODEC_YUV422A:
+        case VLC_CODEC_YUV420A:
+        case VLC_CODEC_VUYA:
+        case VLC_CODEC_RGBA:
+        case VLC_CODEC_ARGB:
+        case VLC_CODEC_BGRA:
+        case VLC_CODEC_ABGR:
+        case VLC_CODEC_D3D11_OPAQUE_RGBA:
+        case VLC_CODEC_D3D11_OPAQUE_BGRA:
+        case VLC_CODEC_D3D11_OPAQUE_ALPHA:
+            alpha_bits = 8;
+            break;
+        case VLC_CODEC_YUVA_444_10L:
+        case VLC_CODEC_YUVA_444_10B:
+            alpha_bits = 10;
+            break;
+        case VLC_CODEC_RGBA10LE:
+            bits_per_channel = 10;
+            alpha_bits = 2;
+            break;
+        case VLC_CODEC_YUVA_444_12L:
+        case VLC_CODEC_YUVA_444_12B:
+            alpha_bits = 12;
+            break;
+        case VLC_CODEC_RGBA64:
+            alpha_bits = 16;
+            break;
         }
-
-        /* look for a decoder format that can be decoded but not used in shaders */
-        if ( is_d3d11_opaque(fmt->i_chroma) )
-            decoder_format = GetDirectDecoderFormat(vd, fmt->i_chroma);
-
-        bool is_rgb = !vlc_fourcc_IsYUV(fmt->i_chroma);
-        sys->picQuad.generic.textureFormat = GetDisplayFormatByDepth(vd, bits_per_channel,
-                                                             widthDenominator, heightDenominator, alpha_bits,
-                                                             decoder_format!=nullptr,
-                                                             is_rgb ? DXGI_RGB_FORMAT : DXGI_YUV_FORMAT);
-        if (!sys->picQuad.generic.textureFormat)
-            sys->picQuad.generic.textureFormat = GetDisplayFormatByDepth(vd, bits_per_channel,
-                                                                 widthDenominator, heightDenominator, alpha_bits,
-                                                                 decoder_format!=nullptr,
-                                                                 is_rgb ? DXGI_YUV_FORMAT : DXGI_RGB_FORMAT);
     }
 
+    /* look for a decoder format that can be decoded but not used in shaders */
+    if ( is_d3d11_opaque(fmt->i_chroma) )
+        decoder_format = GetDirectDecoderFormat(vd, fmt->i_chroma);
+
+    bool is_rgb = !vlc_fourcc_IsYUV(fmt->i_chroma);
+    res = GetDisplayFormatByDepth(vd, bits_per_channel,
+                                  widthDenominator, heightDenominator, alpha_bits,
+                                  decoder_format!=nullptr,
+                                  is_rgb ? DXGI_RGB_FORMAT : DXGI_YUV_FORMAT);
+    if (res != nullptr)
+        return res;
+    res = GetDisplayFormatByDepth(vd, bits_per_channel,
+                                  widthDenominator, heightDenominator, alpha_bits,
+                                  decoder_format!=nullptr,
+                                  is_rgb ? DXGI_YUV_FORMAT : DXGI_RGB_FORMAT);
+    if (res != nullptr)
+        return res;
+
     // look for any pixel format that we can handle
-    if ( !sys->picQuad.generic.textureFormat )
-        sys->picQuad.generic.textureFormat = GetDisplayFormatByDepth(vd, 0, 0, 0, 0, true, DXGI_YUV_FORMAT|DXGI_RGB_FORMAT);
+    return GetDisplayFormatByDepth(vd, 0, 0, 0, 0, true, DXGI_YUV_FORMAT|DXGI_RGB_FORMAT);
+}
 
+static int SetupOutputFormat(vout_display_t *vd, video_format_t *fmt, vlc_video_context *vctx, video_format_t *quad_fmt)
+{
+    vout_display_sys_t *sys = static_cast<vout_display_sys_t *>(vd->sys);
+    const d3d_format_t *decoder_format = nullptr;
+
+    if (sys->hdrMode == hdr_Fake)
+    {
+        // force a fake HDR source
+        // corresponds to DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020
+        vctx                         = nullptr; // TODO create an internal one from the tonemapper
+        quad_fmt->i_chroma           = VLC_CODEC_RGBA10LE;
+        quad_fmt->primaries          = COLOR_PRIMARIES_BT2020;
+        quad_fmt->transfer           = TRANSFER_FUNC_SMPTE_ST2084;
+        quad_fmt->space              = COLOR_SPACE_BT2020;
+        quad_fmt->color_range        = COLOR_RANGE_FULL;
+
+        // request an input format that can be input of a VideoProcessor
+        UINT supportFlags = D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_INPUT;
+        decoder_format = FindD3D11Format( vd, sys->d3d_dev, fmt->i_chroma, DXGI_RGB_FORMAT|DXGI_YUV_FORMAT, 0, 0, 0, 0,
+                                            is_d3d11_opaque(fmt->i_chroma) ? DXGI_CHROMA_GPU : DXGI_CHROMA_CPU, supportFlags );
+    }
+    sys->picQuad.generic.textureFormat = SelectOutputFormat(vd, quad_fmt, vctx, decoder_format);
     if ( !sys->picQuad.generic.textureFormat )
     {
        msg_Err(vd, "Could not get a suitable texture pixel format");
@@ -1017,7 +1115,7 @@ static int SetupOutputFormat(vout_display_t *vd, video_format_t *fmt, vlc_video_
 
     fmt->i_chroma = decoder_format ? decoder_format->fourcc : sys->picQuad.generic.textureFormat->fourcc;
 
-    /* check the region pixel format */
+    /* select the subpicture region pixel format */
     sys->regionQuad.generic.textureFormat = GetBlendableFormat(vd, VLC_CODEC_RGBA);
     if (!sys->regionQuad.generic.textureFormat)
         sys->regionQuad.generic.textureFormat = GetBlendableFormat(vd, VLC_CODEC_BGRA);
@@ -1109,7 +1207,7 @@ static int Direct3D11CreateFormatResources(vout_display_t *vd, const video_forma
 
     sys->legacy_shader = sys->d3d_dev->feature_level < D3D_FEATURE_LEVEL_10_0 ||
             (sys->scaleProc == nullptr && !CanUseTextureArray(vd)) ||
-            BogusZeroCopy(vd) || !is_d3d11_opaque(fmt->i_chroma);
+            BogusZeroCopy(vd) || (sys->tonemapProc == NULL && !is_d3d11_opaque(fmt->i_chroma));
 
     d3d_shader_blob pPSBlob[DXGI_MAX_RENDER_TARGET] = { };
     hr = D3D11_CompilePixelShaderBlob(vd, sys->shaders, sys->d3d_dev,
@@ -1281,6 +1379,11 @@ static void Direct3D11DestroyResources(vout_display_t *vd)
 {
     vout_display_sys_t *sys = static_cast<vout_display_sys_t *>(vd->sys);
 
+    if (sys->tonemapProc != NULL)
+    {
+        D3D11_TonemapperDestroy(sys->tonemapProc);
+        sys->tonemapProc = NULL;
+    }
     if (sys->scaleProc != nullptr)
     {
         D3D11_UpscalerDestroy(sys->scaleProc);


=====================================
modules/video_output/win32/dxgi_swapchain.cpp
=====================================
@@ -147,7 +147,7 @@ static bool canHandleConversion(const dxgi_color_space *src, const dxgi_color_sp
 }
 #endif
 
-void DXGI_SelectSwapchainColorspace(dxgi_swapchain *display, const libvlc_video_render_cfg_t *cfg)
+void DXGI_SelectSwapchainColorspace(dxgi_swapchain *display, const libvlc_video_render_cfg_t *cfg, bool match_display)
 {
     HRESULT hr;
     int best = 0;
@@ -199,6 +199,7 @@ 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)))
     {
         ComPtr<IDXGIOutput6> dxgiOutput6;
@@ -443,7 +444,8 @@ void DXGI_SwapchainUpdateOutput( dxgi_swapchain *display, libvlc_video_output_cf
 
 bool DXGI_UpdateSwapChain( dxgi_swapchain *display, IDXGIAdapter *dxgiadapter,
                            IUnknown *pFactoryDevice,
-                           const d3d_format_t *newPixelFormat, const libvlc_video_render_cfg_t *cfg )
+                           const d3d_format_t *newPixelFormat, const libvlc_video_render_cfg_t *cfg,
+                           bool match_display )
 {
     // 0 dimensions are not allowed, a value of 8 is used otherwise
     UINT width = cfg->width ? cfg->width : 8;
@@ -482,7 +484,7 @@ bool DXGI_UpdateSwapChain( dxgi_swapchain *display, IDXGIAdapter *dxgiadapter,
         return false;
     }
 
-    DXGI_SelectSwapchainColorspace(display, cfg);
+    DXGI_SelectSwapchainColorspace(display, cfg, match_display);
     return true;
 }
 


=====================================
modules/video_output/win32/dxgi_swapchain.h
=====================================
@@ -58,12 +58,13 @@ Microsoft::WRL::ComPtr<IDXGISwapChain1> & DXGI_GetSwapChain1( struct dxgi_swapch
 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 * );
+void DXGI_SelectSwapchainColorspace( struct dxgi_swapchain *, const libvlc_video_render_cfg_t *, bool match_display );
 void DXGI_LocalSwapchainCleanupDevice( struct dxgi_swapchain * );
 void DXGI_SwapchainUpdateOutput( struct dxgi_swapchain *, libvlc_video_output_cfg_t * );
 bool DXGI_UpdateSwapChain( struct dxgi_swapchain *, IDXGIAdapter *,
                            IUnknown *pFactoryDevice,
-                           const d3d_format_t *, const libvlc_video_render_cfg_t * );
+                           const d3d_format_t *, const libvlc_video_render_cfg_t *,
+                           bool match_display );
 
 void DXGI_LocalSwapchainSwap( struct dxgi_swapchain * );
 void DXGI_LocalSwapchainSetMetadata( struct dxgi_swapchain *, libvlc_video_metadata_type_t, const void * );


=====================================
modules/video_output/win32/meson.build
=====================================
@@ -3,7 +3,9 @@
 #
 
 # Direct3D11 video output
-d3d11_sources = files('direct3d11.cpp', 'd3d11_quad.cpp', 'd3d11_scaler.cpp', 'd3d11_shaders.cpp', 'd3d_shaders.c', 'd3d_dynamic_shader.c', 'common.c')
+d3d11_sources = files('direct3d11.cpp', 'd3d11_quad.cpp', 'd3d11_scaler.cpp',
+                      'd3d11_shaders.cpp', 'd3d11_tonemap.cpp',
+                      'd3d_shaders.c', 'd3d_dynamic_shader.c', 'common.c')
 d3d11_link_with = [ d3d11_common_lib ]
 d3d11_cargs = []
 d3d11_cxxargs = [ libcom_cppflags ]



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/9e296fb6f395a3f0a8afbe922705c9c4902ba58c...1da233f17df6431c216d00b83e9b5573adeace56

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/9e296fb6f395a3f0a8afbe922705c9c4902ba58c...1da233f17df6431c216d00b83e9b5573adeace56
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