From 8eaafdb43998b5cdefb20b8098c558fa5decb115 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 24 Apr 2013 15:48:14 +0100 Subject: [PATCH] sna: Prevent accessing an uninitialised region in move_area_to_gpu() If we skip the migration, we need to avoid using the unitialiased region. There is no bad consequence as both branches of the if are no-ops, but it does silence the static checkers and should make the predicate cheaper. Signed-off-by: Chris Wilson --- src/sna/sna_accel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 02b0a44c..43a6d709 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -2651,7 +2651,8 @@ done: if (flags & MOVE_WRITE) { priv->clear = false; priv->cpu = false; - if (priv->cpu_damage == NULL && + if (!DAMAGE_IS_ALL(priv->gpu_damage) && + priv->cpu_damage == NULL && box_inplace(pixmap, &r.extents)) { DBG(("%s: large operation on undamaged, promoting to full GPU\n", __FUNCTION__));