[PATCH 2/3] compositor: add an assign_planes hook to the output

Jesse Barnes jbarnes at virtuousgeek.org
Mon Jan 30 11:56:22 PST 2012


This allows each output back end to optimize drawing using overlay planes
and cursors (yet to be integrated).  If a surface is assigned to a
plane, the back end should clear its damage field so that the later
repaint code won't look at it.
---
 src/compositor-drm.c     |    1 +
 src/compositor-openwfd.c |    1 +
 src/compositor-wayland.c |    1 +
 src/compositor-x11.c     |    1 +
 src/compositor.c         |    9 +++++++++
 src/compositor.h         |    1 +
 6 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index de6feb4..adbd03c 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -618,6 +618,7 @@ create_output_for_connector(struct drm_compositor *ec,
 	output->base.repaint = drm_output_repaint;
 	output->base.set_hardware_cursor = drm_output_set_cursor;
 	output->base.destroy = drm_output_destroy;
+	output->base.assign_planes = NULL;
 
 	return 0;
 
diff --git a/src/compositor-openwfd.c b/src/compositor-openwfd.c
index aa4e5a9..8dce304 100644
--- a/src/compositor-openwfd.c
+++ b/src/compositor-openwfd.c
@@ -406,6 +406,7 @@ create_output_for_port(struct wfd_compositor *ec,
 		wfd_output_prepare_scanout_surface;
 	output->base.set_hardware_cursor = wfd_output_set_cursor;
 	output->base.destroy = wfd_output_destroy;
+	output->base.assign_planes = NULL;
 
 	wl_list_insert(ec->base.output_list.prev, &output->base.link);
 
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index 6eb0cd0..bf434b5 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -278,6 +278,7 @@ wayland_compositor_create_output(struct wayland_compositor *c,
 	output->base.repaint = wayland_output_repaint;
 	output->base.set_hardware_cursor = wayland_output_set_cursor;
 	output->base.destroy = wayland_output_destroy;
+	output->base.assign_planes = NULL;
 
 	wl_list_insert(c->base.output_list.prev, &output->base.link);
 
diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index 0e58229..9748af7 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -448,6 +448,7 @@ x11_compositor_create_output(struct x11_compositor *c, int x, int y,
 	output->base.repaint = x11_output_repaint;
 	output->base.set_hardware_cursor = x11_output_set_cursor;
 	output->base.destroy = x11_output_destroy;
+	output->base.assign_planes = NULL;
 
 	wl_list_insert(c->base.output_list.prev, &output->base.link);
 
diff --git a/src/compositor.c b/src/compositor.c
index 89981f1..6fb837e 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -919,6 +919,15 @@ weston_output_repaint(struct weston_output *output, int msecs)
 				      &es->transform.boundingbox);
 	}
 
+	if (output->assign_planes)
+		/*
+		 * This will queue flips for the fbs and sprites where
+		 * applicable and clear the damage for those surfaces.
+		 * The repaint loop below will repaint everything
+		 * else.
+		 */
+		output->assign_planes(output);
+
 	weston_output_set_cursor(output, ec->input_device);
 
 	wl_list_for_each(es, &ec->surface_list, link) {
diff --git a/src/compositor.h b/src/compositor.h
index 4bc4ba2..9166251 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -72,6 +72,7 @@ struct weston_output {
 	int (*set_hardware_cursor)(struct weston_output *output,
 				   struct weston_input_device *input);
 	void (*destroy)(struct weston_output *output);
+	void (*assign_planes)(struct weston_output *output);
 };
 
 struct weston_input_device {
-- 
1.7.4.1



More information about the wayland-devel mailing list