xf86-video-intel: src/sna/sna_render.c
Chris Wilson
ickle at kemper.freedesktop.org
Fri Mar 2 16:00:00 PST 2012
src/sna/sna_render.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
New commits:
commit aaed9e9722aa30a3d6dc9a3f07309655de65b6bd
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Fri Mar 2 23:31:24 2012 +0000
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 at chris-wilson.co.uk>
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c
index 0266ea4..a345962 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;
}
More information about the xorg-commit
mailing list