sna/gen7: Prefer the BLT for self-copies

If we are copying to ourselves, we have to regularly flush the render
cache at which point the RENDER pipeline is slower than the BLT
pipeline.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-07-29 15:36:44 +01:00
parent 33d6afda6c
commit 89e75dbcb6
1 changed files with 16 additions and 3 deletions

View File

@ -2437,6 +2437,13 @@ try_blt(struct sna *sna,
if (can_switch_rings(sna)) {
if (sna_picture_is_solid(src, NULL))
return true;
if (dst->pDrawable == src->pDrawable)
return true;
if (src->pDrawable &&
get_drawable_pixmap(dst->pDrawable) == get_drawable_pixmap(src->pDrawable))
return true;
}
return false;
@ -3315,7 +3322,8 @@ static inline bool prefer_blt_copy(struct sna *sna,
}
static inline bool
overlaps(struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy,
overlaps(struct sna *sna,
struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy,
struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy,
const BoxRec *box, int n)
{
@ -3324,6 +3332,9 @@ overlaps(struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy,
if (src_bo != dst_bo)
return false;
if (can_switch_rings(sna))
return true;
extents = box[0];
while (--n) {
box++;
@ -3356,7 +3367,8 @@ gen7_render_copy_boxes(struct sna *sna, uint8_t alu,
DBG(("%s (%d, %d)->(%d, %d) x %d, alu=%x, self-copy=%d, overlaps? %d\n",
__FUNCTION__, src_dx, src_dy, dst_dx, dst_dy, n, alu,
src_bo == dst_bo,
overlaps(src_bo, src_dx, src_dy,
overlaps(sna,
src_bo, src_dx, src_dy,
dst_bo, dst_dx, dst_dy,
box, n)));
@ -3395,7 +3407,8 @@ gen7_render_copy_boxes(struct sna *sna, uint8_t alu,
}
if (!(alu == GXcopy || alu == GXclear) ||
overlaps(src_bo, src_dx, src_dy,
overlaps(sna,
src_bo, src_dx, src_dy,
dst_bo, dst_dx, dst_dy,
box, n)) {
fallback_blt: