From dee412d174e3180ec8999c9d473b36ff2118abcf Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Mon, 23 Apr 2018 11:44:58 +0200 Subject: [PATCH] compositor-drm: expose global shadow flag for pixman Allow global control of the pixman shadow buffers. The compositor can choose whether all output use or do not use a shadow buffer with the pixman renderer. The option is added to the end of struct weston_drm_backend_config to avoid bumping WESTON_DRM_BACKEND_CONFIG_VERSION. Signed-off-by: Pekka Paalanen Signed-off-by: Fabien Lahoudere Reviewed-by: Ian Ray --- libweston/compositor-drm.c | 15 ++++++++++++--- libweston/compositor-drm.h | 3 +++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c index bcf8962f..8b1ea66d 100644 --- a/libweston/compositor-drm.c +++ b/libweston/compositor-drm.c @@ -263,6 +263,7 @@ struct drm_backend { bool atomic_modeset; int use_pixman; + bool use_pixman_shadow; struct udev_input input; @@ -4082,6 +4083,7 @@ drm_output_init_pixman(struct drm_output *output, struct drm_backend *b) uint32_t format = output->gbm_format; uint32_t pixman_format; unsigned int i; + uint32_t flags = 0; switch (format) { case GBM_FORMAT_XRGB8888: @@ -4109,9 +4111,14 @@ drm_output_init_pixman(struct drm_output *output, struct drm_backend *b) goto err; } - if (pixman_renderer_output_create(&output->base, - PIXMAN_RENDERER_OUTPUT_USE_SHADOW) < 0) - goto err; + if (b->use_pixman_shadow) + flags |= PIXMAN_RENDERER_OUTPUT_USE_SHADOW; + + if (pixman_renderer_output_create(&output->base, flags) < 0) + goto err; + + weston_log("DRM: output %s %s shadow framebuffer.\n", output->base.name, + b->use_pixman_shadow ? "uses" : "does not use"); pixman_region32_init_rect(&output->previous_damage, output->base.x, output->base.y, output->base.width, output->base.height); @@ -6048,6 +6055,7 @@ drm_backend_create(struct weston_compositor *compositor, b->compositor = compositor; b->use_pixman = config->use_pixman; b->pageflip_timeout = config->pageflip_timeout; + b->use_pixman_shadow = config->use_pixman_shadow; compositor->backend = &b->base; @@ -6207,6 +6215,7 @@ err_compositor: static void config_init_to_defaults(struct weston_drm_backend_config *config) { + config->use_pixman_shadow = true; } WL_EXPORT int diff --git a/libweston/compositor-drm.h b/libweston/compositor-drm.h index 68f93eab..53222293 100644 --- a/libweston/compositor-drm.h +++ b/libweston/compositor-drm.h @@ -146,6 +146,9 @@ struct weston_drm_backend_config { * based on seat names and boot_vga to find the right device. */ char *specific_device; + + /** Use shadow buffer if using Pixman-renderer. */ + bool use_pixman_shadow; }; #ifdef __cplusplus