[PATCH weston v3 02/11] compositor: add API to manage compositor instances

Pekka Paalanen ppaalanen at gmail.com
Fri Jul 10 02:02:33 PDT 2015

On Sat, 27 Jun 2015 14:07:42 +0300
Giulio Camuffo <giuliocamuffo at gmail.com> wrote:

> This commit adds three new exported functions:
> - weston_compositor_create() returns a new weston_compositor instance,
> initializing it as the now removed weston_compositor_init() did.


I almost suggested that while weston_compositor_init() calls are
removed from the backends, so should the weston_compositor_shutdown()
calls be. But, I see that the shutdown will call into the backends to
clean up things. The sequence must be shutdown -> backend_destroy ->

We might make weston_compositor_destroy() to call
weston_compositor_shutdown() as the first thing, but that requires
seeing if we can patch each backend to call
weston_compositor_shutdown() as the first thing in its destroy hook. If
that works, then we can make weston_compositor_shutdown() static. This
would be a nice topic for a follow-up series: one patch per backend to
reorder things in the destroy hook, then one patch to move the
weston_compositor_shutdown() call into weston_compositor_destroy() and
unexport it.

This patch is inconsistent on removing the argc,argv,config arguments
from *_backend_create() functions, but that can be cleaned up later.

> - weston_compositor_exit(compositor) asks the compositor to tear
> down by calling the compositor's exit vfunc which is set by the
> libweston application.

I suppose we should replace most of the remaining
wl_display_terminate() calls with weston_compositor_exit()? I'm looking
at the shell plugins in particular.

> - weston_compositor_destroy(compositor) is called by the libweston
> application when tearing down the compositor. The compositor is destroyed
> and the memory freed.

> ---
>  src/compositor-drm.c      |   8 +--
>  src/compositor-fbdev.c    |   6 --
>  src/compositor-headless.c |   9 +--
>  src/compositor-rdp.c      |   4 --
>  src/compositor-wayland.c  |   9 +--
>  src/compositor-x11.c      |   5 +-
>  src/compositor.c          | 167 +++++++++++++++++++++++++++++++++-------------
>  src/compositor.h          |  14 +++-
>  8 files changed, 137 insertions(+), 85 deletions(-)

Patch 1 needed some fixing, and that needed some rebasing here I think.
Anyway, the changes are minor, and this patch is pushed:
   d3553c7..459137b  master -> master


More information about the wayland-devel mailing list