[PATCH 1/2] compositor: make repaint output specific

Jesse Barnes jbarnes at virtuousgeek.org
Fri Jan 6 11:36:14 PST 2012


Each output may have ways of optimizing surface drawing (e.g. by using
sprites), so push the handling of repaint into the output structure,
providing the existing repaint function as a helper.
---
 src/compositor-drm.c     |    1 +
 src/compositor-openwfd.c |    1 +
 src/compositor-wayland.c |    1 +
 src/compositor-x11.c     |    1 +
 src/compositor.c         |    2 +-
 src/compositor.h         |    3 +++
 6 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index a6cedd5..433c644 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -548,6 +548,7 @@ create_output_for_connector(struct drm_compositor *ec,
 	wl_list_insert(ec->base.output_list.prev, &output->base.link);
 
 	output->pending_fs_surf_fb_id = 0;
+	output->base.repaint = weston_output_repaint;
 	output->base.prepare_render = drm_output_prepare_render;
 	output->base.present = drm_output_present;
 	output->base.prepare_scanout_surface =
diff --git a/src/compositor-openwfd.c b/src/compositor-openwfd.c
index caecf29..46641aa 100644
--- a/src/compositor-openwfd.c
+++ b/src/compositor-openwfd.c
@@ -406,6 +406,7 @@ create_output_for_port(struct wfd_compositor *ec,
 
 	wfdDeviceCommit(ec->dev, WFD_COMMIT_ENTIRE_DEVICE, WFD_INVALID_HANDLE);
 
+	output->base.repaint = weston_output_repaint;
 	output->base.prepare_render = wfd_output_prepare_render;
 	output->base.present = wfd_output_present;
 	output->base.prepare_scanout_surface =
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index 4fa9df1..4966017 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -290,6 +290,7 @@ wayland_compositor_create_output(struct wayland_compositor *c,
 
 	glClearColor(0, 0, 0, 0.5);
 
+	output->base.repaint = weston_output_repaint;
 	output->base.prepare_render = wayland_output_prepare_render;
 	output->base.present = wayland_output_present;
 	output->base.prepare_scanout_surface =
diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index 09213f7..1b23e83 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -461,6 +461,7 @@ x11_compositor_create_output(struct x11_compositor *c, int x, int y,
 	output->finish_frame_timer =
 		wl_event_loop_add_timer(loop, finish_frame_handler, output);
 
+	output->base.repaint = weston_output_repaint;
 	output->base.prepare_render = x11_output_prepare_render;
 	output->base.present = x11_output_present;
 	output->base.prepare_scanout_surface =
diff --git a/src/compositor.c b/src/compositor.c
index 2627987..7c41123 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -750,7 +750,7 @@ setup_scanout_surface(struct weston_output *output, struct weston_surface *es)
 	return 0;
 }
 
-static void
+WL_EXPORT void
 weston_output_repaint(struct weston_output *output)
 {
 	struct weston_compositor *ec = output->compositor;
diff --git a/src/compositor.h b/src/compositor.h
index f6c87da..5608899 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -87,6 +87,7 @@ struct weston_output {
 	struct wl_buffer *pending_scanout_buffer;
 	struct wl_listener pending_scanout_buffer_destroy_listener;
 
+	void (*repaint)(struct weston_output *output);
 	int (*prepare_render)(struct weston_output *output);
 	int (*present)(struct weston_output *output);
 	int (*prepare_scanout_surface)(struct weston_output *output,
@@ -336,6 +337,8 @@ notify_touch(struct wl_input_device *device, uint32_t time, int touch_id,
 	     int x, int y, int touch_type);
 
 void
+weston_output_repaint(struct weston_output *output);
+void
 weston_output_finish_frame(struct weston_output *output, int msecs);
 void
 weston_output_damage(struct weston_output *output);
-- 
1.7.4.1



More information about the wayland-devel mailing list