From 20c20850574ba814f69d2bf7c8dab99ba903d343 Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Mon, 18 May 2026 17:33:32 +0000 Subject: [PATCH] Pass output color encoding & range to renderer Signed-off-by: Andri Yngvason --- include/wlr/render/pass.h | 5 +++++ types/output/render.c | 14 +++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/include/wlr/render/pass.h b/include/wlr/render/pass.h index 61ab77132..14d06e038 100644 --- a/include/wlr/render/pass.h +++ b/include/wlr/render/pass.h @@ -36,6 +36,11 @@ struct wlr_buffer_pass_options { * sRGB monitors) */ struct wlr_color_transform *color_transform; + /* Color encoding of the destination buffer for RGB to YCbCr conversion */ + enum wlr_color_encoding color_encoding; + /* Color range of the destination buffer */ + enum wlr_color_range color_range; + /* Signal a timeline synchronization point when the render pass completes. * * When a compositor provides a signal timeline, the renderer may skip diff --git a/types/output/render.c b/types/output/render.c index 155da5cf8..a2df53f0b 100644 --- a/types/output/render.c +++ b/types/output/render.c @@ -205,9 +205,21 @@ struct wlr_render_pass *wlr_output_begin_render_pass(struct wlr_output *output, return NULL; } + struct wlr_buffer_pass_options opts = {0}; + if (render_options != NULL) { + opts = *render_options; + } + if (state->committed & WLR_OUTPUT_STATE_COLOR_REPRESENTATION) { + opts.color_encoding = state->color_encoding; + opts.color_range = state->color_range; + } else { + opts.color_encoding = output->color_encoding; + opts.color_range = output->color_range; + } + struct wlr_renderer *renderer = output->renderer; assert(renderer != NULL); - struct wlr_render_pass *pass = wlr_renderer_begin_buffer_pass(renderer, buffer, render_options); + struct wlr_render_pass *pass = wlr_renderer_begin_buffer_pass(renderer, buffer, &opts); if (pass == NULL) { return NULL; }