From 9b016d2e466f342cc6649504fa48ab6a810c7e94 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 12 Aug 2012 21:36:30 +0100 Subject: [PATCH] sna: do not bother attaching to a miniscule ShmPixmap If the pixmap is less than a page in size we are unlikely to recover the cost of tracking it via the GPU. Signed-off-by: Chris Wilson --- src/sna/sna_accel.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index b27e7fbc..136aceb7 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -757,7 +757,7 @@ sna_pixmap_create_shm(ScreenPtr screen, DBG(("%s(%dx%d, depth=%d, bpp=%d, pitch=%d)\n", __FUNCTION__, width, height, depth, bpp, pitch)); - if (wedged(sna) || bpp == 0) { + if (wedged(sna) || bpp == 0 || pitch*height <= 4096) { fallback: pixmap = sna_pixmap_create_unattached(screen, 0, 0, depth); if (pixmap == NULL) @@ -809,9 +809,7 @@ fallback: } } - priv->cpu_bo = kgem_create_map(&sna->kgem, - addr, pitch*(height-1)+width*bpp/8, - false); + priv->cpu_bo = kgem_create_map(&sna->kgem, addr, pitch*height, false); if (priv->cpu_bo == NULL) { priv->header = true; sna_pixmap_destroy(pixmap);