video/out/gpu: remove pass_colorspace ra_ctx_fns

This was originally added way back when specifically for drm so it can
play  nice with libplacebo for HDR. This is pretty ugly though and a bit
hacky. There's a better way to integrate this with target_csp. So drop
the pass_colorspace stuff in this commit and we'll change the
implementation in the next commit.
This commit is contained in:
Dudemanguy authored and Kacper Michajłow committed 2026-02-28 10:50:38 +01:00
1 parent f28cea85c1
commit 7dd06a6c0b
5 files changed
+4 -20

No files matched your search

+1 -2
View File
@@ -1365,8 +1365,7 @@ bool vo_drm_set_hdr_metadata(struct vo *vo, bool force_sdr)
destroy_hdr_blob(drm);
drm->target_params = target_params;
drm->supported_colorspace = target_params_supported_by_display(drm);
bool use_sdr = !drm->supported_colorspace || force_sdr;
bool use_sdr = !target_params_supported_by_display(drm) || force_sdr;
// For any HDR, the BT2020 drm colorspace is the only one that works in practice.
struct drm_atomic_context *atomic_ctx = drm->atomic_context;
-1
View File
@@ -138,7 +138,6 @@ struct vo_drm_state {
const struct di_edid_chromaticity_coords *chromaticity;
const struct di_cta_hdr_static_metadata_block *hdr_static_metadata;
const struct di_cta_colorimetry_block *colorimetry;
bool supported_colorspace;
bool active;
bool redraw;
-4
View File
@@ -44,10 +44,6 @@ struct ra_ctx_fns {
// display size etc. are determined by it.
bool (*reconfig)(struct ra_ctx *ctx);
// Signal if the underlying context can use colorspace/hdr related functionality
// on its own.
bool (*pass_colorspace)(struct ra_ctx *ctx);
// This behaves exactly like vo_driver.control().
int (*control)(struct ra_ctx *ctx, int *events, int request, void *arg);
-6
View File
@@ -654,11 +654,6 @@ static bool drm_egl_reconfig(struct ra_ctx *ctx)
return true;
}
static bool drm_egl_pass_colorspace(struct ra_ctx *ctx)
{
return ctx->vo->drm->supported_colorspace;
}
static int drm_egl_control(struct ra_ctx *ctx, int *events, int request,
void *arg)
{
@@ -681,7 +676,6 @@ const struct ra_ctx_fns ra_ctx_drm_egl = {
.name = "drm",
.description = "DRM/EGL",
.reconfig = drm_egl_reconfig,
.pass_colorspace = drm_egl_pass_colorspace,
.control = drm_egl_control,
.init = drm_egl_init,
.uninit = drm_egl_uninit,
+3 -7
View File
@@ -1082,7 +1082,6 @@ static bool draw_frame(struct vo *vo, struct vo_frame *frame)
struct ra_swapchain *sw = p->ra_ctx->swapchain;
bool pass_colorspace = false;
struct pl_color_space target_csp = {0};
// TODO: Implement this for all backends
if (sw->fns->target_csp)
@@ -1178,8 +1177,6 @@ static bool draw_frame(struct vo *vo, struct vo_frame *frame)
hint.hdr.max_cll = target->hdr.max_cll;
hint.hdr.max_fall = target->hdr.max_fall;
}
if (p->ra_ctx->fns->pass_colorspace && p->ra_ctx->fns->pass_colorspace(p->ra_ctx))
pass_colorspace = true;
if (opts->target_prim)
hint.primaries = opts->target_prim;
if (opts->target_gamut) {
@@ -1226,8 +1223,7 @@ static bool draw_frame(struct vo *vo, struct vo_frame *frame)
// Update again after possible max_luma change
if (p->icc_profile)
hint = p->icc_profile->csp;
if (!pass_colorspace)
pl_swapchain_colorspace_hint(p->sw, &hint);
pl_swapchain_colorspace_hint(p->sw, &hint);
} else if (!target_hint) {
if (!hint.hdr.min_luma)
hint.hdr.min_luma = target_csp.hdr.min_luma;
@@ -1258,7 +1254,7 @@ static bool draw_frame(struct vo *vo, struct vo_frame *frame)
// Calculate target
struct pl_frame target;
pl_frame_from_swapchain(&target, &swframe);
bool strict_sw_params = target_hint && !pass_colorspace && p->next_opts->target_hint_strict;
bool strict_sw_params = target_hint && p->next_opts->target_hint_strict;
apply_target_options(p, &target, hint.hdr.min_luma, strict_sw_params);
if (target.color.transfer == PL_COLOR_TRC_SRGB && frame->current &&
((opts->sdr_adjust_gamma == 0 && opts->target_trc == PL_COLOR_TRC_UNKNOWN) ||
@@ -1414,7 +1410,7 @@ static bool draw_frame(struct vo *vo, struct vo_frame *frame)
? swframe.fbo->params.format->name : NULL,
.w = mp_rect_w(p->dst),
.h = mp_rect_h(p->dst),
.color = pass_colorspace ? hint : target.color,
.color = target.color,
.repr = target.repr,
.rotate = target.rotation,
};