output: rename color_transform to post_color_transform

We'll soon introduce pre_color_transform for the pre-blending
counterpart.
This commit is contained in:
Simon Ser 2026-05-31 22:41:18 +02:00
parent fd0a4dc40e
commit 03712270ef
8 changed files with 37 additions and 36 deletions

View file

@ -332,12 +332,12 @@ bool drm_atomic_connector_prepare(struct wlr_drm_connector_state *state, bool mo
} }
uint32_t gamma_lut = crtc->gamma_lut; 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; size_t dim = 0;
uint16_t *lut = NULL; uint16_t *lut = NULL;
if (state->base->color_transform != NULL) { if (state->base->post_color_transform != NULL) {
struct wlr_color_transform_lut_3x1d *tr = 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; dim = tr->dim;
lut = tr->lut_3x1d; lut = tr->lut_3x1d;
} }

View file

@ -42,7 +42,7 @@ static const uint32_t COMMIT_OUTPUT_STATE =
WLR_OUTPUT_STATE_LAYERS | WLR_OUTPUT_STATE_LAYERS |
WLR_OUTPUT_STATE_WAIT_TIMELINE | WLR_OUTPUT_STATE_WAIT_TIMELINE |
WLR_OUTPUT_STATE_SIGNAL_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_IMAGE_DESCRIPTION |
WLR_OUTPUT_STATE_COLOR_REPRESENTATION; 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 && if ((state->committed & WLR_OUTPUT_STATE_POST_COLOR_TRANSFORM) && state->post_color_transform != NULL &&
state->color_transform->type != COLOR_TRANSFORM_LUT_3X1D) { state->post_color_transform->type != COLOR_TRANSFORM_LUT_3X1D) {
wlr_drm_conn_log(conn, WLR_DEBUG, wlr_drm_conn_log(conn, WLR_DEBUG,
"Only 3x1D LUT color transforms are supported"); "Only 3x1D LUT color transforms are supported");
return false; return false;

View file

@ -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; size_t dim = 0;
uint16_t *lut = NULL; uint16_t *lut = NULL;
if (state->base->color_transform != NULL) { if (state->base->post_color_transform != NULL) {
struct wlr_color_transform_lut_3x1d *tr = 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; dim = tr->dim;
lut = tr->lut_3x1d; lut = tr->lut_3x1d;
} }

View file

@ -75,7 +75,7 @@ enum wlr_output_state_field {
WLR_OUTPUT_STATE_LAYERS = 1 << 9, WLR_OUTPUT_STATE_LAYERS = 1 << 9,
WLR_OUTPUT_STATE_WAIT_TIMELINE = 1 << 10, WLR_OUTPUT_STATE_WAIT_TIMELINE = 1 << 10,
WLR_OUTPUT_STATE_SIGNAL_TIMELINE = 1 << 11, 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_IMAGE_DESCRIPTION = 1 << 13,
WLR_OUTPUT_STATE_COLOR_REPRESENTATION = 1 << 14, WLR_OUTPUT_STATE_COLOR_REPRESENTATION = 1 << 14,
}; };
@ -162,7 +162,8 @@ struct wlr_output_state {
struct wlr_drm_syncobj_timeline *signal_timeline; struct wlr_drm_syncobj_timeline *signal_timeline;
uint64_t signal_point; 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; struct wlr_output_image_description *image_description;
}; };
@ -276,7 +277,7 @@ struct wlr_output {
struct { struct {
struct wl_listener display_destroy; struct wl_listener display_destroy;
struct wlr_output_image_description image_description_value; 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; struct wlr_color_primaries default_primaries_value;
} WLR_PRIVATE; } 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, void wlr_output_state_set_signal_timeline(struct wlr_output_state *state,
struct wlr_drm_syncobj_timeline *timeline, uint64_t dst_point); 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. * 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); struct wlr_color_transform *tr);
/** /**

View file

@ -252,12 +252,12 @@ static void output_apply_state(struct wlr_output *output,
} }
} }
if (state->committed & WLR_OUTPUT_STATE_COLOR_TRANSFORM) { if (state->committed & WLR_OUTPUT_STATE_POST_COLOR_TRANSFORM) {
wlr_color_transform_unref(output->color_transform); wlr_color_transform_unref(output->post_color_transform);
if (state->color_transform != NULL) { if (state->post_color_transform != NULL) {
output->color_transform = wlr_color_transform_ref(state->color_transform); output->post_color_transform = wlr_color_transform_ref(state->post_color_transform);
} else { } 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_swapchain_destroy(output->cursor_swapchain);
wlr_buffer_unlock(output->cursor_front_buffer); 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); wlr_swapchain_destroy(output->swapchain);
@ -581,9 +581,9 @@ static uint32_t output_compare_state(struct wlr_output *output,
output->subpixel == state->subpixel) { output->subpixel == state->subpixel) {
fields |= WLR_OUTPUT_STATE_SUBPIXEL; fields |= WLR_OUTPUT_STATE_SUBPIXEL;
} }
if ((state->committed & WLR_OUTPUT_STATE_COLOR_TRANSFORM) && if ((state->committed & WLR_OUTPUT_STATE_POST_COLOR_TRANSFORM) &&
output->color_transform == state->color_transform) { output->post_color_transform == state->post_color_transform) {
fields |= WLR_OUTPUT_STATE_COLOR_TRANSFORM; fields |= WLR_OUTPUT_STATE_POST_COLOR_TRANSFORM;
} }
if ((state->committed & WLR_OUTPUT_STATE_COLOR_REPRESENTATION) && if ((state->committed & WLR_OUTPUT_STATE_COLOR_REPRESENTATION) &&
output->color_encoding == state->color_encoding && 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_ADAPTIVE_SYNC_ENABLED, "adaptive sync" },
{ WLR_OUTPUT_STATE_RENDER_FORMAT, "render format" }, { WLR_OUTPUT_STATE_RENDER_FORMAT, "render format" },
{ WLR_OUTPUT_STATE_SUBPIXEL, "subpixel" }, { 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" }, { WLR_OUTPUT_STATE_IMAGE_DESCRIPTION, "image description" },
}; };
if (!enabled) { if (!enabled) {

View file

@ -19,7 +19,7 @@ void wlr_output_state_finish(struct wlr_output_state *state) {
pixman_region32_fini(&state->damage); pixman_region32_fini(&state->damage);
wlr_drm_syncobj_timeline_unref(state->wait_timeline); wlr_drm_syncobj_timeline_unref(state->wait_timeline);
wlr_drm_syncobj_timeline_unref(state->signal_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); 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; 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) { struct wlr_color_transform *tr) {
state->committed |= WLR_OUTPUT_STATE_COLOR_TRANSFORM; state->committed |= WLR_OUTPUT_STATE_POST_COLOR_TRANSFORM;
wlr_color_transform_unref(state->color_transform); wlr_color_transform_unref(state->post_color_transform);
if (tr) { if (tr) {
state->color_transform = wlr_color_transform_ref(tr); state->post_color_transform = wlr_color_transform_ref(tr);
} else { } 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_DAMAGE |
WLR_OUTPUT_STATE_WAIT_TIMELINE | WLR_OUTPUT_STATE_WAIT_TIMELINE |
WLR_OUTPUT_STATE_SIGNAL_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_IMAGE_DESCRIPTION);
copy.buffer = NULL; copy.buffer = NULL;
copy.buffer_src_box = (struct wlr_fbox){0}; 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(&copy.damage); pixman_region32_init(&copy.damage);
copy.wait_timeline = NULL; copy.wait_timeline = NULL;
copy.signal_timeline = NULL; copy.signal_timeline = NULL;
copy.color_transform = NULL; copy.post_color_transform = NULL;
copy.image_description = NULL; copy.image_description = NULL;
if (src->committed & WLR_OUTPUT_STATE_BUFFER) { if (src->committed & WLR_OUTPUT_STATE_BUFFER) {
@ -186,8 +186,8 @@ bool wlr_output_state_copy(struct wlr_output_state *dst,
src->signal_point); src->signal_point);
} }
if (src->committed & WLR_OUTPUT_STATE_COLOR_TRANSFORM) { if (src->committed & WLR_OUTPUT_STATE_POST_COLOR_TRANSFORM) {
wlr_output_state_set_color_transform(&copy, src->color_transform); wlr_output_state_set_post_color_transform(&copy, src->post_color_transform);
} }
if (src->committed & WLR_OUTPUT_STATE_IMAGE_DESCRIPTION) { if (src->committed & WLR_OUTPUT_STATE_IMAGE_DESCRIPTION) {
if (!wlr_output_state_set_image_description(&copy, src->image_description)) { if (!wlr_output_state_set_image_description(&copy, src->image_description)) {

View file

@ -2180,7 +2180,7 @@ static void scene_output_state_attempt_gamma(struct wlr_scene_output *scene_outp
return; 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; scene_output->gamma_lut_changed = false;
if (!wlr_output_test_state(scene_output->output, &gamma_pending)) { if (!wlr_output_test_state(scene_output->output, &gamma_pending)) {

View file

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