summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-03-02 23:31:24 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-03-02 23:49:58 +0000
commitaaed9e9722aa30a3d6dc9a3f07309655de65b6bd (patch)
tree5094b7f1905d5918150554bc53b494a397d24c20
parent599cd0e8ef3080fc735860bef4e47107c1c05f9a (diff)
sna: Encourage promotion of snooped CPU bo to real GPU bo
This fixes the regression in performance of fishietank on gen2. As the texture atlas is too large to be tiled, one might presume that it has the same performance characteristics as the snooped linear CPU buffer. It does not. Therefore if we attempt to reuse a vmap bo, promote it to a full GPU bo. This hopefully gains the benefit of avoiding the copy for single shot sources, but still gives us the benefit of avoiding the clflushes. On the plus side, it does prove that gen2 handles snoopable memory from both the blitter and the sampler! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_render.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c
index 0266ea44..a3459629 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -323,7 +323,7 @@ use_cpu_bo(struct sna *sna, PixmapPtr pixmap, const BoxRec *box)
}
if (priv->gpu_bo->tiling != I915_TILING_NONE &&
- priv->cpu_bo->pitch >= 4096) {
+ (priv->cpu_bo->vmap || priv->cpu_bo->pitch >= 4096)) {
DBG(("%s: GPU bo exists and is tiled [%d], upload\n",
__FUNCTION__, priv->gpu_bo->tiling));
return NULL;
@@ -332,21 +332,23 @@ use_cpu_bo(struct sna *sna, PixmapPtr pixmap, const BoxRec *box)
int w = box->x2 - box->x1;
int h = box->y2 - box->y1;
- if ((priv->create & KGEM_CAN_CREATE_GPU) == 0)
- goto done;
+ if (priv->cpu_bo->vmap && priv->source_count > SOURCE_BIAS) {
+ DBG(("%s: promoting snooped CPU bo due to reuse\n",
+ __FUNCTION__));
+ return NULL;
+ }
- if (priv->source_count*w*h >= pixmap->drawable.width * pixmap->drawable.height &&
- I915_TILING_NONE != kgem_choose_tiling(&sna->kgem, I915_TILING_X,
- pixmap->drawable.width,
- pixmap->drawable.height,
- pixmap->drawable.bitsPerPixel)) {
+ if (priv->source_count++*w*h >= (int)pixmap->drawable.width * pixmap->drawable.height &&
+ I915_TILING_NONE != kgem_choose_tiling(&sna->kgem, I915_TILING_X,
+ pixmap->drawable.width,
+ pixmap->drawable.height,
+ pixmap->drawable.bitsPerPixel)) {
DBG(("%s: pitch (%d) requires tiling\n",
__FUNCTION__, priv->cpu_bo->pitch));
return NULL;
}
}
-done:
DBG(("%s for box=(%d, %d), (%d, %d)\n",
__FUNCTION__, box->x1, box->y1, box->x2, box->y2));
return priv->cpu_bo;
@@ -528,7 +530,7 @@ sna_render_pixmap_bo(struct sna *sna,
if (priv->cpu_bo &&
(DAMAGE_IS_ALL(priv->cpu_damage) || !priv->gpu_damage) &&
- priv->cpu_bo->pitch < 4096) {
+ !priv->cpu_bo->vmap && priv->cpu_bo->pitch < 4096) {
channel->bo = kgem_bo_reference(priv->cpu_bo);
return 1;
}