From: Pekka Paalanen <pekka.paala...@collabora.co.uk>

Allow global control of the pixman shadow buffers. The compositor can
choose whether all output use or do not use a shadoe 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 <pekka.paala...@collabora.co.uk>
Signed-off-by: Fabien Lahoudere <fabien.lahoud...@collabora.com>
---
 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 ce33905..a1df45b 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -261,6 +261,7 @@ struct drm_backend {
        bool atomic_modeset;
 
        int use_pixman;
+       bool use_pixman_shadow;
 
        struct udev_input input;
 
@@ -4124,6 +4125,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:
@@ -4151,9 +4153,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);
@@ -5905,6 +5912,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;
 
@@ -6064,6 +6072,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 68f93ea..5322229 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
-- 
1.8.3.1

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to