sna/gen6+: Fine tune placement of DRI copies

Avoid offsetting the overhead of the render copy only to be penalised by
the overhead of the semaphore. So compromise.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2013-01-02 13:47:51 +00:00
parent 2559cfcc4c
commit bc67bdcec8
4 changed files with 34 additions and 29 deletions

View File

@ -1772,7 +1772,8 @@ gen6_composite_set_target(struct sna *sna,
}
inline static bool can_switch_to_blt(struct sna *sna,
struct kgem_bo *bo)
struct kgem_bo *bo,
unsigned flags)
{
if (sna->kgem.ring != KGEM_RENDER)
return true;
@ -1783,6 +1784,9 @@ inline static bool can_switch_to_blt(struct sna *sna,
if (!sna->kgem.has_semaphores)
return false;
if (flags & COPY_LAST)
return true;
if (bo && RQ_IS_BLT(bo->rq))
return true;
@ -1803,9 +1807,10 @@ static int prefer_blt_bo(struct sna *sna, struct kgem_bo *bo)
}
inline static bool prefer_blt_ring(struct sna *sna,
struct kgem_bo *bo)
struct kgem_bo *bo,
unsigned flags)
{
return can_switch_to_blt(sna, bo);
return can_switch_to_blt(sna, bo, flags);
}
static bool
@ -1824,7 +1829,7 @@ try_blt(struct sna *sna,
return true;
}
if (sna_picture_is_solid(src, NULL) && can_switch_to_blt(sna, NULL))
if (sna_picture_is_solid(src, NULL) && can_switch_to_blt(sna, NULL, 0))
return true;
return false;
@ -2045,7 +2050,7 @@ prefer_blt_composite(struct sna *sna, struct sna_composite_op *tmp)
untiled_tlb_miss(tmp->src.bo))
return true;
if (!prefer_blt_ring(sna, tmp->dst.bo))
if (!prefer_blt_ring(sna, tmp->dst.bo, 0))
return false;
return (prefer_blt_bo(sna, tmp->dst.bo) | prefer_blt_bo(sna, tmp->src.bo)) > 0;
@ -2454,17 +2459,14 @@ static inline bool prefer_blt_copy(struct sna *sna,
if (sna->kgem.ring == KGEM_BLT)
return true;
if (src_bo == dst_bo && can_switch_to_blt(sna, dst_bo))
return true;
if ((flags & COPY_LAST && sna->kgem.ring != KGEM_RENDER))
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;
if (!prefer_blt_ring(sna, dst_bo))
if (!prefer_blt_ring(sna, dst_bo, flags))
return false;
return (prefer_blt_bo(sna, src_bo) >= 0 &&
@ -2549,7 +2551,7 @@ fallback_blt:
if (too_large(extents.x2-extents.x1, extents.y2-extents.y1))
goto fallback_blt;
if ((flags & COPY_LAST || can_switch_to_blt(sna, dst_bo)) &&
if (can_switch_to_blt(sna, dst_bo, flags) &&
sna_blt_compare_depth(&src->drawable, &dst->drawable) &&
sna_blt_copy_boxes(sna, alu,
src_bo, src_dx, src_dy,
@ -2877,7 +2879,7 @@ static inline bool prefer_blt_fill(struct sna *sna,
if (untiled_tlb_miss(bo))
return true;
return prefer_blt_ring(sna, bo) || prefer_blt_bo(sna, bo) >= 0;
return prefer_blt_ring(sna, bo, 0) || prefer_blt_bo(sna, bo) >= 0;
}
static bool

View File

@ -1896,7 +1896,8 @@ gen7_composite_set_target(struct sna *sna,
}
inline static bool can_switch_to_blt(struct sna *sna,
struct kgem_bo *bo)
struct kgem_bo *bo,
unsigned flags)
{
if (sna->kgem.ring != KGEM_RENDER)
return true;
@ -1907,6 +1908,9 @@ inline static bool can_switch_to_blt(struct sna *sna,
if (!sna->kgem.has_semaphores)
return false;
if (flags & COPY_LAST)
return true;
if (bo && RQ_IS_BLT(bo->rq))
return true;
@ -1927,9 +1931,10 @@ static int prefer_blt_bo(struct sna *sna, struct kgem_bo *bo)
}
inline static bool prefer_blt_ring(struct sna *sna,
struct kgem_bo *bo)
struct kgem_bo *bo,
unsigned flags)
{
return can_switch_to_blt(sna, bo);
return can_switch_to_blt(sna, bo, flags);
}
static bool
@ -1948,7 +1953,7 @@ try_blt(struct sna *sna,
return true;
}
if (sna_picture_is_solid(src, NULL) && can_switch_to_blt(sna, NULL))
if (sna_picture_is_solid(src, NULL) && can_switch_to_blt(sna, NULL, 0))
return true;
return false;
@ -2169,7 +2174,7 @@ prefer_blt_composite(struct sna *sna, struct sna_composite_op *tmp)
untiled_tlb_miss(tmp->src.bo))
return true;
if (!prefer_blt_ring(sna, tmp->dst.bo))
if (!prefer_blt_ring(sna, tmp->dst.bo, 0))
return false;
return (prefer_blt_bo(sna, tmp->dst.bo) | prefer_blt_bo(sna, tmp->src.bo)) > 0;
@ -2555,17 +2560,14 @@ static inline bool prefer_blt_copy(struct sna *sna,
if (sna->kgem.ring == KGEM_BLT)
return true;
if (src_bo == dst_bo && can_switch_to_blt(sna, dst_bo))
return true;
if ((flags & COPY_LAST && sna->kgem.ring != KGEM_RENDER))
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;
if (!prefer_blt_ring(sna, dst_bo))
if (!prefer_blt_ring(sna, dst_bo, flags))
return false;
return (prefer_blt_bo(sna, src_bo) >= 0 &&
@ -2650,7 +2652,7 @@ fallback_blt:
if (too_large(extents.x2-extents.x1, extents.y2-extents.y1))
goto fallback_blt;
if ((flags & COPY_LAST || can_switch_to_blt(sna, dst_bo)) &&
if (can_switch_to_blt(sna, dst_bo, flags) &&
sna_blt_compare_depth(&src->drawable, &dst->drawable) &&
sna_blt_copy_boxes(sna, alu,
src_bo, src_dx, src_dy,
@ -2967,7 +2969,7 @@ static inline bool prefer_blt_fill(struct sna *sna,
if (untiled_tlb_miss(bo))
return true;
return prefer_blt_ring(sna, bo) || prefer_blt_bo(sna, bo) >= 0;
return prefer_blt_ring(sna, bo, 0) || prefer_blt_bo(sna, bo) >= 0;
}
static bool

View File

@ -562,6 +562,11 @@ static inline bool kgem_bo_is_snoop(struct kgem_bo *bo)
return bo->snoop;
}
static inline void kgem_bo_mark_busy(struct kgem_bo *bo, int ring)
{
bo->rq = (struct kgem_request *)((uintptr_t)bo->rq | ring);
}
static inline bool kgem_bo_is_busy(struct kgem_bo *bo)
{
DBG(("%s: handle=%d, domain: %d exec? %d, rq? %d\n", __FUNCTION__,

View File

@ -521,11 +521,6 @@ static void sna_dri_select_mode(struct sna *sna, struct kgem_bo *dst, struct kge
return;
}
if (sna->kgem.has_semaphores) {
DBG(("%s: have sempahores, prefering defaults\n", __FUNCTION__));
return;
}
VG_CLEAR(busy);
busy.handle = src->handle;
if (drmIoctl(sna->kgem.fd, DRM_IOCTL_I915_GEM_BUSY, &busy))
@ -561,6 +556,7 @@ static void sna_dri_select_mode(struct sna *sna, struct kgem_bo *dst, struct kge
mode = KGEM_RENDER;
if (busy.busy & (1 << 17))
mode = KGEM_BLT;
kgem_bo_mark_busy(dst, mode);
_kgem_set_mode(&sna->kgem, mode);
}