summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMart Raudsepp <leio@gentoo.org>2012-09-18 08:41:53 +0300
committerMart Raudsepp <leio@gentoo.org>2012-09-18 08:53:07 +0300
commit5f7797cadeaf8a28612b9d0c394f8507eb687c34 (patch)
treeb5eb9596aa2ddd3d3151ccd361c08935dee212c4
parent4a20e8ac285cfe8a033f771ac8df25f873db9908 (diff)
lx_exa: Fix crash with solid fills on PictOpAdd operations
lx_check_composite has many special checks for PictOpAdd to return successfully early, but these were done even earlier than the check for solid fills. This resulted in lx_prepare_composite assuming the source pixmap exists, which is not the case with solid fills. Move the solid fill fallback checks before the others, so we are guaranteed to always have a source pixmap in PrepareComposite and Composite and don't crash trying to access a NULL pointer. Also move up the mask check to do less checks in the PictOpAdd logic.
-rw-r--r--src/lx_exa.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/lx_exa.c b/src/lx_exa.c
index bcff23e..b341c51 100644
--- a/src/lx_exa.c
+++ b/src/lx_exa.c
@@ -547,28 +547,33 @@ lx_check_composite(int op, PicturePtr pSrc, PicturePtr pMsk, PicturePtr pDst)
if (op > PictOpAdd)
GEODE_FALLBACK(("Operation %d is not supported\n", op));
+ /* XXX - don't know if we can do any hwaccel on solid fills or gradient types */
+ if (pSrc->pSourcePict || (pMsk && pMsk->pSourcePict))
+ GEODE_FALLBACK(("Solid fills or gradient types are not supported\n"));
+
+ if (pMsk && op == PictOpAdd)
+ GEODE_FALLBACK(("PictOpAdd with mask is not supported\n"));
+
/* FIXME: Meet this conditions from the debug for PictOpAdd.
* Any Other possibilities? Add a judge for the future supplement */
if (op == PictOpAdd && pSrc->format == PICT_a8r8g8b8 &&
- pDst->format == PICT_a8 && !pMsk)
+ pDst->format == PICT_a8)
return TRUE;
if (op == PictOpAdd && pSrc->format == PICT_x8r8g8b8 &&
- pDst->format == PICT_a8 && !pMsk)
+ pDst->format == PICT_a8)
return TRUE;
if (op == PictOpAdd && pSrc->format == PICT_r5g6b5 &&
- pDst->format == PICT_a8 && !pMsk)
+ pDst->format == PICT_a8)
return TRUE;
if (usesPasses(op)) {
+ /* FIXME: Slightly misleading fallback msg when !pMsk */
if (pGeode->exaBfrOffset == 0 || !pMsk)
GEODE_FALLBACK(("Multipass operation requires off-screen buffer\n"));
}
- if (pMsk && op == PictOpAdd)
- GEODE_FALLBACK(("PictOpAdd with mask is not supported\n"));
-
/* Check that the filter matches what we support */
switch (pSrc->filter) {
@@ -585,10 +590,6 @@ lx_check_composite(int op, PicturePtr pSrc, PicturePtr pMsk, PicturePtr pDst)
if (pMsk && pMsk->transform)
GEODE_FALLBACK(("Mask transforms are not supported\n"));
- /* XXX - don't know if we can do any hwaccel on solid fills or gradient types */
- if (pSrc->pSourcePict || (pMsk && pMsk->pSourcePict))
- GEODE_FALLBACK(("Solid fills or gradient types are not supported\n"));
-
/* Keep an eye out for source rotation transforms - those we can
* do something about */