summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sna/gen6_common.h64
-rw-r--r--src/sna/gen7_render.c12
-rw-r--r--src/sna/gen8_render.c10
3 files changed, 40 insertions, 46 deletions
diff --git a/src/sna/gen6_common.h b/src/sna/gen6_common.h
index 212215d1..49e241f2 100644
--- a/src/sna/gen6_common.h
+++ b/src/sna/gen6_common.h
@@ -30,8 +30,8 @@
#include "sna.h"
-#define NO_RING_SWITCH 0
-#define PREFER_RENDER 0
+#define NO_RING_SWITCH(sna) (!(sna)->kgem.has_semaphores)
+#define PREFER_RENDER 0 /* -1 -> BLT, 1 -> RENDER */
static inline bool is_uncached(struct sna *sna,
struct kgem_bo *bo)
@@ -46,10 +46,7 @@ inline static bool can_switch_to_blt(struct sna *sna,
if (sna->kgem.ring != KGEM_RENDER)
return true;
- if (NO_RING_SWITCH)
- return false;
-
- if (!sna->kgem.has_semaphores)
+ if (NO_RING_SWITCH(sna))
return false;
if (flags & COPY_LAST)
@@ -67,27 +64,6 @@ inline static bool can_switch_to_blt(struct sna *sna,
return kgem_ring_is_idle(&sna->kgem, KGEM_BLT);
}
-inline static bool can_switch_to_render(struct sna *sna,
- struct kgem_bo *bo)
-{
- if (sna->kgem.ring == KGEM_RENDER)
- return true;
-
- if (NO_RING_SWITCH)
- return false;
-
- if (!sna->kgem.has_semaphores)
- return false;
-
- 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);
-}
-
static inline bool untiled_tlb_miss(struct kgem_bo *bo)
{
if (kgem_bo_is_render(bo))
@@ -100,22 +76,32 @@ static int prefer_blt_bo(struct sna *sna,
struct kgem_bo *src,
struct kgem_bo *dst)
{
+ assert(dst != NULL);
+
if (PREFER_RENDER)
return PREFER_RENDER < 0;
- if (dst && dst->rq)
+ if (dst->rq)
return RQ_IS_BLT(dst->rq);
if (sna->flags & SNA_POWERSAVE)
return true;
- if (src && sna->render_state.gt > 1)
- return false;
+ if (src) {
+ if (sna->render_state.gt > 1)
+ return false;
- if (src && src->rq)
- return RQ_IS_BLT(src->rq);
+ if (src->rq)
+ return RQ_IS_BLT(src->rq);
+ } else {
+ if (sna->render_state.gt > 2)
+ return false;
+ }
- return dst == NULL || dst->tiling == I915_TILING_NONE || is_uncached(sna, dst);
+ if (sna->render_state.gt < 2)
+ return true;
+
+ return dst->tiling == I915_TILING_NONE || is_uncached(sna, dst);
}
inline static bool force_blt_ring(struct sna *sna)
@@ -150,16 +136,22 @@ prefer_blt_ring(struct sna *sna, struct kgem_bo *bo, unsigned flags)
nonnull inline static bool
prefer_render_ring(struct sna *sna, struct kgem_bo *bo)
{
+ if (sna->kgem.ring == KGEM_RENDER)
+ return true;
+
+ if (sna->kgem.ring != KGEM_NONE && NO_RING_SWITCH(sna))
+ return false;
+
if (kgem_bo_is_render(bo))
return true;
if (sna->flags & SNA_POWERSAVE)
return false;
- if (sna->render_state.gt < 2)
- return false;
+ if (!prefer_blt_bo(sna, NULL, bo))
+ return true;
- return can_switch_to_render(sna, bo);
+ return !kgem_ring_is_idle(&sna->kgem, KGEM_RENDER);
}
inline static bool
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index ed5044dd..87b0ca6f 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -60,8 +60,6 @@
#define NO_FILL_ONE 0
#define NO_FILL_CLEAR 0
-#define NO_RING_SWITCH 0
-
#define USE_8_PIXEL_DISPATCH 1
#define USE_16_PIXEL_DISPATCH 1
#define USE_32_PIXEL_DISPATCH 0
@@ -2883,9 +2881,6 @@ prefer_blt_copy(struct sna *sna,
assert((flags & COPY_SYNC) == 0);
- if (src_bo == dst_bo && can_switch_to_blt(sna, dst_bo, flags))
- return true;
-
if (untiled_tlb_miss(src_bo) ||
untiled_tlb_miss(dst_bo))
return true;
@@ -2893,6 +2888,11 @@ prefer_blt_copy(struct sna *sna,
if (force_blt_ring(sna))
return true;
+ if (sna->render_state.gt < 3 &&
+ src_bo == dst_bo &&
+ can_switch_to_blt(sna, dst_bo, flags))
+ return true;
+
if (kgem_bo_is_render(dst_bo) ||
kgem_bo_is_render(src_bo))
return false;
@@ -2951,7 +2951,7 @@ fallback_blt:
&extents)) {
bool big = too_large(extents.x2-extents.x1, extents.y2-extents.y1);
- if ((big || can_switch_to_blt(sna, dst_bo, flags)) &&
+ if ((big || !prefer_render_ring(sna, dst_bo)) &&
sna_blt_copy_boxes(sna, alu,
src_bo, src_dx, src_dy,
dst_bo, dst_dx, dst_dy,
diff --git a/src/sna/gen8_render.c b/src/sna/gen8_render.c
index 5f260883..f6747ef1 100644
--- a/src/sna/gen8_render.c
+++ b/src/sna/gen8_render.c
@@ -2704,9 +2704,6 @@ prefer_blt_copy(struct sna *sna,
assert((flags & COPY_SYNC) == 0);
- if (src_bo == dst_bo && can_switch_to_blt(sna, dst_bo, flags))
- return true;
-
if (untiled_tlb_miss(src_bo) ||
untiled_tlb_miss(dst_bo))
return true;
@@ -2714,6 +2711,11 @@ prefer_blt_copy(struct sna *sna,
if (force_blt_ring(sna))
return true;
+ if (sna->render_state.gt < 3 &&
+ src_bo == dst_bo &&
+ can_switch_to_blt(sna, dst_bo, flags))
+ return true;
+
if (kgem_bo_is_render(dst_bo) ||
kgem_bo_is_render(src_bo))
return false;
@@ -2774,7 +2776,7 @@ fallback_blt:
&extents)) {
bool big = too_large(extents.x2-extents.x1, extents.y2-extents.y1);
- if ((big || can_switch_to_blt(sna, dst_bo, flags)) &&
+ if ((big || !prefer_render_ring(sna, dst_bo)) &&
sna_blt_copy_boxes(sna, alu,
src_bo, src_dx, src_dy,
dst_bo, dst_dx, dst_dy,