renderer: introduce destroy callback

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Vasily Khoruzhick 12 years ago committed by Kristian Høgsberg
parent 94c1dfb012
commit 52cfd61cdb
  1. 6
      src/compositor-android.c
  2. 4
      src/compositor-drm.c
  3. 2
      src/compositor-headless.c
  4. 4
      src/compositor-rpi.c
  5. 4
      src/compositor-wayland.c
  6. 10
      src/compositor-x11.c
  7. 3
      src/compositor.h
  8. 3
      src/gl-renderer.c
  9. 2
      src/gl-renderer.h
  10. 3
      src/noop-renderer.c
  11. 3
      src/pixman-renderer.c
  12. 3
      src/pixman-renderer.h

@ -299,7 +299,7 @@ android_init_egl(struct android_compositor *compositor,
if (gl_renderer_output_create(&output->base,
output->fb->native_window) < 0) {
gl_renderer_destroy(&compositor->base);
compositor->base.renderer->destroy(&compositor->base);
return -1;
}
@ -313,7 +313,7 @@ android_compositor_destroy(struct weston_compositor *base)
android_seat_destroy(compositor->seat);
gl_renderer_destroy(base);
base->renderer->destroy(base);
/* destroys outputs, too */
weston_compositor_shutdown(&compositor->base);
@ -358,7 +358,7 @@ android_compositor_create(struct wl_display *display, int argc, char *argv[],
return &compositor->base;
err_gl:
gl_renderer_destroy(&compositor->base);
compositor->base.renderer->destroy(&compositor->base);
err_output:
android_output_destroy(&output->base);
err_compositor:

@ -2007,7 +2007,7 @@ drm_destroy(struct weston_compositor *ec)
weston_compositor_shutdown(ec);
gl_renderer_destroy(ec);
ec->renderer->destroy(ec);
destroy_sprites(d);
gbm_device_destroy(d->gbm);
@ -2307,7 +2307,7 @@ err_drm_source:
wl_list_for_each_safe(weston_seat, next, &ec->base.seat_list, link)
evdev_input_destroy(weston_seat);
err_sprite:
gl_renderer_destroy(&ec->base);
ec->base.renderer->destroy(&ec->base);
gbm_device_destroy(ec->gbm);
destroy_sprites(ec);
err_udev_dev:

@ -141,7 +141,7 @@ headless_destroy(struct weston_compositor *ec)
{
struct headless_compositor *c = (struct headless_compositor *) ec;
noop_renderer_destroy(ec);
ec->renderer->destroy(ec);
weston_seat_release(&c->fake_seat);
weston_compositor_shutdown(ec);

@ -1347,7 +1347,7 @@ rpi_compositor_destroy(struct weston_compositor *base)
/* destroys outputs, too */
weston_compositor_shutdown(&compositor->base);
gl_renderer_destroy(&compositor->base);
compositor->base.renderer->destroy(&compositor->base);
tty_destroy(compositor->tty);
bcm_host_deinit();
@ -1501,7 +1501,7 @@ rpi_compositor_create(struct wl_display *display, int argc, char *argv[],
return &compositor->base;
out_gl:
gl_renderer_destroy(&compositor->base);
compositor->base.renderer->destroy(&compositor->base);
out_tty:
tty_destroy(compositor->tty);

@ -612,7 +612,7 @@ wayland_restore(struct weston_compositor *ec)
static void
wayland_destroy(struct weston_compositor *ec)
{
gl_renderer_destroy(ec);
ec->renderer->destroy(ec);
weston_compositor_shutdown(ec);
@ -686,7 +686,7 @@ wayland_compositor_create(struct wl_display *display,
return &c->base;
err_gl:
gl_renderer_destroy(&c->base);
c->base.renderer->destroy(&c->base);
err_display:
wl_display_disconnect(c->parent.wl_display);
err_compositor:

@ -1419,10 +1419,7 @@ x11_destroy(struct weston_compositor *ec)
weston_compositor_shutdown(ec); /* destroys outputs, too */
if (compositor->use_pixman)
pixman_renderer_destroy(ec);
else
gl_renderer_destroy(ec);
ec->renderer->destroy(ec);
XCloseDisplay(compositor->dpy);
free(ec);
@ -1532,10 +1529,7 @@ x11_compositor_create(struct wl_display *display,
err_x11_input:
x11_input_destroy(c);
err_renderer:
if (c->use_pixman)
pixman_renderer_destroy(&c->base);
else
gl_renderer_destroy(&c->base);
c->base.renderer->destroy(&c->base);
err_xdisplay:
XCloseDisplay(c->dpy);
err_free:

@ -273,6 +273,7 @@ struct weston_renderer {
float red, float green,
float blue, float alpha);
void (*destroy_surface)(struct weston_surface *surface);
void (*destroy)(struct weston_compositor *ec);
};
struct weston_compositor {
@ -821,8 +822,6 @@ weston_output_switch_mode(struct weston_output *output, struct weston_mode *mode
int
noop_renderer_init(struct weston_compositor *ec);
void
noop_renderer_destroy(struct weston_compositor *ec);
struct weston_compositor *
backend_init(struct wl_display *display, int argc, char *argv[],

@ -1648,7 +1648,7 @@ gl_renderer_output_surface(struct weston_output *output)
return get_output_state(output)->egl_surface;
}
WL_EXPORT void
static void
gl_renderer_destroy(struct weston_compositor *ec)
{
struct gl_renderer *gr = get_renderer(ec);
@ -1748,6 +1748,7 @@ gl_renderer_create(struct weston_compositor *ec, EGLNativeDisplayType display,
gr->base.create_surface = gl_renderer_create_surface;
gr->base.surface_set_color = gl_renderer_surface_set_color;
gr->base.destroy_surface = gl_renderer_destroy_surface;
gr->base.destroy = gl_renderer_destroy;
gr->egl_display = eglGetDisplay(display);
if (gr->egl_display == EGL_NO_DISPLAY) {

@ -42,8 +42,6 @@ gl_renderer_output_surface(struct weston_output *output);
void
gl_renderer_set_border(struct weston_compositor *ec, int32_t width, int32_t height, void *data,
int32_t *edges);
void
gl_renderer_destroy(struct weston_compositor *ec);
void
gl_renderer_print_egl_error_state(void);

@ -68,7 +68,7 @@ noop_renderer_destroy_surface(struct weston_surface *surface)
{
}
WL_EXPORT void
static void
noop_renderer_destroy(struct weston_compositor *ec)
{
free(ec->renderer);
@ -91,6 +91,7 @@ noop_renderer_init(struct weston_compositor *ec)
renderer->create_surface = noop_renderer_create_surface;
renderer->surface_set_color = noop_renderer_surface_set_color;
renderer->destroy_surface = noop_renderer_destroy_surface;
renderer->destroy = noop_renderer_destroy;
ec->renderer = renderer;
return 0;

@ -312,7 +312,7 @@ pixman_renderer_destroy_surface(struct weston_surface *surface)
free(ps);
}
WL_EXPORT void
static void
pixman_renderer_destroy(struct weston_compositor *ec)
{
free(ec->renderer);
@ -335,6 +335,7 @@ pixman_renderer_init(struct weston_compositor *ec)
renderer->create_surface = pixman_renderer_create_surface;
renderer->surface_set_color = pixman_renderer_surface_set_color;
renderer->destroy_surface = pixman_renderer_destroy_surface;
renderer->destroy = pixman_renderer_destroy;
ec->renderer = renderer;
return 0;

@ -22,9 +22,6 @@
#include "compositor.h"
void
pixman_renderer_destroy(struct weston_compositor *ec);
int
pixman_renderer_init(struct weston_compositor *ec);

Loading…
Cancel
Save