summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-12-20 20:42:08 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-12-20 20:42:08 +0000
commit743084bbc4c411694190f60cf5161086ada6454f (patch)
tree361d75931ae0608e4a529ad8db9f129d49050471
parentca24ffe8b9acef034a5610376c73ebbdce87d41c (diff)
sna: Only upload tiny pixmaps on the second use
Most small pixmaps appear to be single shot, so amalgamate them into one buffer and trim our memory usage. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_render.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c
index 3face435..341cf2c8 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -315,11 +315,19 @@ 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) {
- DBG(("%s: migrating whole pixmap (%dx%d) for source (%d,%d),(%d,%d)\n",
+ bool upload = true;
+
+ if (pixmap->devKind * pixmap->drawable.height <= 4096) {
+ priv = sna_pixmap(pixmap);
+ upload = priv && priv->source_count++ > SOURCE_BIAS;
+ }
+
+ DBG(("%s: migrating whole pixmap (%dx%d) for source (%d,%d),(%d,%d)? %d\n",
__FUNCTION__,
pixmap->drawable.width, pixmap->drawable.height,
- box->x1, box->y1, box->x2, box->y2));
- return TRUE;
+ box->x1, box->y1, box->x2, box->y2,
+ upload));
+ return upload;
}
/* ignore tiny fractions */