summaryrefslogtreecommitdiff
path: root/src/sna/gen6_render.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-09-08 22:34:09 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-09-08 22:34:09 +0100
commit77d74ec777d511df6f5aa484f3b7752f2c0b96ad (patch)
treea7cd2fe5dfd19170be52d4c4839ac3ff6093dbd3 /src/sna/gen6_render.c
parent287727ee223d56705e5792fe0a6c9a99077559e6 (diff)
sna/gen6: Prefer the RCS on large GT systems
For SNB, the different between RCS and BCS is more marginal but it is slightly in favour of using rendercopy on GT2. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/gen6_render.c')
-rw-r--r--src/sna/gen6_render.c77
1 files changed, 73 insertions, 4 deletions
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index 52e0171b..70821f72 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -77,6 +77,7 @@ struct gt_info {
int max_vs_entries;
int max_gs_entries;
} urb;
+ int gt;
};
static const struct gt_info gt1_info = {
@@ -85,6 +86,7 @@ static const struct gt_info gt1_info = {
.max_gs_threads = 21,
.max_wm_threads = 40,
.urb = { 32, 256, 256 },
+ .gt = 1,
};
static const struct gt_info gt2_info = {
@@ -93,6 +95,7 @@ static const struct gt_info gt2_info = {
.max_gs_threads = 60,
.max_wm_threads = 80,
.urb = { 64, 256, 256 },
+ .gt = 2,
};
static const uint32_t ps_kernel_packed[][4] = {
@@ -1889,6 +1892,24 @@ 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) && !bo->scanout)
+ 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))
@@ -1908,16 +1929,42 @@ static int prefer_blt_bo(struct sna *sna, struct kgem_bo *bo)
return bo->tiling == I915_TILING_NONE || bo->scanout;
}
+inline static bool force_blt_ring(struct sna *sna)
+{
+ if (sna->flags & SNA_POWERSAVE)
+ return true;
+
+ if (sna->kgem.mode == KGEM_RENDER)
+ return false;
+
+ if (sna->render_state.gen6.info->gt < 2)
+ return true;
+
+ return false;
+}
+
inline static bool prefer_blt_ring(struct sna *sna,
struct kgem_bo *bo,
unsigned flags)
{
- if (sna->flags & SNA_POWERSAVE)
- return true;
+ assert(!force_blt_ring(sna));
+ assert(!kgem_bo_is_render(bo));
return can_switch_to_blt(sna, bo, flags);
}
+inline static bool prefer_render_ring(struct sna *sna,
+ struct kgem_bo *bo)
+{
+ if (sna->flags & SNA_POWERSAVE)
+ return false;
+
+ if (sna->render_state.gen6.info->gt < 2)
+ return false;
+
+ return can_switch_to_render(sna, bo);
+}
+
static bool
try_blt(struct sna *sna,
PicturePtr dst, PicturePtr src,
@@ -2171,10 +2218,16 @@ prefer_blt_composite(struct sna *sna, struct sna_composite_op *tmp)
untiled_tlb_miss(tmp->src.bo))
return true;
+ 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;
@@ -2636,10 +2689,16 @@ static inline bool prefer_blt_copy(struct sna *sna,
untiled_tlb_miss(dst_bo))
return true;
+ if (force_blt_ring(sna))
+ return true;
+
if (kgem_bo_is_render(dst_bo) ||
kgem_bo_is_render(src_bo))
return false;
+ if (prefer_render_ring(sna, dst_bo))
+ return false;
+
if (!prefer_blt_ring(sna, dst_bo, flags))
return false;
@@ -3051,11 +3110,17 @@ static inline bool prefer_blt_fill(struct sna *sna,
if (PREFER_RENDER)
return PREFER_RENDER < 0;
+ if (untiled_tlb_miss(bo))
+ return true;
+
+ if (force_blt_ring(sna))
+ return true;
+
if (kgem_bo_is_render(bo))
return false;
- if (untiled_tlb_miss(bo))
- return true;
+ if (prefer_render_ring(sna, bo))
+ return false;
if (!prefer_blt_ring(sna, bo, 0))
return false;
@@ -3159,6 +3224,7 @@ gen6_render_fill_boxes(struct sna *sna,
assert(GEN6_SAMPLER(tmp.u.gen6.flags) == FILL_SAMPLER);
assert(GEN6_VERTEX(tmp.u.gen6.flags) == FILL_VERTEX);
+ kgem_set_mode(&sna->kgem, KGEM_RENDER, dst_bo);
if (!kgem_check_bo(&sna->kgem, dst_bo, NULL)) {
kgem_submit(&sna->kgem);
assert(kgem_check_bo(&sna->kgem, dst_bo, NULL));
@@ -3338,6 +3404,7 @@ gen6_render_fill(struct sna *sna, uint8_t alu,
assert(GEN6_SAMPLER(op->base.u.gen6.flags) == FILL_SAMPLER);
assert(GEN6_VERTEX(op->base.u.gen6.flags) == FILL_VERTEX);
+ kgem_set_mode(&sna->kgem, KGEM_RENDER, dst_bo);
if (!kgem_check_bo(&sna->kgem, dst_bo, NULL)) {
kgem_submit(&sna->kgem);
assert(kgem_check_bo(&sna->kgem, dst_bo, NULL));
@@ -3418,6 +3485,7 @@ gen6_render_fill_one(struct sna *sna, PixmapPtr dst, struct kgem_bo *bo,
assert(GEN6_SAMPLER(tmp.u.gen6.flags) == FILL_SAMPLER);
assert(GEN6_VERTEX(tmp.u.gen6.flags) == FILL_VERTEX);
+ kgem_set_mode(&sna->kgem, KGEM_RENDER, bo);
if (!kgem_check_bo(&sna->kgem, bo, NULL)) {
kgem_submit(&sna->kgem);
if (!kgem_check_bo(&sna->kgem, bo, NULL)) {
@@ -3504,6 +3572,7 @@ gen6_render_clear(struct sna *sna, PixmapPtr dst, struct kgem_bo *bo)
assert(GEN6_SAMPLER(tmp.u.gen6.flags) == FILL_SAMPLER);
assert(GEN6_VERTEX(tmp.u.gen6.flags) == FILL_VERTEX);
+ kgem_set_mode(&sna->kgem, KGEM_RENDER, bo);
if (!kgem_check_bo(&sna->kgem, bo, NULL)) {
kgem_submit(&sna->kgem);
if (!kgem_check_bo(&sna->kgem, bo, NULL)) {