[weston,3/4] compositor-drm: expose global shadow flag for pixman

Submitted by Fabien Lahoudere on April 23, 2018, 9:44 a.m.

Details

Message ID 1524476699-10530-4-git-send-email-fabien.lahoudere@collabora.com
State Accepted
Headers show
Series "Optimize pixman renderer" ( rev: 2 ) in Wayland (DEPRECATED)

Not browsing as part of any series.

Commit Message

Fabien Lahoudere April 23, 2018, 9:44 a.m.
From: Pekka Paalanen <pekka.paalanen@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.paalanen@collabora.co.uk>
Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com>
---
 libweston/compositor-drm.c | 15 ++++++++++++---
 libweston/compositor-drm.h |  3 +++
 2 files changed, 15 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

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