sna/glyphs: Check that we attached to the cache pixmaps upon creation
If the hw is wedged, then the pixmap creation routines will return an ordinary unattached pixmap. The code presumed that it would only return a pixmap with an attached bo, and so would segfault as it chased the invalid pointer after a GPU hang and the server was restarted. Considering that we already checked that the GPU wasn't wedged before we started, this is just mild paranoia, but on a run-once piece of code. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
86f1ae9164
commit
6c5fb84f4d
|
|
@ -157,12 +157,15 @@ static Bool realize_glyph_caches(struct sna *sna)
|
|||
|
||||
for (i = 0; i < ARRAY_SIZE(formats); i++) {
|
||||
struct sna_glyph_cache *cache = &sna->render.glyph[i];
|
||||
struct sna_pixmap *priv;
|
||||
PixmapPtr pixmap;
|
||||
PicturePtr picture;
|
||||
PicturePtr picture = NULL;
|
||||
PictFormatPtr pPictFormat;
|
||||
CARD32 component_alpha;
|
||||
int depth = PIXMAN_FORMAT_DEPTH(formats[i]);
|
||||
int error;
|
||||
PictFormatPtr pPictFormat = PictureMatchFormat(screen, depth, formats[i]);
|
||||
|
||||
pPictFormat = PictureMatchFormat(screen, depth, formats[i]);
|
||||
if (!pPictFormat)
|
||||
goto bail;
|
||||
|
||||
|
|
@ -175,16 +178,18 @@ static Bool realize_glyph_caches(struct sna *sna)
|
|||
if (!pixmap)
|
||||
goto bail;
|
||||
|
||||
/* Prevent the cache from ever being paged out */
|
||||
sna_pixmap(pixmap)->pinned = true;
|
||||
priv = sna_pixmap(pixmap);
|
||||
if (priv != NULL) {
|
||||
/* Prevent the cache from ever being paged out */
|
||||
priv->pinned = true;
|
||||
|
||||
component_alpha = NeedsComponent(pPictFormat->format);
|
||||
picture = CreatePicture(0, &pixmap->drawable, pPictFormat,
|
||||
CPComponentAlpha, &component_alpha,
|
||||
serverClient, &error);
|
||||
component_alpha = NeedsComponent(pPictFormat->format);
|
||||
picture = CreatePicture(0, &pixmap->drawable, pPictFormat,
|
||||
CPComponentAlpha, &component_alpha,
|
||||
serverClient, &error);
|
||||
}
|
||||
|
||||
screen->DestroyPixmap(pixmap);
|
||||
|
||||
if (!picture)
|
||||
goto bail;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue