aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Orzechowski <alex@ozal.ski>2023-06-12 16:30:00 -0400
committerSimon Ser <contact@emersion.fr>2023-06-22 11:56:30 +0200
commitb5eaa4704947d3793150079c5add3132998cbe4b (patch)
treeafdbd63dca874c50fee79893966eaaa8050018e0
parent4b7c52657806df8e8b7fb556bf6489d7f5ace1e0 (diff)
scene: Use wlr_output_state_copy for direct scanout path
-rw-r--r--types/scene/wlr_scene.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c
index d20916a7..0e200fcf 100644
--- a/types/scene/wlr_scene.c
+++ b/types/scene/wlr_scene.c
@@ -1534,22 +1534,26 @@ static bool scene_buffer_can_consider_direct_scanout(struct wlr_scene_buffer *bu
static bool scene_buffer_try_direct_scanout(struct wlr_scene_buffer *buffer,
struct wlr_scene_output *scene_output, struct wlr_output_state *state) {
- wlr_output_state_set_buffer(state, buffer->buffer);
+ struct wlr_output_state pending = {0};
+ if (!wlr_output_state_copy(&pending, state)) {
+ return false;
+ }
+
+ wlr_output_state_set_buffer(&pending, buffer->buffer);
pixman_region32_t frame_damage;
get_frame_damage(scene_output, &frame_damage);
- wlr_output_state_set_damage(state, &frame_damage);
+ wlr_output_state_set_damage(&pending, &frame_damage);
pixman_region32_fini(&frame_damage);
- if (!wlr_output_test_state(scene_output->output, state)) {
- // reset buffer and damage
- state->committed &= ~(WLR_OUTPUT_STATE_BUFFER | WLR_OUTPUT_STATE_DAMAGE);
- wlr_buffer_unlock(state->buffer);
- pixman_region32_fini(&state->damage);
-
+ if (!wlr_output_test_state(scene_output->output, &pending)) {
+ wlr_output_state_finish(&pending);
return false;
}
+ wlr_output_state_copy(state, &pending);
+ wlr_output_state_finish(&pending);
+
wl_signal_emit_mutable(&buffer->events.output_present, scene_output);
return true;
}