summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-01-06 11:32:54 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-01-06 11:35:32 +0000
commit2841c5fee79c42bca3e098ec620755d341b6888f (patch)
tree000b2fef1676df5614ed4464cda351ee3301f1a0
parent07f1724ba5759772043fc4c5d1163ddd640004c2 (diff)
sna: fast path move-to-cpu of an all-damaged CPU bo
When the bo is already completely damaged on the CPU, all we need to do is to sync with the CPU bo. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 06826d2a..8d6f584e 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -707,16 +707,19 @@ _sna_pixmap_move_to_cpu(PixmapPtr pixmap, unsigned int flags)
struct sna *sna = to_sna_from_pixmap(pixmap);
struct sna_pixmap *priv;
- DBG(("%s(pixmap=%p, flags=%x)\n", __FUNCTION__, pixmap, flags));
+ DBG(("%s(pixmap=%ld, flags=%x)\n", __FUNCTION__,
+ pixmap->drawable.serialNumber, flags));
priv = sna_pixmap(pixmap);
if (priv == NULL) {
- DBG(("%s: not attached to %p\n", __FUNCTION__, pixmap));
+ DBG(("%s: not attached\n", __FUNCTION__));
return true;
}
- DBG(("%s: gpu_bo=%p, gpu_damage=%p\n",
- __FUNCTION__, priv->gpu_bo, priv->gpu_damage));
+ DBG(("%s: gpu_bo=%d, gpu_damage=%p\n",
+ __FUNCTION__,
+ priv->gpu_bo ? priv->gpu_bo->handle : 0,
+ priv->gpu_damage));
if ((flags & MOVE_READ) == 0) {
assert(flags == MOVE_WRITE);
@@ -766,6 +769,11 @@ skip_inplace_map:
}
}
+ if (priv->cpu_damage && priv->cpu_damage->mode == DAMAGE_ALL) {
+ DBG(("%s: CPU all-damaged\n", __FUNCTION__));
+ goto done;
+ }
+
if (priv->mapped) {
pixmap->devPrivate.ptr = NULL;
priv->mapped = 0;
@@ -805,11 +813,6 @@ skip_inplace_map:
priv->gpu_damage = NULL;
}
- if (priv->cpu_bo) {
- DBG(("%s: syncing CPU bo\n", __FUNCTION__));
- kgem_bo_sync__cpu(&sna->kgem, priv->cpu_bo);
- }
-
if (flags & MOVE_WRITE) {
DBG(("%s: marking as damaged\n", __FUNCTION__));
sna_damage_all(&priv->cpu_damage,
@@ -819,9 +822,16 @@ skip_inplace_map:
if (priv->flush)
list_move(&priv->list, &sna->dirty_pixmaps);
+
+ priv->source_count = SOURCE_BIAS;
+ }
+
+done:
+ if (priv->cpu_bo) {
+ DBG(("%s: syncing CPU bo\n", __FUNCTION__));
+ kgem_bo_sync__cpu(&sna->kgem, priv->cpu_bo);
}
- priv->source_count = SOURCE_BIAS;
return true;
}