diff options
author | Stefan Agner <stefan@agner.ch> | 2019-06-16 23:28:15 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2019-08-01 08:19:15 +0000 |
commit | da2e574ca9fee69d56c7f44c4d1c8a661423a6b1 (patch) | |
tree | b76f817166fd1129d277546b9bdac52fa822a62d | |
parent | b5c70d791a06577bc0e8a3be9a4d9bb645491183 (diff) | |
download | weston-da2e574ca9fee69d56c7f44c4d1c8a661423a6b1.tar.gz |
pixman: avoid unnecessary y-flip for screen capture
Commit 4fc5dd0099c2 ("compositor: add capability CAPTURE_YFLIP")
introduced a capability flag which indicates whether y-flipping is
necessary. As already indicated in that commit message, it seems
that pixman flipps the y-axis only due to historic reasons.
Drop y-flipping and use the WESTON_CAP_CAPTURE_YFLIP flag to
indicate that y-flipping is not necessary. This simplifies code
and improves screen share performance (on my test by about 3% down
to 18% CPU load on the sharing instance of Weston).
Signed-off-by: Stefan Agner <stefan@agner.ch>
-rw-r--r-- | libweston/pixman-renderer.c | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/libweston/pixman-renderer.c b/libweston/pixman-renderer.c index 8677023c..378845d0 100644 --- a/libweston/pixman-renderer.c +++ b/libweston/pixman-renderer.c @@ -97,7 +97,6 @@ pixman_renderer_read_pixels(struct weston_output *output, uint32_t width, uint32_t height) { struct pixman_output_state *po = get_output_state(output); - pixman_transform_t transform; pixman_image_t *out_buf; if (!po->hw_buffer) { @@ -111,25 +110,15 @@ pixman_renderer_read_pixels(struct weston_output *output, pixels, (PIXMAN_FORMAT_BPP(format) / 8) * width); - /* Caller expects vflipped source image */ - pixman_transform_init_translate(&transform, - pixman_int_to_fixed (x), - pixman_int_to_fixed (y - pixman_image_get_height (po->hw_buffer))); - pixman_transform_scale(&transform, NULL, - pixman_fixed_1, - pixman_fixed_minus_1); - pixman_image_set_transform(po->hw_buffer, &transform); - pixman_image_composite32(PIXMAN_OP_SRC, po->hw_buffer, /* src */ NULL /* mask */, out_buf, /* dest */ - 0, 0, /* src_x, src_y */ + x, y, /* src_x, src_y */ 0, 0, /* mask_x, mask_y */ 0, 0, /* dest_x, dest_y */ pixman_image_get_width (po->hw_buffer), /* width */ pixman_image_get_height (po->hw_buffer) /* height */); - pixman_image_set_transform(po->hw_buffer, NULL); pixman_image_unref(out_buf); @@ -883,7 +872,6 @@ pixman_renderer_init(struct weston_compositor *ec) pixman_renderer_surface_copy_content; ec->renderer = &renderer->base; ec->capabilities |= WESTON_CAP_ROTATION_ANY; - ec->capabilities |= WESTON_CAP_CAPTURE_YFLIP; ec->capabilities |= WESTON_CAP_VIEW_CLIP_MASK; renderer->debug_binding = |