From 39be67df4605adb15e4e1673a0e8820802aeefc1 Mon Sep 17 00:00:00 2001
From: Alexander Orzechowski <orzechowski.alexander@gmail.com>
Date: Fri, 14 Apr 2023 22:25:46 +0200
Subject: wlr_scene: Send presentation event before direct scanout output
 commit

We were doing it too late before and surfaces were never getting
the presentation event.
---
 types/scene/wlr_scene.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c
index c33461f1..d5ebd64f 100644
--- a/types/scene/wlr_scene.c
+++ b/types/scene/wlr_scene.c
@@ -1541,6 +1541,8 @@ static bool scene_buffer_try_direct_scanout(struct wlr_scene_buffer *buffer,
 		return false;
 	}
 
+	wl_signal_emit_mutable(&buffer->events.output_present, scene_output);
+
 	state.committed |= WLR_OUTPUT_STATE_DAMAGE;
 	get_frame_damage(scene_output, &state.damage);
 	bool ok = wlr_output_commit_state(scene_output->output, &state);
@@ -1621,11 +1623,6 @@ bool wlr_scene_output_commit(struct wlr_scene_output *scene_output) {
 	}
 
 	if (scanout) {
-		struct wlr_scene_node *node = list_data[0];
-
-		assert(node->type == WLR_SCENE_NODE_BUFFER);
-		struct wlr_scene_buffer *buffer = wlr_scene_buffer_from_node(node);
-		wl_signal_emit_mutable(&buffer->events.output_present, scene_output);
 		return true;
 	}
 
-- 
cgit v1.2.3