Commit 9a597280 authored by Eric Anholt's avatar Eric Anholt

glamor: Fix segfault in fallback picture uploading.

If the source/mask pixmap is a pixmap that doesn't have an FBO
attached, and it doesn't match the Render operation's size, then we'll
composite it to a CPU temporary (not sure why).  We would take the
PictFormatShort from the source Picture, make a pixmap of that depth,
and try to look up the PictFormat description from the depth and the
PictFormatShort.  However, the screen's PictFormats are only attached
to the screen's visuals' depths.  So, with an x2r10g10b10 short format
(depth 30), we wouldn't find the screen's PictFormat for it
(associated with depth 32).

Instead of trying to look up from the screen, just use the pFormat
that came from our source picture.  The only time we need to look up a
PictFormat when we're doing non-shader gradients, which we put in
a8r8g8b8.
Signed-off-by: 's avatarEric Anholt <eric@anholt.net>
Reviewed-by: 's avatarMichel Dänzer <michel.daenzer@amd.com>
parent e7aa4d3c
......@@ -1279,12 +1279,17 @@ glamor_convert_gradient_picture(ScreenPtr screen,
PixmapPtr pixmap;
PicturePtr dst = NULL;
int error;
PictFormatPtr pFormat;
PictFormatShort format;
if (!source->pDrawable)
if (source->pDrawable) {
pFormat = source->pFormat;
format = pFormat->format;
} else {
format = PICT_a8r8g8b8;
else
format = source->format;
pFormat = PictureMatchFormat(screen, 32, format);
}
#ifdef GLAMOR_GRADIENT_SHADER
if (!source->pDrawable) {
if (source->pSourcePict->type == SourcePictTypeLinear) {
......@@ -1320,10 +1325,7 @@ glamor_convert_gradient_picture(ScreenPtr screen,
return NULL;
dst = CreatePicture(0,
&pixmap->drawable,
PictureMatchFormat(screen,
PIXMAN_FORMAT_DEPTH(format),
format), 0, 0, serverClient, &error);
&pixmap->drawable, pFormat, 0, 0, serverClient, &error);
glamor_destroy_pixmap(pixmap);
if (!dst)
return NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment