summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-09-02 12:47:36 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-09-02 12:47:36 +0100
commit67b44104168650473a24e69056707e0b35f1713e (patch)
tree837473237476a02b4f9c4144051a009e1de49bb6
parent4b558281e04e4d4febfc361632a90f8a45080c49 (diff)
sna: Cache the temporary upload buffer when copying boxes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c14
1 files changed, 13 insertions, 1 deletions
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",