From 67b44104168650473a24e69056707e0b35f1713e Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 2 Sep 2012 12:47:36 +0100 Subject: sna: Cache the temporary upload buffer when copying boxes Signed-off-by: Chris Wilson --- src/sna/sna_accel.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index bb7cda25..0cb10bc2 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -3889,6 +3889,9 @@ move_to_gpu(PixmapPtr pixmap, struct sna_pixmap *priv, return count > SOURCE_BIAS; } else { + if (w == pixmap->drawable.width && h == pixmap->drawable.height) + return count > SOURCE_BIAS; + return count * w*h >= (SOURCE_BIAS+2) * (int)pixmap->drawable.width * pixmap->drawable.height; } } @@ -4348,6 +4351,7 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc, if (alu != GXcopy) { PixmapPtr tmp; + struct kgem_bo *src_bo; int i; assert(src_pixmap->drawable.depth != 1); @@ -4363,6 +4367,9 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc, if (tmp == NullPixmap) return; + src_bo = sna_pixmap_get_bo(tmp); + assert(src_bo != NULL); + dx = -region->extents.x1; dy = -region->extents.y1; for (i = 0; i < n; i++) { @@ -4389,8 +4396,13 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc, box[i].y2 - box[i].y1); } + if (n == 1 && + tmp->drawable.width == src_pixmap->drawable.width && + tmp->drawable.height == src_pixmap->drawable.height) + kgem_proxy_bo_attach(src_bo, &src_priv->gpu_bo); + if (!sna->render.copy_boxes(sna, alu, - tmp, sna_pixmap_get_bo(tmp), dx, dy, + tmp, src_bo, dx, dy, dst_pixmap, bo, 0, 0, box, n, 0)) { DBG(("%s: fallback - accelerated copy boxes failed\n", -- cgit v1.2.3