compositor: add an assign_planes hook to the output
authorJesse Barnes <jbarnes@virtuousgeek.org>
Thu, 9 Feb 2012 21:12:57 +0000 (13:12 -0800)
committerKristian Høgsberg <krh@bitplanet.net>
Thu, 23 Feb 2012 22:55:10 +0000 (17:55 -0500)
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
src/compositor-openwfd.c
src/compositor-wayland.c
src/compositor-x11.c
src/compositor.c
src/compositor.h

index a77d91f..c56fc04 100644 (file)
@@ -621,6 +621,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;
 
index aa4e5a9..8dce304 100644 (file)
@@ -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);
 
index 386f9b6..00ad189 100644 (file)
@@ -442,6 +442,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);
 
index 0e58229..9748af7 100644 (file)
@@ -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);
 
index 3797a71..4cd8d99 100644 (file)
@@ -986,6 +986,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) {
index 1888ea6..07ac93f 100644 (file)
@@ -87,6 +87,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 {