[PATCH weston v2 2/5] compositor: Buffer all frame callbacks in 'weston_surface'

Jonas Ådahl jadahl at gmail.com
Mon Jun 11 13:03:03 PDT 2012


Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
---
 src/compositor.c |   28 +++++++++++-----------------
 src/compositor.h |    1 -
 2 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index 983e4f5..9d9145b 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1053,9 +1053,16 @@ weston_output_repaint(struct weston_output *output, int msecs)
 	weston_compositor_repick(ec);
 	wl_event_loop_dispatch(ec->input_loop, 0);
 
-	wl_list_for_each_safe(cb, cnext, &output->frame_callback_list, link) {
-		wl_callback_send_done(&cb->resource, msecs);
-		wl_resource_destroy(&cb->resource);
+	wl_list_for_each(es, &ec->surface_list, link) {
+		if (es->output == output) {
+			wl_list_for_each_safe(cb, cnext,
+					      &es->frame_callback_list,
+					      link) {
+				wl_callback_send_done(&cb->resource, msecs);
+				wl_resource_destroy(&cb->resource);
+			}
+			wl_list_init(&es->frame_callback_list);
+		}
 	}
 
 	wl_list_for_each_safe(animation, next, &output->animation_list, link) {
@@ -1256,12 +1263,6 @@ weston_surface_assign_output(struct weston_surface *es)
 
 	es->output = new_output;
 	weston_surface_update_output_mask(es, mask);
-
-	if (!wl_list_empty(&es->frame_callback_list)) {
-		wl_list_insert_list(new_output->frame_callback_list.prev,
-				    &es->frame_callback_list);
-		wl_list_init(&es->frame_callback_list);
-	}
 }
 
 static void
@@ -1350,13 +1351,7 @@ surface_frame(struct wl_client *client,
 	cb->resource.data = cb;
 
 	wl_client_add_resource(client, &cb->resource);
-
-	if (es->output) {
-		wl_list_insert(es->output->frame_callback_list.prev,
-			       &cb->link);
-	} else {
-		wl_list_insert(es->frame_callback_list.prev, &cb->link);
-	}
+	wl_list_insert(es->frame_callback_list.prev, &cb->link);
 }
 
 static void
@@ -2845,7 +2840,6 @@ weston_output_init(struct weston_output *output, struct weston_compositor *c,
 	weston_output_damage(output);
 
 	wl_signal_init(&output->frame_signal);
-	wl_list_init(&output->frame_callback_list);
 	wl_list_init(&output->animation_list);
 	wl_list_init(&output->resource_list);
 
diff --git a/src/compositor.h b/src/compositor.h
index e8e8ecf..d1ffdea 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -130,7 +130,6 @@ struct weston_output {
 	struct wl_global *global;
 	struct weston_compositor *compositor;
 	struct weston_matrix matrix;
-	struct wl_list frame_callback_list;
 	struct wl_list animation_list;
 	int32_t x, y, mm_width, mm_height;
 	struct weston_border border;
-- 
1.7.9.5



More information about the wayland-devel mailing list