[PATCH 3/9] compositor: Add a create_surface callback to weston_renderer.
John Kåre Alsaker
john.kare.alsaker at gmail.com
Sat Sep 15 11:34:01 PDT 2012
---
src/compositor.c | 5 +++++
src/compositor.h | 1 +
src/gles2-renderer.c | 7 +++++++
3 files changed, 13 insertions(+)
diff --git a/src/compositor.c b/src/compositor.c
index 8c8dff0..2fb89b6 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -238,6 +238,11 @@ weston_surface_create(struct weston_compositor *compositor)
surface->alpha = 1.0;
surface->pitch = 1;
+ if (compositor->renderer->create_surface(surface) < 0) {
+ free(surface);
+ return NULL;
+ }
+
surface->num_textures = 0;
surface->num_images = 0;
diff --git a/src/compositor.h b/src/compositor.h
index a3b5fc7..9ad1753 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -273,6 +273,7 @@ struct weston_renderer {
pixman_region32_t *output_damage);
void (*flush_damage)(struct weston_surface *surface);
void (*attach)(struct weston_surface *es, struct wl_buffer *buffer);
+ int (*create_surface)(struct weston_surface *surface);
void (*destroy_surface)(struct weston_surface *surface);
};
diff --git a/src/gles2-renderer.c b/src/gles2-renderer.c
index 97b14c6..cd36167 100644
--- a/src/gles2-renderer.c
+++ b/src/gles2-renderer.c
@@ -907,6 +907,12 @@ gles2_renderer_attach(struct weston_surface *es, struct wl_buffer *buffer)
}
}
+static int
+gles2_renderer_create_surface(struct weston_surface *surface)
+{
+ return 0;
+}
+
static void
gles2_renderer_destroy_surface(struct weston_surface *surface)
{
@@ -1148,6 +1154,7 @@ create_renderer(struct weston_compositor *ec)
renderer->base.repaint_output = gles2_renderer_repaint_output;
renderer->base.flush_damage = gles2_renderer_flush_damage;
renderer->base.attach = gles2_renderer_attach;
+ renderer->base.create_surface = gles2_renderer_create_surface;
renderer->base.destroy_surface = gles2_renderer_destroy_surface;
ec->renderer = &renderer->base;
--
1.7.12
More information about the wayland-devel
mailing list