diff options
author | 2024-07-01 09:21:53 +0200 | |
---|---|---|
committer | 2024-07-01 09:21:53 +0200 | |
commit | 1e0031781fc9283db7096aba34deca5503c2ab91 (patch) | |
tree | 4b15586c9fbd8cd8e0808a2e7a1d91b55fa97271 | |
parent | view: send scale notification when the output is known (diff) | |
download | sway-1e0031781fc9283db7096aba34deca5503c2ab91.tar.gz sway-1e0031781fc9283db7096aba34deca5503c2ab91.tar.zst sway-1e0031781fc9283db7096aba34deca5503c2ab91.zip |
desktop/output: unify page-flip codepath
Instead of having a special codepath for applying gamma LUTs, have
a single codepath for regular page-flips and gamma LUT updates.
Should make it easier to add more logic on top e.g. for tearing
page-flips.
-rw-r--r-- | sway/desktop/output.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 6bf77d17..4c9d0b63 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -247,13 +247,13 @@ static int output_repaint_timer_handler(void *data) { | |||
247 | .color_transform = output->color_transform, | 247 | .color_transform = output->color_transform, |
248 | }; | 248 | }; |
249 | 249 | ||
250 | if (output->gamma_lut_changed) { | 250 | struct wlr_output_state pending; |
251 | struct wlr_output_state pending; | 251 | wlr_output_state_init(&pending); |
252 | wlr_output_state_init(&pending); | 252 | if (!wlr_scene_output_build_state(output->scene_output, &pending, &opts)) { |
253 | if (!wlr_scene_output_build_state(output->scene_output, &pending, &opts)) { | 253 | return 0; |
254 | return 0; | 254 | } |
255 | } | ||
256 | 255 | ||
256 | if (output->gamma_lut_changed) { | ||
257 | output->gamma_lut_changed = false; | 257 | output->gamma_lut_changed = false; |
258 | struct wlr_gamma_control_v1 *gamma_control = | 258 | struct wlr_gamma_control_v1 *gamma_control = |
259 | wlr_gamma_control_manager_v1_get_control( | 259 | wlr_gamma_control_manager_v1_get_control( |
@@ -263,17 +263,16 @@ static int output_repaint_timer_handler(void *data) { | |||
263 | return 0; | 263 | return 0; |
264 | } | 264 | } |
265 | 265 | ||
266 | if (!wlr_output_commit_state(output->wlr_output, &pending)) { | 266 | if (!wlr_output_test_state(output->wlr_output, &pending)) { |
267 | wlr_gamma_control_v1_send_failed_and_destroy(gamma_control); | 267 | wlr_gamma_control_v1_send_failed_and_destroy(gamma_control); |
268 | wlr_output_state_finish(&pending); | 268 | wlr_output_state_set_gamma_lut(&pending, 0, NULL, NULL, NULL); |
269 | return 0; | ||
270 | } | 269 | } |
271 | |||
272 | wlr_output_state_finish(&pending); | ||
273 | return 0; | ||
274 | } | 270 | } |
275 | 271 | ||
276 | wlr_scene_output_commit(output->scene_output, &opts); | 272 | if (!wlr_output_commit_state(output->wlr_output, &pending)) { |
273 | sway_log(SWAY_ERROR, "Page-flip failed on output %s", output->wlr_output->name); | ||
274 | } | ||
275 | wlr_output_state_finish(&pending); | ||
277 | return 0; | 276 | return 0; |
278 | } | 277 | } |
279 | 278 | ||