pixman-renderer, gl-renderer: Destroy debug bindings on clean up

Also make sure backends destroy the renderers before shutting down the
compositor to avoid a double call to weston_binding_destroy().

This is a step towards making renderers switchable during runtime.
dev
Ander Conselvan de Oliveira 11 years ago committed by Kristian Høgsberg
parent c68b1085ed
commit 6b16214fb9
  1. 4
      src/compositor-drm.c
  2. 3
      src/compositor-fbdev.c
  3. 3
      src/compositor-rpi.c
  4. 4
      src/compositor-x11.c
  5. 17
      src/gl-renderer.c
  6. 13
      src/pixman-renderer.c

@ -2312,10 +2312,10 @@ drm_destroy(struct weston_compositor *ec)
destroy_sprites(d); destroy_sprites(d);
weston_compositor_shutdown(ec);
ec->renderer->destroy(ec); ec->renderer->destroy(ec);
weston_compositor_shutdown(ec);
if (d->gbm) if (d->gbm)
gbm_device_destroy(d->gbm); gbm_device_destroy(d->gbm);

@ -798,11 +798,12 @@ fbdev_compositor_destroy(struct weston_compositor *base)
udev_input_destroy(&compositor->input); udev_input_destroy(&compositor->input);
compositor->base.renderer->destroy(&compositor->base);
/* Destroy the output. */ /* Destroy the output. */
weston_compositor_shutdown(&compositor->base); weston_compositor_shutdown(&compositor->base);
/* Chain up. */ /* Chain up. */
compositor->base.renderer->destroy(&compositor->base);
weston_launcher_destroy(compositor->base.launcher); weston_launcher_destroy(compositor->base.launcher);
free(compositor); free(compositor);

@ -652,10 +652,11 @@ rpi_compositor_destroy(struct weston_compositor *base)
wl_list_for_each_safe(seat, next, &compositor->base.seat_list, link) wl_list_for_each_safe(seat, next, &compositor->base.seat_list, link)
evdev_input_destroy(seat); evdev_input_destroy(seat);
compositor->base.renderer->destroy(&compositor->base);
/* destroys outputs, too */ /* destroys outputs, too */
weston_compositor_shutdown(&compositor->base); weston_compositor_shutdown(&compositor->base);
compositor->base.renderer->destroy(&compositor->base);
weston_launcher_destroy(compositor->base.launcher); weston_launcher_destroy(compositor->base.launcher);
bcm_host_deinit(); bcm_host_deinit();

@ -1443,10 +1443,10 @@ x11_destroy(struct weston_compositor *ec)
wl_event_source_remove(compositor->xcb_source); wl_event_source_remove(compositor->xcb_source);
x11_input_destroy(compositor); x11_input_destroy(compositor);
weston_compositor_shutdown(ec); /* destroys outputs, too */
ec->renderer->destroy(ec); ec->renderer->destroy(ec);
weston_compositor_shutdown(ec); /* destroys outputs, too */
XCloseDisplay(compositor->dpy); XCloseDisplay(compositor->dpy);
free(ec); free(ec);
} }

@ -85,6 +85,8 @@ struct gl_renderer {
struct weston_renderer base; struct weston_renderer base;
int fragment_shader_debug; int fragment_shader_debug;
int fan_debug; int fan_debug;
struct weston_binding *fragment_binding;
struct weston_binding *fan_binding;
EGLDisplay egl_display; EGLDisplay egl_display;
EGLContext egl_context; EGLContext egl_context;
@ -1567,6 +1569,9 @@ gl_renderer_destroy(struct weston_compositor *ec)
wl_array_release(&gr->indices); wl_array_release(&gr->indices);
wl_array_release(&gr->vtxcnt); wl_array_release(&gr->vtxcnt);
weston_binding_destroy(gr->fragment_binding);
weston_binding_destroy(gr->fan_binding);
free(gr); free(gr);
} }
@ -1859,10 +1864,14 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface)
if (compile_shaders(ec)) if (compile_shaders(ec))
return -1; return -1;
weston_compositor_add_debug_binding(ec, KEY_S, gr->fragment_binding =
fragment_debug_binding, ec); weston_compositor_add_debug_binding(ec, KEY_S,
weston_compositor_add_debug_binding(ec, KEY_F, fragment_debug_binding,
fan_debug_repaint_binding, ec); ec);
gr->fan_binding =
weston_compositor_add_debug_binding(ec, KEY_F,
fan_debug_repaint_binding,
ec);
weston_log("GL ES 2 renderer features:\n"); weston_log("GL ES 2 renderer features:\n");
weston_log_continue(STAMP_SPACE "read-back format: %s\n", weston_log_continue(STAMP_SPACE "read-back format: %s\n",

@ -43,8 +43,10 @@ struct pixman_surface_state {
struct pixman_renderer { struct pixman_renderer {
struct weston_renderer base; struct weston_renderer base;
int repaint_debug; int repaint_debug;
pixman_image_t *debug_color; pixman_image_t *debug_color;
struct weston_binding *debug_binding;
}; };
static inline struct pixman_output_state * static inline struct pixman_output_state *
@ -630,7 +632,11 @@ pixman_renderer_destroy_surface(struct weston_surface *surface)
static void static void
pixman_renderer_destroy(struct weston_compositor *ec) pixman_renderer_destroy(struct weston_compositor *ec)
{ {
free(ec->renderer); struct pixman_renderer *pr = get_renderer(ec);
weston_binding_destroy(pr->debug_binding);
free(pr);
ec->renderer = NULL; ec->renderer = NULL;
} }
@ -678,8 +684,9 @@ pixman_renderer_init(struct weston_compositor *ec)
ec->capabilities |= WESTON_CAP_ROTATION_ANY; ec->capabilities |= WESTON_CAP_ROTATION_ANY;
ec->capabilities |= WESTON_CAP_CAPTURE_YFLIP; ec->capabilities |= WESTON_CAP_CAPTURE_YFLIP;
weston_compositor_add_debug_binding(ec, KEY_R, renderer->debug_binding =
debug_binding, ec); weston_compositor_add_debug_binding(ec, KEY_R,
debug_binding, ec);
wl_display_add_shm_format(ec->wl_display, WL_SHM_FORMAT_RGB565); wl_display_add_shm_format(ec->wl_display, WL_SHM_FORMAT_RGB565);

Loading…
Cancel
Save