vo_gpu_next: change --target-colorspace-hint to auto by default

Auto mode will also enable hint for SDR formats if target metadata is
reported by current output context.
This commit is contained in:
Kacper Michajłow committed 2025-07-11 21:53:58 +02:00
1 parent ce076de31f
commit c5c1477eb4
3 files changed
+22 -11

No files matched your search

@@ -0,0 +1 @@
Change `--target-colorspace-hint` to `auto` by default. Auto mode will also enable hint for SDR formats if target metadata is reported by current output context.
+14 -5
View File
@@ -7017,11 +7017,20 @@ them.
image's native colorspace and output normalized non-linear RGB.
``--target-colorspace-hint=<auto|yes|no>``
Automatically configure the output colorspace of the display to pass
through the input values of the stream (e.g. for HDR passthrough), if
possible. In ``auto`` mode, the target colorspace is only set,
if the display signals support for HDR colorspace.
Requires a supporting driver and ``--vo=gpu-next``. (Default: ``no``)
When enabled, output colorspace metadata will be set on the swapchain
depending on the GPU context and platform this may affect compositor/display.
This can be used for "HDR passthrough" and to set the output colorspace
for SDR content. In ``auto`` mode, the target colorspace is only set if the
current display parameters are known. Currently, this is supported on
Wayland, D3D11 and winvk contexts. The ``yes`` option will always try to set
the colorspace, you may need to adjust the ``--target-*`` options to match
your display capabilities.
Requires a supporting driver and ``--vo=gpu-next``. (Default: ``auto``)
.. note::
Auto detected target colorspace metadata is not guaranteed to be always
best choice. It depends on your compositor, driver, and display
capabilities. However in most cases ``auto`` mode should work fine.
``--target-colorspace-hint-mode=<target|source>``
Select which metadata to use for the ``--target-colorspace-hint``.
+7 -6
View File
@@ -216,6 +216,7 @@ const struct m_sub_options gl_next_conf = {
.inter_preserve = true,
.sub_hdr_peak = PL_COLOR_SDR_WHITE,
.image_subs_hdr_peak = PL_COLOR_SDR_WHITE,
.target_hint = -1,
},
.size = sizeof(struct gl_next_opts),
.change_flags = UPDATE_VIDEO,
@@ -1009,11 +1010,6 @@ static bool draw_frame(struct vo *vo, struct vo_frame *frame)
// TODO: Implement this for all backends
if (sw->fns->target_csp)
target_csp = sw->fns->target_csp(sw);
// Assume HDR is supported, if query is not available
if (target_csp.transfer == PL_COLOR_TRC_UNKNOWN) {
target_csp = (struct pl_color_space){
.transfer = opts->target_trc ? opts->target_trc : PL_COLOR_TRC_PQ };
}
if (!pl_color_transfer_is_hdr(target_csp.transfer)) {
// Don't use reported display peak in SDR mode. Mostly because libplacebo
// forcefully switches to PQ if hinting hdr metadata, ignoring the transfer
@@ -1028,7 +1024,12 @@ static bool draw_frame(struct vo *vo, struct vo_frame *frame)
struct pl_color_space hint;
bool target_hint = p->next_opts->target_hint == 1 ||
(p->next_opts->target_hint == -1 &&
pl_color_transfer_is_hdr(target_csp.transfer));
target_csp.transfer != PL_COLOR_TRC_UNKNOWN);
// Assume HDR is supported, if target_csp() is not available
if (target_csp.transfer == PL_COLOR_TRC_UNKNOWN) {
target_csp = (struct pl_color_space){
.transfer = opts->target_trc ? opts->target_trc : PL_COLOR_TRC_PQ };
}
if (target_hint && frame->current) {
const struct pl_color_space *source = &frame->current->params.color;
const struct pl_color_space *target = &target_csp;