summaryrefslogtreecommitdiff
path: root/src/lx_exa.c
diff options
context:
space:
mode:
authorFrank Huang <frankr.huang@amd.com>2010-06-13 18:47:12 +0800
committerMart Raudsepp <leio@gentoo.org>2010-06-17 13:47:49 +0300
commitb46d4ff787bce43409d59837d736af0be2b0dda5 (patch)
tree9db212ca8c4e65fc02b9877da5a74a8a31fbfa87 /src/lx_exa.c
parent8e53a62f196dfc4eb1e8769183b00bf4a3122ddc (diff)
Prevent the pixmap migration if the geode GP can not do the acceleration.
Bring all the "return FALSE" condition forward from lx_prepare_composite to lx_check_composite. The Xserver will handle this condition. See more on Freedesktop Bugzilla #27243 Signed-off-by: Frank Huang <frankr.huang@amd.com> Acked-by: Mart Raudsepp <leio@gentoo.org>
Diffstat (limited to 'src/lx_exa.c')
-rw-r--r--src/lx_exa.c52
1 files changed, 29 insertions, 23 deletions
diff --git a/src/lx_exa.c b/src/lx_exa.c
index b267cc0..4af71f2 100644
--- a/src/lx_exa.c
+++ b/src/lx_exa.c
@@ -536,12 +536,15 @@ static Bool
lx_check_composite(int op, PicturePtr pSrc, PicturePtr pMsk, PicturePtr pDst)
{
GeodeRec *pGeode = GEODEPTR_FROM_PICTURE(pDst);
+ const struct exa_format_t *srcFmt, *dstFmt;
/* Check that the operation is supported */
if (op > PictOpAdd)
return FALSE;
+ /* We need the off-screen buffer to do the multipass work */
+
if (usesPasses(op)) {
if (pGeode->exaBfrOffset == 0 || !pMsk)
return FALSE;
@@ -583,21 +586,23 @@ lx_check_composite(int op, PicturePtr pSrc, PicturePtr pMsk, PicturePtr pDst)
return FALSE;
if (pMsk && op != PictOpClear) {
+ struct blend_ops_t *opPtr = &lx_alpha_ops[op * 2];
+ int direction = (opPtr->channel == CIMGP_CHANNEL_A_SOURCE) ? 0 : 1;
+
+ /* Direction 0 indicates src->dst, 1 indiates dst->src */
+ if (((direction == 0) && (pSrc->pDrawable->bitsPerPixel < 16)) ||
+ ((direction == 1) && (pDst->pDrawable->bitsPerPixel < 16))) {
+ ErrorF("Can't do mask blending with less then 16bpp\n");
+ return FALSE;
+ }
/* We can only do masks with a 8bpp or a 4bpp mask */
if (pMsk->format != PICT_a8 && pMsk->format != PICT_a4)
return FALSE;
+ /* The pSrc should be 1x1 pixel if the pMsk is not zero */
+ if (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1)
+ return FALSE;
}
- return TRUE;
-}
-
-static Bool
-lx_prepare_composite(int op, PicturePtr pSrc, PicturePtr pMsk,
- PicturePtr pDst, PixmapPtr pxSrc, PixmapPtr pxMsk, PixmapPtr pxDst)
-{
- GeodeRec *pGeode = GEODEPTR_FROM_PIXMAP(pxDst);
- const struct exa_format_t *srcFmt, *dstFmt;
-
/* Get the formats for the source and destination */
if ((srcFmt = lx_get_format(pSrc)) == NULL) {
@@ -631,6 +636,20 @@ lx_prepare_composite(int op, PicturePtr pSrc, PicturePtr pMsk,
ErrorF("EXA: Can't rotate and convert formats at the same time\n");
return FALSE;
}
+ return TRUE;
+}
+
+static Bool
+lx_prepare_composite(int op, PicturePtr pSrc, PicturePtr pMsk,
+ PicturePtr pDst, PixmapPtr pxSrc, PixmapPtr pxMsk, PixmapPtr pxDst)
+{
+ GeodeRec *pGeode = GEODEPTR_FROM_PIXMAP(pxDst);
+ const struct exa_format_t *srcFmt, *dstFmt;
+
+ /* Get the formats for the source and destination */
+
+ srcFmt = lx_get_format(pSrc);
+ dstFmt = lx_get_format(pDst);
/* Set up the scratch buffer with the information we need */
@@ -644,14 +663,6 @@ lx_prepare_composite(int op, PicturePtr pSrc, PicturePtr pMsk,
struct blend_ops_t *opPtr = &lx_alpha_ops[op * 2];
int direction = (opPtr->channel == CIMGP_CHANNEL_A_SOURCE) ? 0 : 1;
- /* Direction 0 indicates src->dst, 1 indiates dst->src */
-
- if (((direction == 0) && (pxSrc->drawable.bitsPerPixel < 16)) ||
- ((direction == 1) && (pxDst->drawable.bitsPerPixel < 16))) {
- ErrorF("Can't do mask blending with less then 16bpp\n");
- return FALSE;
- }
-
/* Get the source color */
if (direction == 0)
@@ -661,11 +672,6 @@ lx_prepare_composite(int op, PicturePtr pSrc, PicturePtr pMsk,
exaScratch.srcColor = lx_get_source_color(pxDst, pDst->format,
pSrc->format);
- /* FIXME: What to do here? */
-
- if (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1)
- return FALSE;
-
/* Save off the info we need (reuse the source values to save space) */
exaScratch.type = COMP_TYPE_MASK;