summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-01-22 16:04:13 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-01-22 16:11:41 +0000
commit238fc67aa945d5669eccd2a8fe8e98402b9a6223 (patch)
tree17bbde89b45d59acc4dc3f10fe85194ab3d86df9
parentaeaffb102190a8846c6341e72a4338b41639d679 (diff)
sna: Incude prefer-gpu hint in decision to upload CPU textures
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_render.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c
index efe415e3..0796453d 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -373,17 +373,20 @@ move_to_gpu(PixmapPtr pixmap, const BoxRec *box)
w = box->x2 - box->x1;
h = box->y2 - box->y1;
if (w == pixmap->drawable.width && h == pixmap->drawable.height) {
- bool upload = true;
+ bool upload;
- if (pixmap->devKind * pixmap->drawable.height <= 4096 ||
+ priv = sna_pixmap_attach(pixmap);
+ if (!priv)
+ return false;
+
+ upload = true;
+ if (!priv->gpu ||
kgem_choose_tiling(&to_sna_from_pixmap(pixmap)->kgem,
I915_TILING_X,
pixmap->drawable.width,
pixmap->drawable.height,
- pixmap->drawable.bitsPerPixel) == I915_TILING_NONE) {
- priv = sna_pixmap_attach(pixmap);
- upload = priv && priv->source_count++ > SOURCE_BIAS;
- }
+ pixmap->drawable.bitsPerPixel) == I915_TILING_NONE)
+ upload = priv->source_count++ > SOURCE_BIAS;
DBG(("%s: migrating whole pixmap (%dx%d) for source (%d,%d),(%d,%d)? %d\n",
__FUNCTION__,
@@ -397,12 +400,14 @@ move_to_gpu(PixmapPtr pixmap, const BoxRec *box)
if (64*w*h < pixmap->drawable.width * pixmap->drawable.height)
return FALSE;
- count = SOURCE_BIAS;
priv = sna_pixmap_attach(pixmap);
- if (priv)
- count = priv->source_count++;
+ if (!priv)
+ return FALSE;
- if (kgem_choose_tiling(&to_sna_from_pixmap(pixmap)->kgem, I915_TILING_X,
+ count = priv->source_count++;
+ if (!priv->gpu ||
+ kgem_choose_tiling(&to_sna_from_pixmap(pixmap)->kgem,
+ I915_TILING_X,
pixmap->drawable.width,
pixmap->drawable.height,
pixmap->drawable.bitsPerPixel) == I915_TILING_NONE)