summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-06-17 14:08:06 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-06-17 14:35:21 +0100
commit0ca25c7b49efa9c83a3ce5b727e5a339a73d8ee0 (patch)
treee209c61f906b66bf285233751f12d9ef3de49d1c
parent322e51a3a552d89e5e5ecbb82a9243f134c8d36f (diff)
sna: Cache small pixmaps rather than forcing a large fallback for BLT operations
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 482720b7..bd21380a 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -11835,8 +11835,32 @@ sna_pixmap_get_source_bo(PixmapPtr pixmap)
if (priv->cpu_damage && priv->cpu_bo)
return kgem_bo_reference(priv->cpu_bo);
- if (!sna_pixmap_move_to_gpu(pixmap, MOVE_READ | MOVE_ASYNC_HINT))
- return NULL;
+ if (!sna_pixmap_move_to_gpu(pixmap, MOVE_READ | MOVE_ASYNC_HINT)) {
+ struct kgem_bo *upload;
+ struct sna *sna = to_sna_from_pixmap(pixmap);
+ BoxRec box;
+
+ box.x1 = box.y1 = 0;
+ box.x2 = pixmap->drawable.width;
+ box.y2 = pixmap->drawable.height;
+
+ if (priv->gpu_damage)
+ return NULL;
+
+ upload = kgem_upload_source_image(&sna->kgem,
+ pixmap->devPrivate.ptr, &box,
+ pixmap->devKind,
+ pixmap->drawable.bitsPerPixel);
+ if (upload == NULL)
+ return NULL;
+ if (pixmap->usage_hint == 0 && priv->gpu_bo == NULL) {
+ DBG(("%s: adding upload cache to pixmap=%ld\n",
+ __FUNCTION__, pixmap->drawable.serialNumber));
+ assert(upload->proxy != NULL);
+ kgem_proxy_bo_attach(upload, &priv->gpu_bo);
+ }
+ return upload;
+ }
return kgem_bo_reference(priv->gpu_bo);
}