Pass output color encoding & range to renderer

Signed-off-by: Andri Yngvason <andri@yngvason.is>
This commit is contained in:
Andri Yngvason 2026-05-18 17:33:32 +00:00
parent 99235f7142
commit 20c2085057
2 changed files with 18 additions and 1 deletions

View file

@ -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

View file

@ -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;
}