summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-12-24 09:59:24 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-12-24 10:08:06 +0000
commit3bcc9f08e1309725c18dfa5ca0e905bb88ebf4ea (patch)
tree094a0884d92150e897136e571a181f808753b138
parentefc8d04fc114e9966e5ca00600f9663ecf03a5ca (diff)
sna: Create a GPU for a streaming write
If we are about to do a write-only drawing operation that will exceed our cache, allocate a GPU bo and perform the operation inplace. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index c66ed66b..859530f7 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -888,6 +888,23 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
sna_pixmap_free_cpu(sna, priv);
}
}
+
+ if (priv->gpu_bo == NULL &&
+ sna_pixmap_choose_tiling(pixmap) != I915_TILING_NONE &&
+ region_inplace(sna, pixmap, region, priv)) {
+ sna_damage_subtract(&priv->cpu_damage, region);
+ if (sna_pixmap_move_to_gpu(pixmap, MOVE_WRITE)) {
+ pixmap->devPrivate.ptr =
+ kgem_bo_map(&sna->kgem, priv->gpu_bo,
+ PROT_WRITE);
+ priv->mapped = 1;
+
+ sna_damage_add(&priv->gpu_damage, region);
+
+ priv->gpu = true;
+ return true;
+ }
+ }
}
if (priv->mapped) {