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 <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-08-12 21:36:30 +01:00
parent 2f4de90709
commit 9b016d2e46
1 changed files with 2 additions and 4 deletions

View File

@ -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);