output: drop gamma LUT from state

This has been superseded by color transforms.
This commit is contained in:
Simon Ser 2024-08-24 11:16:22 +02:00 committed by Kenny Levinsen
parent bfcb4211f6
commit a30c102163
3 changed files with 6 additions and 64 deletions

View file

@ -68,13 +68,12 @@ enum wlr_output_state_field {
WLR_OUTPUT_STATE_SCALE = 1 << 4, WLR_OUTPUT_STATE_SCALE = 1 << 4,
WLR_OUTPUT_STATE_TRANSFORM = 1 << 5, WLR_OUTPUT_STATE_TRANSFORM = 1 << 5,
WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED = 1 << 6, WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED = 1 << 6,
WLR_OUTPUT_STATE_GAMMA_LUT = 1 << 7, WLR_OUTPUT_STATE_RENDER_FORMAT = 1 << 7,
WLR_OUTPUT_STATE_RENDER_FORMAT = 1 << 8, WLR_OUTPUT_STATE_SUBPIXEL = 1 << 8,
WLR_OUTPUT_STATE_SUBPIXEL = 1 << 9, WLR_OUTPUT_STATE_LAYERS = 1 << 9,
WLR_OUTPUT_STATE_LAYERS = 1 << 10, WLR_OUTPUT_STATE_WAIT_TIMELINE = 1 << 10,
WLR_OUTPUT_STATE_WAIT_TIMELINE = 1 << 11, WLR_OUTPUT_STATE_SIGNAL_TIMELINE = 1 << 11,
WLR_OUTPUT_STATE_SIGNAL_TIMELINE = 1 << 12, WLR_OUTPUT_STATE_COLOR_TRANSFORM = 1 << 12,
WLR_OUTPUT_STATE_COLOR_TRANSFORM = 1 << 13,
}; };
enum wlr_output_state_mode_type { enum wlr_output_state_mode_type {
@ -123,9 +122,6 @@ struct wlr_output_state {
int32_t refresh; // mHz, may be zero int32_t refresh; // mHz, may be zero
} custom_mode; } custom_mode;
uint16_t *gamma_lut;
size_t gamma_lut_size;
struct wlr_output_layer_state *layers; struct wlr_output_layer_state *layers;
size_t layers_len; size_t layers_len;
@ -530,17 +526,6 @@ void wlr_output_state_set_subpixel(struct wlr_output_state *state,
*/ */
void wlr_output_state_set_buffer(struct wlr_output_state *state, void wlr_output_state_set_buffer(struct wlr_output_state *state,
struct wlr_buffer *buffer); struct wlr_buffer *buffer);
/**
* Sets the gamma table for an output. `r`, `g` and `b` are gamma ramps for
* red, green and blue. `size` is the length of the ramps and must not exceed
* the value returned by wlr_output_get_gamma_size().
*
* Providing zero-sized ramps resets the gamma table.
*
* This state will be applied once wlr_output_commit_state() is called.
*/
bool wlr_output_state_set_gamma_lut(struct wlr_output_state *state,
size_t ramp_size, const uint16_t *r, const uint16_t *g, const uint16_t *b);
/** /**
* Sets the damage region for an output. This is used as a hint to the backend * Sets the damage region for an output. This is used as a hint to the backend
* and can be used to reduce power consumption or increase performance on some * and can be used to reduce power consumption or increase performance on some

View file

@ -643,10 +643,6 @@ static bool output_basic_test(struct wlr_output *output,
wlr_log(WLR_DEBUG, "Tried to set format for a disabled output"); wlr_log(WLR_DEBUG, "Tried to set format for a disabled output");
return false; return false;
} }
if (!enabled && state->committed & WLR_OUTPUT_STATE_GAMMA_LUT) {
wlr_log(WLR_DEBUG, "Tried to set the gamma lut on a disabled output");
return false;
}
if (!enabled && state->committed & WLR_OUTPUT_STATE_SUBPIXEL) { if (!enabled && state->committed & WLR_OUTPUT_STATE_SUBPIXEL) {
wlr_log(WLR_DEBUG, "Tried to set the subpixel layout on a disabled output"); wlr_log(WLR_DEBUG, "Tried to set the subpixel layout on a disabled output");
return false; return false;

View file

@ -17,7 +17,6 @@ void wlr_output_state_finish(struct wlr_output_state *state) {
// reads it after output_state_finish(). // reads it after output_state_finish().
state->buffer = NULL; state->buffer = NULL;
pixman_region32_fini(&state->damage); pixman_region32_fini(&state->damage);
free(state->gamma_lut);
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);
} }
@ -89,28 +88,6 @@ void wlr_output_state_set_damage(struct wlr_output_state *state,
pixman_region32_copy(&state->damage, damage); pixman_region32_copy(&state->damage, damage);
} }
bool wlr_output_state_set_gamma_lut(struct wlr_output_state *state,
size_t ramp_size, const uint16_t *r, const uint16_t *g, const uint16_t *b) {
uint16_t *gamma_lut = NULL;
if (ramp_size > 0) {
gamma_lut = realloc(state->gamma_lut, 3 * ramp_size * sizeof(uint16_t));
if (gamma_lut == NULL) {
wlr_log_errno(WLR_ERROR, "Allocation failed");
return false;
}
memcpy(gamma_lut, r, ramp_size * sizeof(uint16_t));
memcpy(gamma_lut + ramp_size, g, ramp_size * sizeof(uint16_t));
memcpy(gamma_lut + 2 * ramp_size, b, ramp_size * sizeof(uint16_t));
} else {
free(state->gamma_lut);
}
state->committed |= WLR_OUTPUT_STATE_GAMMA_LUT;
state->gamma_lut_size = ramp_size;
state->gamma_lut = gamma_lut;
return true;
}
void wlr_output_state_set_layers(struct wlr_output_state *state, void wlr_output_state_set_layers(struct wlr_output_state *state,
struct wlr_output_layer_state *layers, size_t layers_len) { struct wlr_output_layer_state *layers, size_t layers_len) {
state->committed |= WLR_OUTPUT_STATE_LAYERS; state->committed |= WLR_OUTPUT_STATE_LAYERS;
@ -150,7 +127,6 @@ bool wlr_output_state_copy(struct wlr_output_state *dst,
struct wlr_output_state copy = *src; struct wlr_output_state copy = *src;
copy.committed &= ~(WLR_OUTPUT_STATE_BUFFER | copy.committed &= ~(WLR_OUTPUT_STATE_BUFFER |
WLR_OUTPUT_STATE_DAMAGE | WLR_OUTPUT_STATE_DAMAGE |
WLR_OUTPUT_STATE_GAMMA_LUT |
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_COLOR_TRANSFORM);
@ -158,8 +134,6 @@ bool wlr_output_state_copy(struct wlr_output_state *dst,
copy.buffer_src_box = (struct wlr_fbox){0}; copy.buffer_src_box = (struct wlr_fbox){0};
copy.buffer_dst_box = (struct wlr_box){0}; copy.buffer_dst_box = (struct wlr_box){0};
pixman_region32_init(&copy.damage); pixman_region32_init(&copy.damage);
copy.gamma_lut = NULL;
copy.gamma_lut_size = 0;
copy.wait_timeline = NULL; copy.wait_timeline = NULL;
copy.signal_timeline = NULL; copy.signal_timeline = NULL;
copy.color_transform = NULL; copy.color_transform = NULL;
@ -174,15 +148,6 @@ bool wlr_output_state_copy(struct wlr_output_state *dst,
wlr_output_state_set_damage(&copy, &src->damage); wlr_output_state_set_damage(&copy, &src->damage);
} }
if (src->committed & WLR_OUTPUT_STATE_GAMMA_LUT) {
const uint16_t *r = src->gamma_lut;
const uint16_t *g = src->gamma_lut + src->gamma_lut_size;
const uint16_t *b = src->gamma_lut + 2 * src->gamma_lut_size;
if (!wlr_output_state_set_gamma_lut(&copy, src->gamma_lut_size, r, g, b)) {
goto err;
}
}
if (src->committed & WLR_OUTPUT_STATE_WAIT_TIMELINE) { if (src->committed & WLR_OUTPUT_STATE_WAIT_TIMELINE) {
wlr_output_state_set_wait_timeline(&copy, src->wait_timeline, wlr_output_state_set_wait_timeline(&copy, src->wait_timeline,
src->wait_point); src->wait_point);
@ -199,8 +164,4 @@ bool wlr_output_state_copy(struct wlr_output_state *dst,
wlr_output_state_finish(dst); wlr_output_state_finish(dst);
*dst = copy; *dst = copy;
return true; return true;
err:
wlr_output_state_finish(&copy);
return false;
} }