[PATCH weston] libweston: don't accumulate damage from transparent views

Emre Ucan eucan at de.adit-jv.com
Wed Apr 18 13:44:26 UTC 2018


If view is set to be entirely transparent,
there is no need to accumulate its damage.

This is an important optimization for
using view transparency. Because otherwise
transparent views are rendered like an
opaque view, and their pixel values
are set to 0 in fragment shader.

Signed-off-by: Emre Ucan <eucan at de.adit-jv.com>
---
 libweston/compositor.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libweston/compositor.c b/libweston/compositor.c
index a9de4ac..4bcf120 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -2122,7 +2122,10 @@ compositor_accumulate_damage(struct weston_compositor *ec)
 		pixman_region32_init(&opaque);
 
 		wl_list_for_each(ev, &ec->view_list, link) {
-			if (ev->plane != plane)
+			/* If view is set to be entirely transparent,
+			 * there is no need to accumulate its damage.
+			 */
+			if (ev->plane != plane || ev->alpha == 0.0f)
 				continue;
 
 			view_accumulate_damage(ev, &opaque);
-- 
2.7.4



More information about the wayland-devel mailing list