summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-06-12 18:44:27 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-06-12 18:44:27 +0100
commit6655cc1d9735a8433994c762583753b12e2125b4 (patch)
tree189d006ea39acccd4b94437ad647a9ab70bf4de4
parent1f180b89db412c5fa9fe95c8f6634be33a1d8581 (diff)
sna: Do not enlarge the read back region if there is already CPU damage
We enlarge the read back into to minimise the number of times we have to migrate pixmap data. However, if we then enlarge the read so that it overwrites CPU dirty data, then we can introduce corruption. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 1663fe3c..5d96ac57 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2451,7 +2451,11 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
if (flags & MOVE_WRITE) {
int n = RegionNumRects(region), i;
BoxPtr boxes = RegionRects(region);
- BoxPtr blocks = malloc(sizeof(BoxRec) * RegionNumRects(region));
+ BoxPtr blocks;
+
+ blocks = NULL;
+ if (priv->cpu_damage == NULL)
+ blocks = malloc(sizeof(BoxRec) * RegionNumRects(region));
if (blocks) {
for (i = 0; i < n; i++) {
blocks[i].x1 = boxes[i].x1 & ~31;