Blame SOURCES/0001-xwayland-Just-send-the-bounding-box-of-the-damage.patch

70130e
From a655c446880613e17c3b91e66a7f7ac125f62228 Mon Sep 17 00:00:00 2001
70130e
From: Adam Jackson <ajax@redhat.com>
70130e
Date: Tue, 8 Oct 2013 13:54:27 -0400
70130e
Subject: [PATCH] xwayland: Just send the bounding box of the damage
70130e
70130e
... instead of every rect.  Most window updates are going to be CopyArea
70130e
in from offscreen, with plenty of time to get back around to
70130e
BlockHandler in between, so this is no change there.  However for
70130e
pathological apps like x11perf that draw complicated primitives directly
70130e
to the window you can end up with massive numbers of damage rects, and
70130e
you can run out of space in the write buffer and crash.
70130e
70130e
This obviously isn't a complete fix, and it would be nice to handle this
70130e
more gracefully in the wayland client code, but this at least lets
70130e
x11perf -all run to completion.
70130e
70130e
While we're in the area, rearrange attach to be before damage, not
70130e
after, since the spec says that's the correct order.
70130e
70130e
Signed-off-by: Adam Jackson <ajax@redhat.com>
70130e
---
70130e
 hw/xfree86/xwayland/xwayland.c | 14 +++++---------
70130e
 1 file changed, 5 insertions(+), 9 deletions(-)
70130e
70130e
diff --git a/hw/xfree86/xwayland/xwayland.c b/hw/xfree86/xwayland/xwayland.c
70130e
index c70a52d..c10a213 100644
70130e
--- a/hw/xfree86/xwayland/xwayland.c
70130e
+++ b/hw/xfree86/xwayland/xwayland.c
70130e
@@ -333,22 +333,18 @@ void xwl_screen_post_damage(struct xwl_screen *xwl_screen)
70130e
     struct xwl_window *xwl_window;
70130e
     RegionPtr region;
70130e
     BoxPtr box;
70130e
-    int count, i;
70130e
 
70130e
     xorg_list_for_each_entry(xwl_window, &xwl_screen->damage_window_list,
70130e
 			     link_damage) {
70130e
 	region = DamageRegion(xwl_window->damage);
70130e
-	count = RegionNumRects(region);
70130e
-	for (i = 0; i < count; i++) {
70130e
-	    box = &RegionRects(region)[i];
70130e
-	    wl_surface_damage(xwl_window->surface,
70130e
-			      box->x1, box->y1,
70130e
-			      box->x2 - box->x1,
70130e
-			      box->y2 - box->y1);
70130e
-	}
70130e
 	wl_surface_attach(xwl_window->surface,
70130e
 			  xwl_window->buffer,
70130e
 			  0, 0);
70130e
+	box = &region->extents;
70130e
+	wl_surface_damage(xwl_window->surface,
70130e
+			  box->x1, box->y1,
70130e
+			  box->x2 - box->x1,
70130e
+			  box->y2 - box->y1);
70130e
 	wl_surface_commit(xwl_window->surface);
70130e
 	DamageEmpty(xwl_window->damage);
70130e
     }
70130e
-- 
70130e
1.8.3.1
70130e