From b61e6398f0cf94d3c483e30c05ceae4a8383d16c Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 14 Mar 2014 11:32:38 +0000 Subject: [PATCH] sna: Ensure we flush SHM pixmaps if rendering to a GPU shadow Normally, we try to render into the CPU bo of a SHM pixmap. However, under the right circumstances we may try to do a series of rendering into the GPU bo and then copy it back to the CPU bo. In that case, we need to be sure to mark the pixmap as requiring the flush. Signed-off-by: Chris Wilson --- src/sna/sna_accel.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 716a9fe..4f08e99 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -3438,7 +3438,7 @@ sna_drawable_use_bo(DrawablePtr drawable, unsigned flags, const BoxRec *box, flags &= ~PREFER_GPU; if ((flags & (PREFER_GPU | IGNORE_CPU)) == IGNORE_CPU) { - if (box_inplace(pixmap, box)) + if (priv->gpu_bo && box_inplace(pixmap, box)) flags |= PREFER_GPU; } @@ -3618,6 +3618,7 @@ move_to_gpu: } done: + assert(priv->move_to_gpu == NULL); assert(priv->gpu_bo != NULL); assert(priv->gpu_bo->refcnt); if (sna_damage_is_all(&priv->gpu_damage, @@ -3635,6 +3636,7 @@ done: assert(priv->gpu_bo->proxy == NULL); assert(priv->clear == false); assert(priv->cpu == false); + assert(!priv->shm); return priv->gpu_bo; use_gpu_bo: @@ -3654,6 +3656,11 @@ use_gpu_bo: } } + if (priv->shm) { + assert(!priv->flush); + list_move(&priv->flush_list, &sna->flush_pixmaps); + } + DBG(("%s: using whole GPU bo\n", __FUNCTION__)); assert(priv->gpu_bo != NULL); assert(priv->gpu_bo->refcnt); -- 2.7.4