[PATCH 1/2] compositor: move setup of scanout surface out of wlsc_output_repaint

Tiago Vignatti tiago.vignatti at intel.com
Tue Oct 18 07:02:06 PDT 2011


From: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira at intel.com>

Move this to a separate function to better accommodate changes in the
following commit.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira at intel.com>
---
 compositor/compositor.c |   27 ++++++++++++++++++---------
 1 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/compositor/compositor.c b/compositor/compositor.c
index d2e8ce7..57cbd10 100644
--- a/compositor/compositor.c
+++ b/compositor/compositor.c
@@ -837,6 +837,23 @@ out:
 	pixman_region32_fini(&cursor_region);
 }
 
+static int
+setup_scanout_surface(struct wlsc_output *output, struct wlsc_surface *es)
+{
+	if (es->visual != WLSC_RGB_VISUAL ||
+	    output->prepare_scanout_surface(output, es) != 0)
+		return 0;
+
+	output->scanout_buffer = es->buffer;
+	output->scanout_buffer->busy_count++;
+
+	wl_list_remove(&output->scanout_buffer_destroy_listener.link);
+	wl_list_insert(output->scanout_buffer->resource.destroy_listener_list.prev,
+		       &output->scanout_buffer_destroy_listener.link);
+
+	return 1;
+}
+
 static void
 wlsc_output_repaint(struct wlsc_output *output)
 {
@@ -879,19 +896,11 @@ wlsc_output_repaint(struct wlsc_output *output)
 
 	es = container_of(ec->surface_list.next, struct wlsc_surface, link);
 
-	if (es->visual == WLSC_RGB_VISUAL &&
-	    output->prepare_scanout_surface(output, es) == 0) {
+	if (setup_scanout_surface(output, es)) {
 		/* We're drawing nothing now,
 		 * draw the damaged regions later. */
 		pixman_region32_union(&ec->damage, &ec->damage, &total_damage);
 
-		output->scanout_buffer = es->buffer;
-		output->scanout_buffer->busy_count++;
-
-		wl_list_remove(&output->scanout_buffer_destroy_listener.link);
-		wl_list_insert(output->scanout_buffer->resource.destroy_listener_list.prev,
-			       &output->scanout_buffer_destroy_listener.link);
-
 		return;
 	}
 
-- 
1.7.4.1



More information about the wayland-devel mailing list