mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-22 09:59:48 +01:00
gamma-control-v1: stop applying gamma LUTs implicitly
Make the compositor responsible for doing that, so that they can properly integrate with their output commit sequence.
This commit is contained in:
parent
ec9b79ef19
commit
36376e2ddf
2 changed files with 0 additions and 42 deletions
|
@ -31,7 +31,6 @@ struct wlr_gamma_control_v1 {
|
|||
uint16_t *table;
|
||||
size_t ramp_size;
|
||||
|
||||
struct wl_listener output_commit_listener;
|
||||
struct wl_listener output_destroy_listener;
|
||||
|
||||
void *data;
|
||||
|
|
|
@ -25,13 +25,8 @@ static void gamma_control_destroy(struct wlr_gamma_control_v1 *gamma_control) {
|
|||
struct wlr_gamma_control_manager_v1 *manager = gamma_control->manager;
|
||||
struct wlr_output *output = gamma_control->output;
|
||||
|
||||
wlr_output_set_gamma(gamma_control->output, 0, NULL, NULL, NULL);
|
||||
// Gamma LUT will be applied on next output commit
|
||||
wlr_output_schedule_frame(gamma_control->output);
|
||||
|
||||
wl_resource_set_user_data(gamma_control->resource, NULL);
|
||||
wl_list_remove(&gamma_control->output_destroy_listener.link);
|
||||
wl_list_remove(&gamma_control->output_commit_listener.link);
|
||||
wl_list_remove(&gamma_control->link);
|
||||
free(gamma_control->table);
|
||||
free(gamma_control);
|
||||
|
@ -42,22 +37,6 @@ static void gamma_control_destroy(struct wlr_gamma_control_v1 *gamma_control) {
|
|||
wl_signal_emit_mutable(&manager->events.set_gamma, &event);
|
||||
}
|
||||
|
||||
static void gamma_control_apply(struct wlr_gamma_control_v1 *gamma_control) {
|
||||
uint16_t *r = gamma_control->table;
|
||||
uint16_t *g = gamma_control->table + gamma_control->ramp_size;
|
||||
uint16_t *b = gamma_control->table + 2 * gamma_control->ramp_size;
|
||||
|
||||
wlr_output_set_gamma(gamma_control->output, gamma_control->ramp_size, r, g, b);
|
||||
if (!wlr_output_test(gamma_control->output)) {
|
||||
wlr_output_rollback(gamma_control->output);
|
||||
wlr_gamma_control_v1_send_failed_and_destroy(gamma_control);
|
||||
return;
|
||||
}
|
||||
|
||||
// Gamma LUT will be applied on next output commit
|
||||
wlr_output_schedule_frame(gamma_control->output);
|
||||
}
|
||||
|
||||
static const struct zwlr_gamma_control_v1_interface gamma_control_impl;
|
||||
|
||||
static struct wlr_gamma_control_v1 *gamma_control_from_resource(
|
||||
|
@ -80,17 +59,6 @@ static void gamma_control_handle_output_destroy(struct wl_listener *listener,
|
|||
gamma_control_destroy(gamma_control);
|
||||
}
|
||||
|
||||
static void gamma_control_handle_output_commit(struct wl_listener *listener,
|
||||
void *data) {
|
||||
struct wlr_gamma_control_v1 *gamma_control =
|
||||
wl_container_of(listener, gamma_control, output_commit_listener);
|
||||
struct wlr_output_event_commit *event = data;
|
||||
if ((event->committed & WLR_OUTPUT_STATE_ENABLED) &&
|
||||
gamma_control->output->enabled) {
|
||||
gamma_control_apply(gamma_control);
|
||||
}
|
||||
}
|
||||
|
||||
static void gamma_control_handle_set_gamma(struct wl_client *client,
|
||||
struct wl_resource *gamma_control_resource, int fd) {
|
||||
struct wlr_gamma_control_v1 *gamma_control =
|
||||
|
@ -140,10 +108,6 @@ static void gamma_control_handle_set_gamma(struct wl_client *client,
|
|||
gamma_control->table = table;
|
||||
gamma_control->ramp_size = ramp_size;
|
||||
|
||||
if (gamma_control->output->enabled) {
|
||||
gamma_control_apply(gamma_control);
|
||||
}
|
||||
|
||||
struct wlr_gamma_control_manager_v1_set_gamma_event event = {
|
||||
.output = gamma_control->output,
|
||||
.control = gamma_control,
|
||||
|
@ -222,11 +186,6 @@ static void gamma_control_manager_get_gamma_control(struct wl_client *client,
|
|||
gamma_control->output_destroy_listener.notify =
|
||||
gamma_control_handle_output_destroy;
|
||||
|
||||
wl_signal_add(&output->events.commit,
|
||||
&gamma_control->output_commit_listener);
|
||||
gamma_control->output_commit_listener.notify =
|
||||
gamma_control_handle_output_commit;
|
||||
|
||||
wl_list_insert(&manager->controls, &gamma_control->link);
|
||||
zwlr_gamma_control_v1_send_gamma_size(gamma_control->resource, gamma_size);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue