From b68b76cf54a322e80685f1ec93538cd6c5813ea4 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 20 Feb 2012 13:38:11 +0000 Subject: [PATCH] sna: Move sync'ing of CPU bo after allocation to first write The idea was that we could afford to allocate an active CPU bo for copying to from using the GPU and later sync just before we need to write to the shadow pixels. Having the sync inside the allocation function potentially causes an unwanted stall. Signed-off-by: Chris Wilson --- src/sna/sna_accel.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index ab44cf35..aab85d85 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -321,10 +321,8 @@ sna_pixmap_alloc_cpu(struct sna *sna, if (priv->ptr == NULL) { kgem_bo_destroy(&sna->kgem, priv->cpu_bo); priv->cpu_bo = NULL; - } else { - kgem_bo_sync__cpu(&sna->kgem, priv->cpu_bo); + } else priv->stride = priv->cpu_bo->pitch; - } } } @@ -2599,6 +2597,11 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region, DBG(("%s: applying clear [%08x]\n", __FUNCTION__, priv->clear_color)); + if (priv->cpu_bo) { + DBG(("%s: syncing CPU bo\n", __FUNCTION__)); + kgem_bo_sync__cpu(&sna->kgem, priv->cpu_bo); + } + pixman_fill(pixmap->devPrivate.ptr, pixmap->devKind/sizeof(uint32_t), pixmap->drawable.bitsPerPixel,