summaryrefslogtreecommitdiffstats
path: root/video/out/d3d11
diff options
context:
space:
mode:
authorJan Ekström <jeebjp@gmail.com>2018-05-06 03:01:58 +0300
committerJan Ekström <jeebjp@gmail.com>2019-10-30 02:41:25 +0200
commitfc29620ec876b8cf8a95e9d1aedd24e76ef3204c (patch)
treeca13858d0e9aba6dfbcf7e48cebc2b85526a1377 /video/out/d3d11
parent93dd77b38e4eefd13bc2d3aab24adaa46e72f728 (diff)
downloadmpv-fc29620ec876b8cf8a95e9d1aedd24e76ef3204c.tar.bz2
mpv-fc29620ec876b8cf8a95e9d1aedd24e76ef3204c.tar.xz
vo_gpu/d3d11: add support for configuring swap chain color space
By default utilizes the color space of the desktop on which the swap chain is located. If a specific value is defined, it will be instead be utilized. Enables configuration of the PQ color space (BT.2020 primaries, PQ transfer function) for HDR. Additionally, signals the swap chain color space to the renderer, so that the render looks correct without having to specify target-trc or target-prim manually. Due to all of the APIs being Win10+ only, will only work starting with Windows 10.
Diffstat (limited to 'video/out/d3d11')
-rw-r--r--video/out/d3d11/context.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/video/out/d3d11/context.c b/video/out/d3d11/context.c
index f03f93df92..bdfbacfe54 100644
--- a/video/out/d3d11/context.c
+++ b/video/out/d3d11/context.c
@@ -37,6 +37,7 @@ struct d3d11_opts {
int sync_interval;
char *adapter_name;
int output_format;
+ int color_space;
};
#define OPT_BASE_STRUCT struct d3d11_opts
@@ -66,6 +67,12 @@ const struct m_sub_options d3d11_conf = {
{"bgra8", DXGI_FORMAT_B8G8R8A8_UNORM},
{"rgb10_a2", DXGI_FORMAT_R10G10B10A2_UNORM},
{"rgba16f", DXGI_FORMAT_R16G16B16A16_FLOAT})),
+ OPT_CHOICE("d3d11-output-csp", color_space, 0,
+ ({"auto", -1},
+ {"srgb", DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709},
+ {"linear", DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709},
+ {"pq", DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020},
+ {"bt.2020", DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P2020})),
{0}
},
.defaults = &(const struct d3d11_opts) {
@@ -75,6 +82,7 @@ const struct m_sub_options d3d11_conf = {
.sync_interval = 1,
.adapter_name = NULL,
.output_format = DXGI_FORMAT_UNKNOWN,
+ .color_space = -1,
},
.size = sizeof(struct d3d11_opts)
};
@@ -85,6 +93,7 @@ struct priv {
struct ra_tex *backbuffer;
ID3D11Device *device;
IDXGISwapChain *swapchain;
+ struct mp_colorspace swapchain_csp;
int64_t perf_freq;
unsigned last_sync_refresh_count;
@@ -188,6 +197,7 @@ static bool d3d11_start_frame(struct ra_swapchain *sw, struct ra_fbo *out_fbo)
*out_fbo = (struct ra_fbo) {
.tex = p->backbuffer,
.flip = false,
+ .color_space = p->swapchain_csp
};
return true;
}
@@ -382,6 +392,8 @@ static bool d3d11_init(struct ra_ctx *ctx)
.width = ctx->vo->dwidth,
.height = ctx->vo->dheight,
.format = p->opts->output_format,
+ .color_space = p->opts->color_space,
+ .configured_csp = &p->swapchain_csp,
.flip = p->opts->flip,
// Add one frame for the backbuffer and one frame of "slack" to reduce
// contention with the window manager when acquiring the backbuffer