Пример #1
0
static void
headless_destroy(struct weston_compositor *ec)
{
	struct headless_backend *b = (struct headless_backend *) ec->backend;

	headless_input_destroy(b);
	weston_compositor_shutdown(ec);

	free(b);
}
static void
headless_destroy(struct weston_compositor *ec)
{
	struct headless_compositor *c = (struct headless_compositor *) ec;

	headless_input_destroy(c);
	weston_compositor_shutdown(ec);

	free(ec);
}
static struct weston_compositor *
headless_compositor_create(struct wl_display *display,
			   struct headless_parameters *param,
			   const char *display_name,
			   int *argc, char *argv[],
			   struct weston_config *config)
{
	struct headless_compositor *c;

	c = zalloc(sizeof *c);
	if (c == NULL)
		return NULL;

	if (weston_compositor_init(&c->base, display, argc, argv, config) < 0)
		goto err_free;

	if (weston_compositor_set_presentation_clock_software(&c->base) < 0)
		goto err_compositor;

	if (headless_input_create(c) < 0)
		goto err_compositor;

	c->base.destroy = headless_destroy;
	c->base.restore = headless_restore;

	c->use_pixman = param->use_pixman;
	if (c->use_pixman) {
		pixman_renderer_init(&c->base);
	}
	if (headless_compositor_create_output(c, param) < 0)
		goto err_input;

	if (!c->use_pixman && noop_renderer_init(&c->base) < 0)
		goto err_input;

	return &c->base;

err_input:
	headless_input_destroy(c);
err_compositor:
	weston_compositor_shutdown(&c->base);
err_free:
	free(c);
	return NULL;
}
Пример #4
0
static struct headless_backend *
headless_backend_create(struct weston_compositor *compositor,
			struct headless_parameters *param,
			const char *display_name)
{
	struct headless_backend *b;

	b = zalloc(sizeof *b);
	if (b == NULL)
		return NULL;

	b->compositor = compositor;
	if (weston_compositor_set_presentation_clock_software(compositor) < 0)
		goto err_free;

	if (headless_input_create(b) < 0)
		goto err_free;

	b->base.destroy = headless_destroy;
	b->base.restore = headless_restore;

	b->use_pixman = param->use_pixman;
	if (b->use_pixman) {
		pixman_renderer_init(compositor);
	}
	if (headless_backend_create_output(b, param) < 0)
		goto err_input;

	if (!b->use_pixman && noop_renderer_init(compositor) < 0)
		goto err_input;

	compositor->backend = &b->base;
	return b;

err_input:
	weston_compositor_shutdown(compositor);
	headless_input_destroy(b);
err_free:
	free(b);
	return NULL;
}