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);
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);
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);
};
DISPMANX_ELEMENT_HANDLE_T handle;
int layer;
+
+ struct wl_listener view_destroy_listener;
};
struct rpir_output {
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)
{
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;
}
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;
}
}
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);
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);
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