sna: Prefer not to create a GPU bo without RENDER acceleration

Unless that bo happens to be used on a render chain to the scanout.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-07-28 23:08:07 +01:00
parent eefbe5b603
commit ca9d9c02a2
3 changed files with 9 additions and 5 deletions

View File

@ -558,6 +558,11 @@ static inline bool wedged(struct sna *sna)
return unlikely(sna->kgem.wedged);
}
static inline bool can_render(struct sna *sna)
{
return likely(!sna->kgem.wedged && sna->have_render);
}
static inline uint32_t pixmap_size(PixmapPtr pixmap)
{
return (pixmap->drawable.height - 1) * pixmap->devKind +

View File

@ -931,7 +931,7 @@ static PixmapPtr sna_create_pixmap(ScreenPtr screen,
goto fallback;
}
if (wedged(sna))
if (!can_render(sna))
flags = 0;
if (usage == CREATE_PIXMAP_USAGE_SCRATCH) {
@ -957,7 +957,6 @@ static PixmapPtr sna_create_pixmap(ScreenPtr screen,
if (usage == CREATE_PIXMAP_USAGE_BACKING_PIXMAP)
usage = 0;
force_create:
pad = PixmapBytePad(width, depth);
if (pad * height <= 4096) {
DBG(("%s: small buffer [%d], attaching to shadow pixmap\n",

View File

@ -188,7 +188,7 @@ bool sna_glyphs_create(struct sna *sna)
if (sna->render.white_image == NULL)
goto bail;
if (sna->kgem.wedged || !sna->have_render)
if (!can_render(sna))
return true;
for (i = 0; i < ARRAY_SIZE(formats); i++) {
@ -1675,10 +1675,10 @@ sna_glyphs(CARD8 op,
if (REGION_NUM_RECTS(dst->pCompositeClip) == 0)
return;
if (FALLBACK || !sna->have_render)
if (FALLBACK)
goto fallback;
if (wedged(sna)) {
if (!can_render(sna)) {
DBG(("%s: wedged\n", __FUNCTION__));
goto fallback;
}