summaryrefslogtreecommitdiff
path: root/glamor/glamor_render.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2015-11-05 16:35:56 -0800
committerEric Anholt <eric@anholt.net>2015-11-10 13:55:51 -0800
commit9a5972801f7789833062e5711e77483b643eef92 (patch)
treecb9e709564b16af4ed7f87a7d6b8f36d6c4b3550 /glamor/glamor_render.c
parente7aa4d3c7420d45cca2b7e1e69e22cebc64d5b74 (diff)
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: Eric Anholt <eric@anholt.net> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Diffstat (limited to 'glamor/glamor_render.c')
-rw-r--r--glamor/glamor_render.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c
index c3a8f1771..d8574ece6 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;