From bb49222a514b1d6041f3d9530a22f5701377118b Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 2 Jun 2014 08:25:52 +0100 Subject: [PATCH] sna: Add DBG hints for using inplace CPU mmappings Signed-off-by: Chris Wilson --- src/sna/kgem.h | 12 ++++++++++-- src/sna/sna_io.c | 13 +++++++++---- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/sna/kgem.h b/src/sna/kgem.h index 12a99dba..a9fb9394 100644 --- a/src/sna/kgem.h +++ b/src/sna/kgem.h @@ -683,14 +683,22 @@ static inline bool kgem_bo_can_map__cpu(struct kgem *kgem, struct kgem_bo *bo, bool write) { + DBG(("%s: handle=%d\n", __FUNCTION__, bo->handle)); assert(bo->refcnt); - if (bo->purged || (bo->scanout && write)) + if (bo->purged || (bo->scanout && write)) { + DBG(("%s: no, writing to scanout? %d, or is stolen [inaccessible via CPU]? %d\n", + __FUNCTION__, bo->scanout && write, bo->purged)); return false; + } - if (kgem->has_llc) + if (kgem->has_llc) { + DBG(("%s: yes, has LLC and target is in LLC\n", __FUNCTION__)); return true; + } + DBG(("%s: non-LLC - CPU domain? %d, clean? %d\n", + __FUNCTION__, bo->domain == DOMAIN_CPU, !write || bo->exec == NULL)); if (bo->domain != DOMAIN_CPU) return false; diff --git a/src/sna/sna_io.c b/src/sna/sna_io.c index 2e9204fb..c71435a6 100644 --- a/src/sna/sna_io.c +++ b/src/sna/sna_io.c @@ -636,11 +636,16 @@ fallback: static bool upload_inplace__tiled(struct kgem *kgem, struct kgem_bo *bo) { - if (!kgem->memcpy_to_tiled_x) - return false; - - if (bo->tiling != I915_TILING_X) + DBG(("%s: tiling=%d\n", __FUNCTION__, bo->tiling)); + switch (bo->tiling) { + case I915_TILING_Y: return false; + case I915_TILING_X: + if (!kgem->memcpy_to_tiled_x) + return false; + default: + break; + } return kgem_bo_can_map__cpu(kgem, bo, true); }