|
|
@ -152,46 +152,56 @@ headless_output_destroy(struct weston_output *base) |
|
|
|
free(output); |
|
|
|
free(output); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int |
|
|
|
|
|
|
|
headless_output_enable_pixman(struct headless_output *output) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
output->image_buf = malloc(output->base.current_mode->width * |
|
|
|
|
|
|
|
output->base.current_mode->height * 4); |
|
|
|
|
|
|
|
if (!output->image_buf) |
|
|
|
|
|
|
|
return -1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
output->image = pixman_image_create_bits(PIXMAN_x8r8g8b8, |
|
|
|
|
|
|
|
output->base.current_mode->width, |
|
|
|
|
|
|
|
output->base.current_mode->height, |
|
|
|
|
|
|
|
output->image_buf, |
|
|
|
|
|
|
|
output->base.current_mode->width * 4); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (pixman_renderer_output_create(&output->base, |
|
|
|
|
|
|
|
PIXMAN_RENDERER_OUTPUT_USE_SHADOW) < 0) |
|
|
|
|
|
|
|
goto err_renderer; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pixman_renderer_output_set_buffer(&output->base, output->image); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
err_renderer: |
|
|
|
|
|
|
|
pixman_image_unref(output->image); |
|
|
|
|
|
|
|
free(output->image_buf); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return -1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static int |
|
|
|
static int |
|
|
|
headless_output_enable(struct weston_output *base) |
|
|
|
headless_output_enable(struct weston_output *base) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct headless_output *output = to_headless_output(base); |
|
|
|
struct headless_output *output = to_headless_output(base); |
|
|
|
struct headless_backend *b = to_headless_backend(base->compositor); |
|
|
|
struct headless_backend *b = to_headless_backend(base->compositor); |
|
|
|
struct wl_event_loop *loop; |
|
|
|
struct wl_event_loop *loop; |
|
|
|
|
|
|
|
int ret = 0; |
|
|
|
|
|
|
|
|
|
|
|
loop = wl_display_get_event_loop(b->compositor->wl_display); |
|
|
|
loop = wl_display_get_event_loop(b->compositor->wl_display); |
|
|
|
output->finish_frame_timer = |
|
|
|
output->finish_frame_timer = |
|
|
|
wl_event_loop_add_timer(loop, finish_frame_handler, output); |
|
|
|
wl_event_loop_add_timer(loop, finish_frame_handler, output); |
|
|
|
|
|
|
|
|
|
|
|
if (b->use_pixman) { |
|
|
|
if (b->use_pixman) |
|
|
|
output->image_buf = malloc(output->base.current_mode->width * |
|
|
|
ret = headless_output_enable_pixman(output); |
|
|
|
output->base.current_mode->height * 4); |
|
|
|
|
|
|
|
if (!output->image_buf) |
|
|
|
if (ret < 0) { |
|
|
|
goto err_malloc; |
|
|
|
wl_event_source_remove(output->finish_frame_timer); |
|
|
|
|
|
|
|
return -1; |
|
|
|
output->image = pixman_image_create_bits(PIXMAN_x8r8g8b8, |
|
|
|
|
|
|
|
output->base.current_mode->width, |
|
|
|
|
|
|
|
output->base.current_mode->height, |
|
|
|
|
|
|
|
output->image_buf, |
|
|
|
|
|
|
|
output->base.current_mode->width * 4); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (pixman_renderer_output_create(&output->base, |
|
|
|
|
|
|
|
PIXMAN_RENDERER_OUTPUT_USE_SHADOW) < 0) |
|
|
|
|
|
|
|
goto err_renderer; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pixman_renderer_output_set_buffer(&output->base, |
|
|
|
|
|
|
|
output->image); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
|
|
err_renderer: |
|
|
|
|
|
|
|
pixman_image_unref(output->image); |
|
|
|
|
|
|
|
free(output->image_buf); |
|
|
|
|
|
|
|
err_malloc: |
|
|
|
|
|
|
|
wl_event_source_remove(output->finish_frame_timer); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return -1; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static int |
|
|
|
static int |
|
|
|