summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authornanahi <130121847+na-na-hi@users.noreply.github.com>2023-12-22 21:44:24 -0500
committersfan5 <sfan5@live.de>2024-01-06 23:46:12 +0100
commit41259db9523bede8c656c7a8664484e0e4befa02 (patch)
tree18750dfe5379115b676ba0a60338822f1f37a327 /video
parentf0bcbdcf764b2bf477c301a05c716d43e92e44fb (diff)
downloadmpv-41259db9523bede8c656c7a8664484e0e4befa02.tar.bz2
mpv-41259db9523bede8c656c7a8664484e0e4befa02.tar.xz
vo_gpu_next: respect d3d11 swapchain output format preference
Currently, libplacebo always tries to reconfigure the d3d11 swapchain to a 10-bit output format because disable_10bit_sdr isn't set to true, even when an 8-bit format is explicitly requested via --d3d11-output-format. Fix this by passing the requested output format preference to libplacebo. Document that this option may be ignored.
Diffstat (limited to 'video')
-rw-r--r--video/out/d3d11/context.c10
-rw-r--r--video/out/d3d11/context.h4
-rw-r--r--video/out/gpu_next/context.c1
3 files changed, 15 insertions, 0 deletions
diff --git a/video/out/d3d11/context.c b/video/out/d3d11/context.c
index 96d37ff5d5..6b7f475b4b 100644
--- a/video/out/d3d11/context.c
+++ b/video/out/d3d11/context.c
@@ -521,6 +521,16 @@ IDXGISwapChain *ra_d3d11_ctx_get_swapchain(struct ra_ctx *ra)
return p->swapchain;
}
+bool ra_d3d11_ctx_prefer_8bit_output_format(struct ra_ctx *ra)
+{
+ if (ra->swapchain->fns != &d3d11_swapchain)
+ return false;
+
+ struct priv *p = ra->priv;
+
+ return p->opts->output_format == DXGI_FORMAT_R8G8B8A8_UNORM;
+}
+
const struct ra_ctx_fns ra_ctx_d3d11 = {
.type = "d3d11",
.name = "d3d11",
diff --git a/video/out/d3d11/context.h b/video/out/d3d11/context.h
index 8a9ef4cc0d..25488f2cbd 100644
--- a/video/out/d3d11/context.h
+++ b/video/out/d3d11/context.h
@@ -7,3 +7,7 @@
// Get the underlying D3D11 swap chain from an RA context. The returned swap chain is
// refcounted and must be released by the caller.
IDXGISwapChain *ra_d3d11_ctx_get_swapchain(struct ra_ctx *ra);
+
+// Returns true if an 8-bit output format is explicitly requested for
+// d3d11-output-format for an RA context.
+bool ra_d3d11_ctx_prefer_8bit_output_format(struct ra_ctx *ra);
diff --git a/video/out/gpu_next/context.c b/video/out/gpu_next/context.c
index 2887cff938..75d3a47056 100644
--- a/video/out/gpu_next/context.c
+++ b/video/out/gpu_next/context.c
@@ -88,6 +88,7 @@ static bool d3d11_pl_init(struct vo *vo, struct gpu_ctx *ctx,
ctx->swapchain = pl_d3d11_create_swapchain(d3d11,
pl_d3d11_swapchain_params(
.swapchain = swapchain,
+ .disable_10bit_sdr = ra_d3d11_ctx_prefer_8bit_output_format(ctx->ra_ctx),
)
);
if (!ctx->swapchain) {