From f2a64dbdfceac985d235c4873f52013633d6cfd8 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 13 Feb 2013 17:15:46 +0000 Subject: [PATCH] sna: Avoid stalling on a SHM upload when otherwise idle Fixes regresion from commit 09ea1f4402b3bd0e411b90eb5575b3ff066d7356 Author: Chris Wilson Date: Thu Jan 10 16:26:24 2013 +0000 sna: Prefer to use the GPU for copies from SHM onto tiled destinations As the stalls on IVB 64-bit machines at least greatly offset the benefits. As those earlier measurements were made on the same IVB machine but running in 32-bit mode, I need to double-check whether or not this is another 32-bit peculiarity. Signed-off-by: Chris Wilson --- src/sna/kgem.c | 4 +++- src/sna/sna_accel.c | 10 +++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/sna/kgem.c b/src/sna/kgem.c index 9f274619..e0f804e6 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -4737,7 +4737,9 @@ void kgem_bo_sync__cpu(struct kgem *kgem, struct kgem_bo *bo) void kgem_bo_sync__cpu_full(struct kgem *kgem, struct kgem_bo *bo, bool write) { assert(bo->proxy == NULL); - kgem_bo_submit(kgem, bo); + + if (write || bo->needs_flush) + kgem_bo_submit(kgem, bo); if (bo->domain != DOMAIN_CPU) { struct drm_i915_gem_set_domain set_domain; diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 134b72fc..12f078eb 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -4138,17 +4138,14 @@ static bool use_shm_bo(struct sna *sna, DBG(("%s: yes, complex alu=%d\n", __FUNCTION__, alu)); return true; } - if (bo->tiling) { - DBG(("%s:, yes, dst tiled=%d\n", __FUNCTION__, bo->tiling)); - return true; - } if (__kgem_bo_is_busy(&sna->kgem, bo)) { DBG(("%s: yes, dst is busy\n", __FUNCTION__)); return true; } - if (__kgem_bo_is_busy(&sna->kgem, priv->cpu_bo)) { + if (priv->cpu_bo->needs_flush && + __kgem_bo_is_busy(&sna->kgem, priv->cpu_bo)) { DBG(("%s: yes, src is busy\n", __FUNCTION__)); return true; } @@ -4378,8 +4375,7 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc, src_priv == NULL && sna->kgem.has_userptr && box_inplace(src_pixmap, ®ion->extents) && - ((sna->kgem.has_llc && bo->tiling && !bo->scanout) || - __kgem_bo_is_busy(&sna->kgem, bo))) { + __kgem_bo_is_busy(&sna->kgem, bo)) { struct kgem_bo *src_bo; bool ok = false;