From 89e75dbcb6749bde7587ecc08abed276c255e7f9 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 29 Jul 2012 15:36:44 +0100 Subject: [PATCH] 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 --- src/sna/gen7_render.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c index aba58112..29ee4aff 100644 --- a/src/sna/gen7_render.c +++ b/src/sna/gen7_render.c @@ -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: