Rename surface_commit() into weston_surface_commit(), and call it via a function pointer in struct weston_surface. This will allow special surfaces to avoid being committed; a sub-surface rendered into with GL, for instance (eglSwapbuffers always does a commit).
Signed-off-by: Pekka Paalanen <[email protected]> --- src/compositor.c | 15 +++++++++++---- src/compositor.h | 17 ++++++++++++++--- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/compositor.c b/src/compositor.c index 51ad616..1bf800c 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -268,6 +268,7 @@ weston_surface_create(struct weston_compositor *compositor) region_init_infinite(&surface->pending.input); wl_list_init(&surface->pending.frame_callback_list); wl_signal_init(&surface->commit_signal); + surface->commit = weston_surface_commit; return surface; } @@ -1228,11 +1229,9 @@ surface_set_input_region(struct wl_client *client, } } -static void -surface_commit(struct wl_client *client, struct wl_resource *resource) +void +weston_surface_commit(struct weston_surface *surface) { - struct weston_surface *surface = resource->data; - /* wl_surface.attach */ if (surface->pending.buffer || surface->pending.remove_contents) weston_surface_attach(surface, surface->pending.buffer); @@ -1273,6 +1272,14 @@ surface_commit(struct wl_client *client, struct wl_resource *resource) weston_surface_schedule_repaint(surface); } +static void +surface_commit(struct wl_client *client, struct wl_resource *resource) +{ + struct weston_surface *surface = resource->data; + + surface->commit(surface); +} + static const struct wl_surface_interface surface_interface = { surface_destroy, surface_attach, diff --git a/src/compositor.h b/src/compositor.h index c17c398..88b22a1 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -490,9 +490,17 @@ struct weston_surface { struct wl_signal commit_signal; /* - * If non-NULL, this function will be called on surface::attach after - * a new buffer has been set up for this surface. The integer params - * are the sx and sy paramerters supplied to surface::attach . + * This function is always called on wl_surface.commit request, + * and is usually weston_surface_commit(). Sub-surfaces, that want + * to avoid commits on themselves, this would be something else. + */ + void (*commit)(struct weston_surface *surface); + + /* + * If non-NULL, this function will be called on weston_surface_commit() + * after a new buffer has been set up for this surface. The integer + * params are the sx and sy parameters supplied to wl_surface.attach + * request. */ void (*configure)(struct weston_surface *es, int32_t sx, int32_t sy); void *private; @@ -686,6 +694,9 @@ void weston_surface_unmap(struct weston_surface *surface); void +weston_surface_commit(struct weston_surface *surface); + +void weston_buffer_post_release(struct wl_buffer *buffer); uint32_t -- 1.7.8.6 _______________________________________________ wayland-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/wayland-devel
