summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2015-01-25 13:28:00 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2015-01-25 14:09:07 +0000
commit6c8d98436a207d179a6b3735928d03742cd3bf3a (patch)
tree35c983bbc47505577b82282249fb0426c6868c11
parented19b160089640c2e1167332b00ffe1e569a48dc (diff)
sna/gen6+: Tweak engine placement when considering src/dst combinations
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/gen6_common.h36
-rw-r--r--src/sna/gen6_render.c13
-rw-r--r--src/sna/gen7_render.c13
-rw-r--r--src/sna/gen8_render.c15
-rw-r--r--src/sna/kgem.h10
5 files changed, 55 insertions, 32 deletions
diff --git a/src/sna/gen6_common.h b/src/sna/gen6_common.h
index 482c6003..212215d1 100644
--- a/src/sna/gen6_common.h
+++ b/src/sna/gen6_common.h
@@ -82,6 +82,9 @@ inline static bool can_switch_to_render(struct sna *sna,
if (bo && !RQ_IS_BLT(bo->rq) && !is_uncached(sna, bo))
return true;
+ if (sna->render_state.gt > 2)
+ return true;
+
return !kgem_ring_is_idle(&sna->kgem, KGEM_RENDER);
}
@@ -93,21 +96,26 @@ static inline bool untiled_tlb_miss(struct kgem_bo *bo)
return bo->tiling == I915_TILING_NONE && bo->pitch >= 4096;
}
-static int prefer_blt_bo(struct sna *sna, struct kgem_bo *bo, bool dst)
+static int prefer_blt_bo(struct sna *sna,
+ struct kgem_bo *src,
+ struct kgem_bo *dst)
{
if (PREFER_RENDER)
return PREFER_RENDER < 0;
- if (bo->rq)
- return RQ_IS_BLT(bo->rq);
+ if (dst && dst->rq)
+ return RQ_IS_BLT(dst->rq);
if (sna->flags & SNA_POWERSAVE)
return true;
- if (dst && sna->render_state.gt > 1)
+ if (src && sna->render_state.gt > 1)
return false;
- return bo->tiling == I915_TILING_NONE || is_uncached(sna, bo);
+ if (src && src->rq)
+ return RQ_IS_BLT(src->rq);
+
+ return dst == NULL || dst->tiling == I915_TILING_NONE || is_uncached(sna, dst);
}
inline static bool force_blt_ring(struct sna *sna)
@@ -133,12 +141,18 @@ prefer_blt_ring(struct sna *sna, struct kgem_bo *bo, unsigned flags)
assert(!force_blt_ring(sna));
assert(!kgem_bo_is_render(bo));
+ if (kgem_bo_is_blt(bo))
+ return true;
+
return can_switch_to_blt(sna, bo, flags);
}
nonnull inline static bool
prefer_render_ring(struct sna *sna, struct kgem_bo *bo)
{
+ if (kgem_bo_is_render(bo))
+ return true;
+
if (sna->flags & SNA_POWERSAVE)
return false;
@@ -161,18 +175,13 @@ prefer_blt_composite(struct sna *sna, struct sna_composite_op *tmp)
if (force_blt_ring(sna))
return true;
- if (kgem_bo_is_render(tmp->dst.bo) ||
- kgem_bo_is_render(tmp->src.bo))
- return false;
-
if (prefer_render_ring(sna, tmp->dst.bo))
return false;
if (!prefer_blt_ring(sna, tmp->dst.bo, 0))
return false;
- return (prefer_blt_bo(sna, tmp->dst.bo, true) ||
- prefer_blt_bo(sna, tmp->src.bo, false));
+ return prefer_blt_bo(sna, tmp->src.bo, tmp->dst.bo);
}
nonnull static inline bool
@@ -188,9 +197,6 @@ prefer_blt_fill(struct sna *sna, struct kgem_bo *bo, unsigned flags)
return true;
if ((flags & (FILL_POINTS | FILL_SPANS)) == 0) {
- if (kgem_bo_is_render(bo))
- return false;
-
if (prefer_render_ring(sna, bo))
return false;
@@ -201,7 +207,7 @@ prefer_blt_fill(struct sna *sna, struct kgem_bo *bo, unsigned flags)
return true;
}
- return prefer_blt_bo(sna, bo, false);
+ return prefer_blt_bo(sna, NULL, bo);
}
void gen6_render_context_switch(struct kgem *kgem, int new_mode);
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index 51aa03ab..60deccfe 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -1984,6 +1984,10 @@ try_blt(struct sna *sna,
bo = __sna_drawable_peek_bo(dst->pDrawable);
if (bo == NULL)
return true;
+
+ if (untiled_tlb_miss(bo))
+ return true;
+
if (bo->rq)
return RQ_IS_BLT(bo->rq);
@@ -1991,11 +1995,11 @@ try_blt(struct sna *sna,
return true;
if (src->pDrawable) {
- bo = __sna_drawable_peek_bo(src->pDrawable);
- if (bo == NULL)
+ struct kgem_bo *s = __sna_drawable_peek_bo(src->pDrawable);
+ if (s == NULL)
return true;
- if (prefer_blt_bo(sna, bo, false))
+ if (prefer_blt_bo(sna, s, bo))
return true;
}
@@ -2696,8 +2700,7 @@ static inline bool prefer_blt_copy(struct sna *sna,
if (!prefer_blt_ring(sna, dst_bo, flags))
return false;
- return (prefer_blt_bo(sna, dst_bo, true) ||
- prefer_blt_bo(sna, src_bo, false));
+ return prefer_blt_bo(sna, src_bo, dst_bo);
}
static bool
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index 2281962f..8d6c6b3a 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -2204,6 +2204,10 @@ try_blt(struct sna *sna,
bo = __sna_drawable_peek_bo(dst->pDrawable);
if (bo == NULL)
return true;
+
+ if (untiled_tlb_miss(bo))
+ return true;
+
if (bo->rq)
return RQ_IS_BLT(bo->rq);
@@ -2211,11 +2215,11 @@ try_blt(struct sna *sna,
return true;
if (src->pDrawable) {
- bo = __sna_drawable_peek_bo(src->pDrawable);
- if (bo == NULL)
+ struct kgem_bo *s = __sna_drawable_peek_bo(src->pDrawable);
+ if (s == NULL)
return true;
- if (prefer_blt_bo(sna, bo, false))
+ if (prefer_blt_bo(sna, s, bo))
return true;
}
@@ -2898,8 +2902,7 @@ prefer_blt_copy(struct sna *sna,
if (!prefer_blt_ring(sna, dst_bo, flags))
return false;
- return (prefer_blt_bo(sna, dst_bo, true) ||
- prefer_blt_bo(sna, src_bo, false));
+ return prefer_blt_bo(sna, src_bo, dst_bo);
}
static bool
diff --git a/src/sna/gen8_render.c b/src/sna/gen8_render.c
index 52fca105..8a8837b8 100644
--- a/src/sna/gen8_render.c
+++ b/src/sna/gen8_render.c
@@ -2021,6 +2021,10 @@ try_blt(struct sna *sna,
bo = __sna_drawable_peek_bo(dst->pDrawable);
if (bo == NULL)
return true;
+
+ if (untiled_tlb_miss(bo))
+ return true;
+
if (bo->rq)
return RQ_IS_BLT(bo->rq);
@@ -2028,12 +2032,12 @@ try_blt(struct sna *sna,
return true;
if (src->pDrawable) {
- bo = __sna_drawable_peek_bo(src->pDrawable);
- if (bo == NULL)
+ struct kgem_bo *s = __sna_drawable_peek_bo(src->pDrawable);
+ if (s == NULL)
return true;
- if (prefer_blt_bo(sna, bo, false))
- return RQ_IS_BLT(bo->rq);
+ if (prefer_blt_bo(sna, s, bo))
+ return true;
}
if (sna->kgem.ring == KGEM_BLT) {
@@ -2720,8 +2724,7 @@ prefer_blt_copy(struct sna *sna,
if (!prefer_blt_ring(sna, dst_bo, flags))
return false;
- return (prefer_blt_bo(sna, dst_bo, true) ||
- prefer_blt_bo(sna, src_bo, false));
+ return prefer_blt_bo(sna, src_bo, dst_bo);
}
static bool
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index ae53e67b..873852d6 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -652,7 +652,15 @@ static inline bool kgem_bo_is_render(struct kgem_bo *bo)
DBG(("%s: handle=%d, rq? %d [%d]\n", __FUNCTION__,
bo->handle, bo->rq != NULL, (int)RQ_RING(bo->rq)));
assert(bo->refcnt);
- return bo->rq && RQ_RING(bo->rq) == I915_EXEC_RENDER;
+ return bo->rq && RQ_RING(bo->rq) != I915_EXEC_BLT;
+}
+
+static inline bool kgem_bo_is_blt(struct kgem_bo *bo)
+{
+ DBG(("%s: handle=%d, rq? %d\n", __FUNCTION__,
+ bo->handle, bo->rq != NULL, (int)RQ_RING(bo->rq)));
+ assert(bo->refcnt);
+ return RQ_RING(bo->rq) == I915_EXEC_BLT;
}
static inline void kgem_bo_mark_unreusable(struct kgem_bo *bo)