sna: Force the creation of a backing pixmap for scanout

Ordinarily if the GPU is wedged, we just want to create a shadow buffer.
Except that we must ensure that we do allow a bo to be created for
attaching to the scanout.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-03-08 12:10:24 +00:00
parent 6abfa4c566
commit 33af42e628
2 changed files with 10 additions and 1 deletions

View File

@ -2365,7 +2365,7 @@ unsigned kgem_can_create_2d(struct kgem *kgem,
uint32_t pitch, size;
unsigned flags = 0;
if (depth < 8 || kgem->wedged)
if (depth < 8)
return 0;
if (width > MAXSHORT || height > MAXSHORT)

View File

@ -730,6 +730,14 @@ static PixmapPtr sna_create_pixmap(ScreenPtr screen,
}
assert(width && height);
if (wedged(sna)) {
if (usage == SNA_CREATE_FB) {
flags = KGEM_CAN_CREATE_GPU;
goto force_create;
}
goto fallback;
}
flags = kgem_can_create_2d(&sna->kgem, width, height, depth);
if (flags == 0) {
DBG(("%s: can not use GPU, just creating shadow\n",
@ -758,6 +766,7 @@ static PixmapPtr sna_create_pixmap(ScreenPtr screen,
if (usage == CREATE_PIXMAP_USAGE_GLYPH_PICTURE)
goto fallback;
force_create:
pad = PixmapBytePad(width, depth);
if (pad * height <= 4096) {
DBG(("%s: small buffer [%d], attaching to shadow pixmap\n",