[PATCH xserver 5/5] glamor: Fix segfault in fallback picture uploading.
Eric Anholt
eric at anholt.net
Fri Nov 6 12:21:48 PST 2015
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: Eric Anholt <eric at anholt.net>
---
glamor/glamor_render.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c
index c3a8f17..d8574ec 100644
--- a/glamor/glamor_render.c
+++ b/glamor/glamor_render.c
@@ -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;
--
2.6.2
More information about the xorg-devel
mailing list