From 5308a5e09bf0e6309c50d7bcbaa77bdb8fa93e8d Mon Sep 17 00:00:00 2001 From: Jesse Barnes Date: Thu, 9 Feb 2012 13:12:57 -0800 Subject: [PATCH] compositor: add an assign_planes hook to the output 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(+) diff --git a/src/compositor-drm.c b/src/compositor-drm.c index a77d91fe..c56fc042 100644 --- a/src/compositor-drm.c +++ b/src/compositor-drm.c @@ -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; diff --git a/src/compositor-openwfd.c b/src/compositor-openwfd.c index aa4e5a91..8dce304e 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 386f9b6a..00ad1892 100644 --- a/src/compositor-wayland.c +++ b/src/compositor-wayland.c @@ -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); diff --git a/src/compositor-x11.c b/src/compositor-x11.c index 0e582299..9748af79 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 3797a711..4cd8d99e 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -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) { diff --git a/src/compositor.h b/src/compositor.h index 1888ea64..07ac93f2 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -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 {