From 96dc9e4f1f4dc0f2bcc32f837e690505f3c887f1 Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Mon, 28 Oct 2013 10:17:45 +0100 Subject: [PATCH] rpi: Remove create_view and destroy_view implementations And also remove the vfunc definitions from the compositor as they are unused now. --- configure.ac | 2 +- src/compositor.c | 9 --------- src/compositor.h | 2 -- src/rpi-renderer.c | 29 ++++++++++++++++++++++++----- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index 93213d42..84f3a79c 100644 --- a/configure.ac +++ b/configure.ac @@ -55,7 +55,7 @@ AC_CHECK_HEADERS([execinfo.h]) AC_CHECK_FUNCS([mkostemp strchrnul initgroups]) -COMPOSITOR_MODULES="wayland-server >= 1.3.91 pixman-1" +COMPOSITOR_MODULES="wayland-server >= 1.3.90 pixman-1" AC_ARG_ENABLE(egl, [ --disable-egl],, enable_egl=yes) diff --git a/src/compositor.c b/src/compositor.c index 563baded..31c01c54 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -358,12 +358,6 @@ weston_view_create(struct weston_surface *surface) view->surface = surface; - if (surface->compositor->renderer->create_view && - surface->compositor->renderer->create_view(view) < 0) { - free(view); - return NULL; - } - /* Assign to surface */ wl_list_insert(&surface->views, &view->surface_link); @@ -1204,9 +1198,6 @@ weston_view_destroy(struct weston_view *view) weston_view_set_transform_parent(view, NULL); - if (view->surface->compositor->renderer->destroy_view) - view->surface->compositor->renderer->destroy_view(view); - wl_list_remove(&view->surface_link); free(view); diff --git a/src/compositor.h b/src/compositor.h index e60a512f..1b94764b 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -521,11 +521,9 @@ struct weston_renderer { pixman_region32_t *output_damage); void (*flush_damage)(struct weston_surface *surface); void (*attach)(struct weston_surface *es, struct weston_buffer *buffer); - int (*create_view)(struct weston_view *view); void (*surface_set_color)(struct weston_surface *surface, float red, float green, float blue, float alpha); - void (*destroy_view)(struct weston_view *view); void (*destroy)(struct weston_compositor *ec); }; diff --git a/src/rpi-renderer.c b/src/rpi-renderer.c index b7e94874..8fb562d6 100644 --- a/src/rpi-renderer.c +++ b/src/rpi-renderer.c @@ -136,6 +136,8 @@ struct rpir_view { DISPMANX_ELEMENT_HANDLE_T handle; int layer; + + struct wl_listener view_destroy_listener; }; struct rpir_output { @@ -172,6 +174,12 @@ struct rpi_renderer { static int rpi_renderer_create_surface(struct weston_surface *base); +static int +rpi_renderer_create_view(struct weston_view *base); + +static void +rpir_view_handle_view_destroy(struct wl_listener *listener, void *data); + static inline struct rpir_surface * to_rpir_surface(struct weston_surface *surface) { @@ -184,6 +192,9 @@ to_rpir_surface(struct weston_surface *surface) static inline struct rpir_view * to_rpir_view(struct weston_view *view) { + if (!view->renderer_state) + rpi_renderer_create_view(view); + return view->renderer_state; } @@ -1477,6 +1488,12 @@ rpi_renderer_create_view(struct weston_view *base) view->view = base; base->renderer_state = view; + + view->view_destroy_listener.notify = + rpir_view_handle_view_destroy; + wl_signal_add(&base->destroy_signal, + &view->view_destroy_listener); + return 0; } @@ -1522,9 +1539,12 @@ rpi_renderer_surface_set_color(struct weston_surface *base, } static void -rpi_renderer_destroy_view(struct weston_view *base) +rpir_view_handle_view_destroy(struct wl_listener *listener, void *data) { - struct rpir_view *view = to_rpir_view(base); + struct rpir_view *view; + struct weston_view *base = data; + + view = container_of(listener, struct rpir_view, view_destroy_listener); assert(view); assert(view->view == base); @@ -1532,8 +1552,9 @@ rpi_renderer_destroy_view(struct weston_view *base) return; view->view = NULL; + base->renderer_state = NULL; - /* If guaranteed to not be on screen, just detroy it. */ + /* If guaranteed to not be on screen, just destroy it. */ if (wl_list_empty(&view->link)) rpir_view_destroy(view); @@ -1582,9 +1603,7 @@ rpi_renderer_create(struct weston_compositor *compositor, renderer->base.repaint_output = rpi_renderer_repaint_output; renderer->base.flush_damage = rpi_renderer_flush_damage; renderer->base.attach = rpi_renderer_attach; - renderer->base.create_view = rpi_renderer_create_view; renderer->base.surface_set_color = rpi_renderer_surface_set_color; - renderer->base.destroy_view = rpi_renderer_destroy_view; renderer->base.destroy = rpi_renderer_destroy; #ifdef ENABLE_EGL