sna: Handle userptr failures more gracefully

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-08-11 08:58:14 +01:00
parent 5d6d9231cd
commit e9c0e54e69
2 changed files with 12 additions and 9 deletions

View File

@ -2190,7 +2190,7 @@ void _kgem_submit(struct kgem *kgem)
i,
kgem->exec[i].handle,
(int)kgem->exec[i].offset,
found ? bytes(found) : -1,
found ? kgem_bo_size(found) : -1,
found ? found->tiling : -1,
(int)(kgem->exec[i].flags & EXEC_OBJECT_NEEDS_FENCE),
found ? found->purged : -1);

View File

@ -754,9 +754,11 @@ sna_pixmap_create_shm(ScreenPtr screen,
struct sna_pixmap *priv;
PixmapPtr pixmap;
DBG(("%s(%d, %d, %d)\n", __FUNCTION__, width, height, depth));
DBG(("%s(%dx%d, depth=%d, bpp=%d, pitch=%d)\n",
__FUNCTION__, width, height, depth, bpp, pitch));
if (wedged(sna)) {
if (wedged(sna) || bpp == 0) {
fallback:
pixmap = sna_pixmap_create_unattached(screen, 0, 0, depth);
if (pixmap == NULL)
return NULL;
@ -807,19 +809,20 @@ sna_pixmap_create_shm(ScreenPtr screen,
}
}
priv->cpu_bo = kgem_create_map(&sna->kgem, addr, pitch*height, false);
priv->cpu_bo = kgem_create_map(&sna->kgem,
addr, pitch*(height-1)+width*bpp/8,
false);
if (priv->cpu_bo == NULL) {
free(priv);
FreePixmap(pixmap);
return GetScratchPixmapHeader(screen, width, height, depth,
bpp, pitch, addr);
priv->header = true;
sna_pixmap_destroy(pixmap);
goto fallback;
}
priv->cpu_bo->flush = true;
priv->cpu_bo->pitch = pitch;
sna_accel_watch_flush(sna, 1);
priv->cpu = true;
priv->shm = true;
priv->header = true;
sna_damage_all(&priv->cpu_damage, width, height);
pixmap->devKind = pitch;