compositor: add API to manage compositor instances

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.
- weston_compositor_exit(compositor) asks the compositor to tear
down by calling the compositor's exit vfunc which is set by the
libweston application.
- weston_compositor_destroy(compositor) is called by the libweston
application when tearing down the compositor. The compositor is destroyed
and the memory freed.

Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index 8ca809a..55c85ed 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -960,7 +960,7 @@
 	xcb_flush(b->conn);
 
 	if (wl_list_empty(&b->compositor->output_list))
-		wl_display_terminate(b->compositor->wl_display);
+		weston_compositor_exit(b->compositor);
 }
 
 static void delete_cb(void *data)
@@ -1534,9 +1534,6 @@
 		return NULL;
 
 	b->compositor = compositor;
-	if (weston_compositor_init(compositor, argc, argv, config) < 0)
-		goto err_free;
-
 	if (weston_compositor_set_presentation_clock_software(compositor) < 0)
 		goto err_free;