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; }
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; }
static struct weston_compositor * headless_compositor_create(struct wl_display *display, int width, int height, const char *display_name, int argc, char *argv[], const char *config_file) { struct headless_compositor *c; c = calloc(1, sizeof *c); if (c == NULL) return NULL; memset(c, 0, sizeof *c); if (weston_compositor_init(&c->base, display, argc, argv, config_file) < 0) goto err_free; weston_seat_init(&c->fake_seat, &c->base); c->base.destroy = headless_destroy; c->base.restore = headless_restore; if (headless_compositor_create_output(c, width, height) < 0) goto err_compositor; if (noop_renderer_init(&c->base) < 0) goto err_compositor; return &c->base; err_compositor: weston_compositor_shutdown(&c->base); err_free: free(c); return NULL; }