From 03712270ef96cb5c2ee5adaf8c2954ae2a487d11 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sun, 31 May 2026 22:41:18 +0200 Subject: [PATCH] output: rename color_transform to post_color_transform We'll soon introduce pre_color_transform for the pre-blending counterpart. --- backend/drm/atomic.c | 6 +++--- backend/drm/drm.c | 6 +++--- backend/drm/legacy.c | 6 +++--- include/wlr/types/wlr_output.h | 11 ++++++----- types/output/output.c | 20 ++++++++++---------- types/output/state.c | 20 ++++++++++---------- types/scene/wlr_scene.c | 2 +- types/wlr_gamma_control_v1.c | 2 +- 8 files changed, 37 insertions(+), 36 deletions(-) diff --git a/backend/drm/atomic.c b/backend/drm/atomic.c index daa8ba9bf..abccf4c38 100644 --- a/backend/drm/atomic.c +++ b/backend/drm/atomic.c @@ -332,12 +332,12 @@ bool drm_atomic_connector_prepare(struct wlr_drm_connector_state *state, bool mo } uint32_t gamma_lut = crtc->gamma_lut; - if (state->base->committed & WLR_OUTPUT_STATE_COLOR_TRANSFORM) { + if (state->base->committed & WLR_OUTPUT_STATE_POST_COLOR_TRANSFORM) { size_t dim = 0; uint16_t *lut = NULL; - if (state->base->color_transform != NULL) { + if (state->base->post_color_transform != NULL) { struct wlr_color_transform_lut_3x1d *tr = - color_transform_lut_3x1d_from_base(state->base->color_transform); + color_transform_lut_3x1d_from_base(state->base->post_color_transform); dim = tr->dim; lut = tr->lut_3x1d; } diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 979cd8e78..76decd758 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -42,7 +42,7 @@ static const uint32_t COMMIT_OUTPUT_STATE = WLR_OUTPUT_STATE_LAYERS | WLR_OUTPUT_STATE_WAIT_TIMELINE | WLR_OUTPUT_STATE_SIGNAL_TIMELINE | - WLR_OUTPUT_STATE_COLOR_TRANSFORM | + WLR_OUTPUT_STATE_POST_COLOR_TRANSFORM | WLR_OUTPUT_STATE_IMAGE_DESCRIPTION | WLR_OUTPUT_STATE_COLOR_REPRESENTATION; @@ -960,8 +960,8 @@ static bool drm_connector_prepare(struct wlr_drm_connector_state *conn_state, bo } } - if ((state->committed & WLR_OUTPUT_STATE_COLOR_TRANSFORM) && state->color_transform != NULL && - state->color_transform->type != COLOR_TRANSFORM_LUT_3X1D) { + if ((state->committed & WLR_OUTPUT_STATE_POST_COLOR_TRANSFORM) && state->post_color_transform != NULL && + state->post_color_transform->type != COLOR_TRANSFORM_LUT_3X1D) { wlr_drm_conn_log(conn, WLR_DEBUG, "Only 3x1D LUT color transforms are supported"); return false; diff --git a/backend/drm/legacy.c b/backend/drm/legacy.c index 223852ec1..96fe19883 100644 --- a/backend/drm/legacy.c +++ b/backend/drm/legacy.c @@ -125,12 +125,12 @@ static bool legacy_crtc_commit(const struct wlr_drm_connector_state *state, } } - if (state->base->committed & WLR_OUTPUT_STATE_COLOR_TRANSFORM) { + if (state->base->committed & WLR_OUTPUT_STATE_POST_COLOR_TRANSFORM) { size_t dim = 0; uint16_t *lut = NULL; - if (state->base->color_transform != NULL) { + if (state->base->post_color_transform != NULL) { struct wlr_color_transform_lut_3x1d *tr = - color_transform_lut_3x1d_from_base(state->base->color_transform); + color_transform_lut_3x1d_from_base(state->base->post_color_transform); dim = tr->dim; lut = tr->lut_3x1d; } diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index c8e44b0e6..103e57555 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -75,7 +75,7 @@ enum wlr_output_state_field { WLR_OUTPUT_STATE_LAYERS = 1 << 9, WLR_OUTPUT_STATE_WAIT_TIMELINE = 1 << 10, WLR_OUTPUT_STATE_SIGNAL_TIMELINE = 1 << 11, - WLR_OUTPUT_STATE_COLOR_TRANSFORM = 1 << 12, + WLR_OUTPUT_STATE_POST_COLOR_TRANSFORM = 1 << 12, WLR_OUTPUT_STATE_IMAGE_DESCRIPTION = 1 << 13, WLR_OUTPUT_STATE_COLOR_REPRESENTATION = 1 << 14, }; @@ -162,7 +162,8 @@ struct wlr_output_state { struct wlr_drm_syncobj_timeline *signal_timeline; uint64_t signal_point; - struct wlr_color_transform *color_transform; + // Post-blending color transform + struct wlr_color_transform *post_color_transform; struct wlr_output_image_description *image_description; }; @@ -276,7 +277,7 @@ struct wlr_output { struct { struct wl_listener display_destroy; struct wlr_output_image_description image_description_value; - struct wlr_color_transform *color_transform; + struct wlr_color_transform *post_color_transform; struct wlr_color_primaries default_primaries_value; } WLR_PRIVATE; }; @@ -619,11 +620,11 @@ void wlr_output_state_set_wait_timeline(struct wlr_output_state *state, void wlr_output_state_set_signal_timeline(struct wlr_output_state *state, struct wlr_drm_syncobj_timeline *timeline, uint64_t dst_point); /** - * Set the color transform for an output. + * Set the post-blending color transform for an output. * * The color transform is applied after blending output layers. */ -void wlr_output_state_set_color_transform(struct wlr_output_state *state, +void wlr_output_state_set_post_color_transform(struct wlr_output_state *state, struct wlr_color_transform *tr); /** diff --git a/types/output/output.c b/types/output/output.c index 46da1f425..3f13eec2f 100644 --- a/types/output/output.c +++ b/types/output/output.c @@ -252,12 +252,12 @@ static void output_apply_state(struct wlr_output *output, } } - if (state->committed & WLR_OUTPUT_STATE_COLOR_TRANSFORM) { - wlr_color_transform_unref(output->color_transform); - if (state->color_transform != NULL) { - output->color_transform = wlr_color_transform_ref(state->color_transform); + if (state->committed & WLR_OUTPUT_STATE_POST_COLOR_TRANSFORM) { + wlr_color_transform_unref(output->post_color_transform); + if (state->post_color_transform != NULL) { + output->post_color_transform = wlr_color_transform_ref(state->post_color_transform); } else { - output->color_transform = NULL; + output->post_color_transform = NULL; } } @@ -426,7 +426,7 @@ void wlr_output_finish(struct wlr_output *output) { wlr_swapchain_destroy(output->cursor_swapchain); wlr_buffer_unlock(output->cursor_front_buffer); - wlr_color_transform_unref(output->color_transform); + wlr_color_transform_unref(output->post_color_transform); wlr_swapchain_destroy(output->swapchain); @@ -581,9 +581,9 @@ static uint32_t output_compare_state(struct wlr_output *output, output->subpixel == state->subpixel) { fields |= WLR_OUTPUT_STATE_SUBPIXEL; } - if ((state->committed & WLR_OUTPUT_STATE_COLOR_TRANSFORM) && - output->color_transform == state->color_transform) { - fields |= WLR_OUTPUT_STATE_COLOR_TRANSFORM; + if ((state->committed & WLR_OUTPUT_STATE_POST_COLOR_TRANSFORM) && + output->post_color_transform == state->post_color_transform) { + fields |= WLR_OUTPUT_STATE_POST_COLOR_TRANSFORM; } if ((state->committed & WLR_OUTPUT_STATE_COLOR_REPRESENTATION) && output->color_encoding == state->color_encoding && @@ -685,7 +685,7 @@ static bool output_basic_test(struct wlr_output *output, { WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED, "adaptive sync" }, { WLR_OUTPUT_STATE_RENDER_FORMAT, "render format" }, { WLR_OUTPUT_STATE_SUBPIXEL, "subpixel" }, - { WLR_OUTPUT_STATE_COLOR_TRANSFORM, "color transform" }, + { WLR_OUTPUT_STATE_POST_COLOR_TRANSFORM, "post color transform" }, { WLR_OUTPUT_STATE_IMAGE_DESCRIPTION, "image description" }, }; if (!enabled) { diff --git a/types/output/state.c b/types/output/state.c index 5f44c18e8..94764e69a 100644 --- a/types/output/state.c +++ b/types/output/state.c @@ -19,7 +19,7 @@ void wlr_output_state_finish(struct wlr_output_state *state) { pixman_region32_fini(&state->damage); wlr_drm_syncobj_timeline_unref(state->wait_timeline); wlr_drm_syncobj_timeline_unref(state->signal_timeline); - wlr_color_transform_unref(state->color_transform); + wlr_color_transform_unref(state->post_color_transform); free(state->image_description); } @@ -113,14 +113,14 @@ void wlr_output_state_set_signal_timeline(struct wlr_output_state *state, state->signal_point = dst_point; } -void wlr_output_state_set_color_transform(struct wlr_output_state *state, +void wlr_output_state_set_post_color_transform(struct wlr_output_state *state, struct wlr_color_transform *tr) { - state->committed |= WLR_OUTPUT_STATE_COLOR_TRANSFORM; - wlr_color_transform_unref(state->color_transform); + state->committed |= WLR_OUTPUT_STATE_POST_COLOR_TRANSFORM; + wlr_color_transform_unref(state->post_color_transform); if (tr) { - state->color_transform = wlr_color_transform_ref(tr); + state->post_color_transform = wlr_color_transform_ref(tr); } else { - state->color_transform = NULL; + state->post_color_transform = NULL; } } @@ -156,7 +156,7 @@ bool wlr_output_state_copy(struct wlr_output_state *dst, WLR_OUTPUT_STATE_DAMAGE | WLR_OUTPUT_STATE_WAIT_TIMELINE | WLR_OUTPUT_STATE_SIGNAL_TIMELINE | - WLR_OUTPUT_STATE_COLOR_TRANSFORM | + WLR_OUTPUT_STATE_POST_COLOR_TRANSFORM | WLR_OUTPUT_STATE_IMAGE_DESCRIPTION); copy.buffer = NULL; copy.buffer_src_box = (struct wlr_fbox){0}; @@ -164,7 +164,7 @@ bool wlr_output_state_copy(struct wlr_output_state *dst, pixman_region32_init(©.damage); copy.wait_timeline = NULL; copy.signal_timeline = NULL; - copy.color_transform = NULL; + copy.post_color_transform = NULL; copy.image_description = NULL; if (src->committed & WLR_OUTPUT_STATE_BUFFER) { @@ -186,8 +186,8 @@ bool wlr_output_state_copy(struct wlr_output_state *dst, src->signal_point); } - if (src->committed & WLR_OUTPUT_STATE_COLOR_TRANSFORM) { - wlr_output_state_set_color_transform(©, src->color_transform); + if (src->committed & WLR_OUTPUT_STATE_POST_COLOR_TRANSFORM) { + wlr_output_state_set_post_color_transform(©, src->post_color_transform); } if (src->committed & WLR_OUTPUT_STATE_IMAGE_DESCRIPTION) { if (!wlr_output_state_set_image_description(©, src->image_description)) { diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c index 7e4a81004..fb63f025b 100644 --- a/types/scene/wlr_scene.c +++ b/types/scene/wlr_scene.c @@ -2180,7 +2180,7 @@ static void scene_output_state_attempt_gamma(struct wlr_scene_output *scene_outp return; } - wlr_output_state_set_color_transform(&gamma_pending, scene_output->gamma_lut_color_transform); + wlr_output_state_set_post_color_transform(&gamma_pending, scene_output->gamma_lut_color_transform); scene_output->gamma_lut_changed = false; if (!wlr_output_test_state(scene_output->output, &gamma_pending)) { diff --git a/types/wlr_gamma_control_v1.c b/types/wlr_gamma_control_v1.c index 42d14799d..0f3b40792 100644 --- a/types/wlr_gamma_control_v1.c +++ b/types/wlr_gamma_control_v1.c @@ -288,7 +288,7 @@ bool wlr_gamma_control_v1_apply(struct wlr_gamma_control_v1 *gamma_control, } } - wlr_output_state_set_color_transform(output_state, tr); + wlr_output_state_set_post_color_transform(output_state, tr); return true; }