[PATCH] xwayland: Fix damage reporting

Adel Gadllah adel.gadllah at gmail.com
Sat Apr 19 01:26:34 PDT 2014


Currently we accumulate damage in a list and call wl_surface_damage() for every
rectangle in the accumulated regions in xwl_screen_post_damage(). If the window
size changes we might end up with a damage region that exceeds the window
bounds causing compositors like mutter to call glTexSubImage2D with an area
that exceeds the buffer dimensions causing GL_INVALID_VALUE.

So intersect the damage region with the window's shape region in
xwl_screen_post_damage().

Signed-off-by: Adel Gadllah <adel.gadllah at gmail.com>
---
 hw/xwayland/xwayland.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index c2c6481..7f810aa 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -325,7 +325,7 @@ static void
 xwl_screen_post_damage(struct xwl_screen *xwl_screen)
 {
     struct xwl_window *xwl_window;
-    RegionPtr region;
+    RegionPtr region, shape_region;
     BoxPtr box;
     int count, i;
     struct wl_buffer *buffer;
@@ -334,6 +334,9 @@ xwl_screen_post_damage(struct xwl_screen *xwl_screen)
     xorg_list_for_each_entry(xwl_window, &xwl_screen->damage_window_list,
                              link_damage) {
         region = DamageRegion(xwl_window->damage);
+        shape_region = wBoundingShape(xwl_window->window);
+        if (shape_region)
+            RegionIntersect(region, region, shape_region);
         count = RegionNumRects(region);
 
         pixmap = (*xwl_screen->screen->GetWindowPixmap) (xwl_window->window);
-- 
1.9.0



More information about the xorg-devel mailing list