[PATCH 1/2] compositor: Destroy renderer in weston_compositor_shutdown()

Jason Ekstrand jason at jlekstrand.net
Fri Dec 20 15:35:49 PST 2013


Ander,
I don't neciserally disagree we with this change, but shouldn't the GL
renderer clean up after itself better?
--Jason
On Dec 20, 2013 1:07 PM, "Ander Conselvan de Oliveira" <conselvan2 at gmail.com>
wrote:

> From: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira at intel.com>
>
> Currently we destroy the renderer before the outputs are destroyed, but
> that sometimes leads to an error since a reference to the renderer is
> necessary in order to destroy a gl_renderer_output.
>
> Since destroying the renderer is common among all backends, just move
> that call into weston_compositor_shutdown() immediately after the
> outputs being destroyed.
> ---
>  src/compositor-drm.c      |    2 --
>  src/compositor-fbdev.c    |    2 --
>  src/compositor-headless.c |    2 --
>  src/compositor-rdp.c      |    1 -
>  src/compositor-rpi.c      |    2 --
>  src/compositor-wayland.c  |    2 --
>  src/compositor-x11.c      |    2 --
>  src/compositor.c          |    3 +++
>  8 files changed, 3 insertions(+), 13 deletions(-)
>
> diff --git a/src/compositor-drm.c b/src/compositor-drm.c
> index f85298a..d637e75 100644
> --- a/src/compositor-drm.c
> +++ b/src/compositor-drm.c
> @@ -2336,8 +2336,6 @@ drm_destroy(struct weston_compositor *ec)
>
>         destroy_sprites(d);
>
> -       ec->renderer->destroy(ec);
> -
>         weston_compositor_shutdown(ec);
>
>         if (d->gbm)
> diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c
> index e649d43..0d96269 100644
> --- a/src/compositor-fbdev.c
> +++ b/src/compositor-fbdev.c
> @@ -797,8 +797,6 @@ fbdev_compositor_destroy(struct weston_compositor
> *base)
>
>         udev_input_destroy(&compositor->input);
>
> -       compositor->base.renderer->destroy(&compositor->base);
> -
>         /* Destroy the output. */
>         weston_compositor_shutdown(&compositor->base);
>
> diff --git a/src/compositor-headless.c b/src/compositor-headless.c
> index 5497455..5a5c1e6 100644
> --- a/src/compositor-headless.c
> +++ b/src/compositor-headless.c
> @@ -141,8 +141,6 @@ headless_destroy(struct weston_compositor *ec)
>  {
>         struct headless_compositor *c = (struct headless_compositor *) ec;
>
> -       ec->renderer->destroy(ec);
> -
>         weston_seat_release(&c->fake_seat);
>         weston_compositor_shutdown(ec);
>
> diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c
> index 58342b9..942af50 100644
> --- a/src/compositor-rdp.c
> +++ b/src/compositor-rdp.c
> @@ -521,7 +521,6 @@ rdp_restore(struct weston_compositor *ec)
>  static void
>  rdp_destroy(struct weston_compositor *ec)
>  {
> -       ec->renderer->destroy(ec);
>         weston_compositor_shutdown(ec);
>
>         free(ec);
> diff --git a/src/compositor-rpi.c b/src/compositor-rpi.c
> index 1d52a94..399090d 100644
> --- a/src/compositor-rpi.c
> +++ b/src/compositor-rpi.c
> @@ -422,8 +422,6 @@ rpi_compositor_destroy(struct weston_compositor *base)
>
>         udev_input_destroy(&compositor->input);
>
> -       compositor->base.renderer->destroy(&compositor->base);
> -
>         /* destroys outputs, too */
>         weston_compositor_shutdown(&compositor->base);
>
> diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
> index 14ff4af..d2d8942 100644
> --- a/src/compositor-wayland.c
> +++ b/src/compositor-wayland.c
> @@ -1398,8 +1398,6 @@ wayland_destroy(struct weston_compositor *ec)
>  {
>         struct wayland_compositor *c = (struct wayland_compositor *) ec;
>
> -       ec->renderer->destroy(ec);
> -
>         weston_compositor_shutdown(ec);
>
>         if (c->parent.shm)
> diff --git a/src/compositor-x11.c b/src/compositor-x11.c
> index 2ef1b5d..97fe3b1 100644
> --- a/src/compositor-x11.c
> +++ b/src/compositor-x11.c
> @@ -1415,8 +1415,6 @@ x11_destroy(struct weston_compositor *ec)
>         wl_event_source_remove(compositor->xcb_source);
>         x11_input_destroy(compositor);
>
> -       ec->renderer->destroy(ec);
> -
>         weston_compositor_shutdown(ec); /* destroys outputs, too */
>
>         XCloseDisplay(compositor->dpy);
> diff --git a/src/compositor.c b/src/compositor.c
> index ff0f3ab..329ee49 100644
> --- a/src/compositor.c
> +++ b/src/compositor.c
> @@ -3734,6 +3734,9 @@ weston_compositor_shutdown(struct weston_compositor
> *ec)
>         wl_list_for_each_safe(output, next, &ec->output_list, link)
>                 output->destroy(output);
>
> +       if (ec->renderer)
> +               ec->renderer->destroy(ec);
> +
>         weston_binding_list_destroy_all(&ec->key_binding_list);
>         weston_binding_list_destroy_all(&ec->button_binding_list);
>         weston_binding_list_destroy_all(&ec->touch_binding_list);
> --
> 1.7.9.5
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20131220/c3a182e7/attachment.html>


More information about the wayland-devel mailing list