[PATCH] render: Don't generate invalid pixman format when using a 24bpp framebuffer with a 32bit depth visual.
Robert Ancell
robert.ancell at canonical.com
Thu Jun 5 21:36:59 PDT 2014
When using the fb backend at 24bpp it allows a visual with 32 bit depth.
This would cause RENDER to try and create an invalid pixman buffer and hit the
following assertion when trying to render to it:
*** BUG ***
In create_bits_image_internal: The expression PIXMAN_FORMAT_BPP (format) >= PIXMAN_FORMAT_DEPTH (format) was false
Set a breakpoint on '_pixman_log_error' to debug
Fix is to ensure that the bpp is always at least as big as the drawable depth.
---
render/picture.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/render/picture.c b/render/picture.c
index 7da9310..f411521 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -762,6 +762,7 @@ CreatePicture(Picture pid,
{
PicturePtr pPicture;
PictureScreenPtr ps = GetPictureScreen(pDrawable->pScreen);
+ int bpp;
pPicture = dixAllocateScreenObjectWithPrivates(pDrawable->pScreen,
PictureRec, PRIVATE_PICTURE);
@@ -773,7 +774,10 @@ CreatePicture(Picture pid,
pPicture->id = pid;
pPicture->pDrawable = pDrawable;
pPicture->pFormat = pFormat;
- pPicture->format = pFormat->format | (pDrawable->bitsPerPixel << 24);
+ bpp = pDrawable->bitsPerPixel;
+ if (bpp < pFormat->depth)
+ bpp = BitsPerPixel (pFormat->depth);
+ pPicture->format = pFormat->format | (bpp << 24);
/* security creation/labeling check */
*error = XaceHook(XACE_RESOURCE_ACCESS, client, pid, PictureType, pPicture,
--
2.0.0
More information about the xorg-devel
mailing list