commit d9be415cd30148ac7d5fc7fefb5775311eb30987 Author: Michel Dänzer Date: Thu Feb 28 10:48:13 2008 +0100 radeon: Handle EXA coordinate limits more cleverly. diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c index 0b69869..dc844ca 100644 --- a/src/radeon_exa_funcs.c +++ b/src/radeon_exa_funcs.c @@ -623,11 +623,11 @@ Bool FUNC_NAME(RADEONDrawInit)(ScreenPtr pScreen) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Setting EXA maxPitchBytes\n"); info->exa->maxPitchBytes = 16320; - info->exa->maxX = info->exa->Composite ? 2048 : 8192; + info->exa->maxX = 8192; #else - info->exa->maxX = info->exa->Composite ? 2048 : 16320 / 4; + info->exa->maxX = 16320 / 4; #endif - info->exa->maxY = info->exa->Composite ? 2048 : 8192; + info->exa->maxY = 8192; RADEONEngineInit(pScrn); diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c index 4606cc2..4eb781a 100644 --- a/src/radeon_exa_render.c +++ b/src/radeon_exa_render.c @@ -338,41 +338,76 @@ static Bool FUNC_NAME(R100TextureSetup)(PicturePtr pPict, PixmapPtr pPix, } #ifdef ONLY_ONCE + +static PixmapPtr +RADEONGetDrawablePixmap(DrawablePtr pDrawable) +{ + if (pDrawable->type == DRAWABLE_WINDOW) + return pDrawable->pScreen->GetWindowPixmap((WindowPtr)pDrawable); + else + return (PixmapPtr)pDrawable; +} + static Bool R100CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, PicturePtr pDstPicture) { + PixmapPtr pSrcPixmap, pDstPixmap; CARD32 tmp1; /* Check for unsupported compositing operations. */ if (op >= sizeof(RadeonBlendOp) / sizeof(RadeonBlendOp[0])) RADEON_FALLBACK(("Unsupported Composite op 0x%x\n", op)); - if (pMaskPicture != NULL && pMaskPicture->componentAlpha) { - /* Check if it's component alpha that relies on a source alpha and on - * the source value. We can only get one of those into the single - * source value that we get to blend with. - */ - if (RadeonBlendOp[op].src_alpha && - (RadeonBlendOp[op].blend_cntl & RADEON_SRC_BLEND_MASK) != - RADEON_SRC_BLEND_GL_ZERO) - { - RADEON_FALLBACK(("Component alpha not supported with source " - "alpha and source value blending.\n")); - } + if (!pSrcPicture->pDrawable) + return FALSE; + + pSrcPixmap = RADEONGetDrawablePixmap(pSrcPicture->pDrawable); + + if (pSrcPixmap->drawable.width >= 2048 || + pSrcPixmap->drawable.height >= 2048) { + RADEON_FALLBACK(("Source w/h too large (%d,%d).\n", + pSrcPixmap->drawable.width, + pSrcPixmap->drawable.height)); } - if (pDstPicture->pDrawable->width >= (1 << 11) || - pDstPicture->pDrawable->height >= (1 << 11)) - { + pDstPixmap = RADEONGetDrawablePixmap(pDstPicture->pDrawable); + + if (pDstPixmap->drawable.width >= 2048 || + pDstPixmap->drawable.height >= 2048) { RADEON_FALLBACK(("Dest w/h too large (%d,%d).\n", - pDstPicture->pDrawable->width, - pDstPicture->pDrawable->height)); + pDstPixmap->drawable.width, + pDstPixmap->drawable.height)); + } + + if (pMaskPicture) { + PixmapPtr pMaskPixmap = RADEONGetDrawablePixmap(pMaskPicture->pDrawable); + + if (pMaskPixmap->drawable.width >= 2048 || + pMaskPixmap->drawable.height >= 2048) { + RADEON_FALLBACK(("Mask w/h too large (%d,%d).\n", + pMaskPixmap->drawable.width, + pMaskPixmap->drawable.height)); + } + + if (pMaskPicture->componentAlpha) { + /* Check if it's component alpha that relies on a source alpha and + * on the source value. We can only get one of those into the + * single source value that we get to blend with. + */ + if (RadeonBlendOp[op].src_alpha && + (RadeonBlendOp[op].blend_cntl & RADEON_SRC_BLEND_MASK) != + RADEON_SRC_BLEND_GL_ZERO) { + RADEON_FALLBACK(("Component alpha not supported with source " + "alpha and source value blending.\n")); + } + } + + if (!R100CheckCompositeTexture(pMaskPicture, 1)) + return FALSE; } if (!R100CheckCompositeTexture(pSrcPicture, 0)) return FALSE; - if (pMaskPicture != NULL && !R100CheckCompositeTexture(pMaskPicture, 1)) - return FALSE; if (!RADEONGetDestFormat(pDstPicture, &tmp1)) return FALSE; @@ -604,32 +639,61 @@ static Bool FUNC_NAME(R200TextureSetup)(PicturePtr pPict, PixmapPtr pPix, static Bool R200CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, PicturePtr pDstPicture) { + PixmapPtr pSrcPixmap, pDstPixmap; CARD32 tmp1; TRACE; - /* Check for unsupported compositing operations. */ - if (op >= sizeof(RadeonBlendOp) / sizeof(RadeonBlendOp[0])) - RADEON_FALLBACK(("Unsupported Composite op 0x%x\n", op)); + if (!pSrcPicture->pDrawable) + return FALSE; - if (pMaskPicture != NULL && pMaskPicture->componentAlpha) { - /* Check if it's component alpha that relies on a source alpha and on - * the source value. We can only get one of those into the single - * source value that we get to blend with. - */ - if (RadeonBlendOp[op].src_alpha && - (RadeonBlendOp[op].blend_cntl & RADEON_SRC_BLEND_MASK) != - RADEON_SRC_BLEND_GL_ZERO) - { - RADEON_FALLBACK(("Component alpha not supported with source " - "alpha and source value blending.\n")); + pSrcPixmap = RADEONGetDrawablePixmap(pSrcPicture->pDrawable); + + if (pSrcPixmap->drawable.width >= 2048 || + pSrcPixmap->drawable.height >= 2048) { + RADEON_FALLBACK(("Source w/h too large (%d,%d).\n", + pSrcPixmap->drawable.width, + pSrcPixmap->drawable.height)); + } + + pDstPixmap = RADEONGetDrawablePixmap(pDstPicture->pDrawable); + + if (pDstPixmap->drawable.width >= 2048 || + pDstPixmap->drawable.height >= 2048) { + RADEON_FALLBACK(("Dest w/h too large (%d,%d).\n", + pDstPixmap->drawable.width, + pDstPixmap->drawable.height)); + } + + if (pMaskPicture) { + PixmapPtr pMaskPixmap = RADEONGetDrawablePixmap(pMaskPicture->pDrawable); + + if (pMaskPixmap->drawable.width >= 2048 || + pMaskPixmap->drawable.height >= 2048) { + RADEON_FALLBACK(("Mask w/h too large (%d,%d).\n", + pMaskPixmap->drawable.width, + pMaskPixmap->drawable.height)); + } + + if (pMaskPicture->componentAlpha) { + /* Check if it's component alpha that relies on a source alpha and + * on the source value. We can only get one of those into the + * single source value that we get to blend with. + */ + if (RadeonBlendOp[op].src_alpha && + (RadeonBlendOp[op].blend_cntl & RADEON_SRC_BLEND_MASK) != + RADEON_SRC_BLEND_GL_ZERO) { + RADEON_FALLBACK(("Component alpha not supported with source " + "alpha and source value blending.\n")); + } } + + if (!R200CheckCompositeTexture(pMaskPicture, 1)) + return FALSE; } if (!R200CheckCompositeTexture(pSrcPicture, 0)) return FALSE; - if (pMaskPicture != NULL && !R200CheckCompositeTexture(pMaskPicture, 1)) - return FALSE; if (!RADEONGetDestFormat(pDstPicture, &tmp1)) return FALSE; @@ -903,25 +967,53 @@ static Bool R300CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskP RADEON_FALLBACK(("src not screen\n")); #endif + pSrcPixmap = RADEONGetDrawablePixmap(pSrcPicture->pDrawable); - if (pMaskPicture != NULL && pMaskPicture->componentAlpha) { - /* Check if it's component alpha that relies on a source alpha and on - * the source value. We can only get one of those into the single - * source value that we get to blend with. - */ - if (RadeonBlendOp[op].src_alpha && - (RadeonBlendOp[op].blend_cntl & RADEON_SRC_BLEND_MASK) != - RADEON_SRC_BLEND_GL_ZERO) - { - RADEON_FALLBACK(("Component alpha not supported with source " - "alpha and source value blending.\n")); + if (pSrcPixmap->drawable.width >= 2048 || + pSrcPixmap->drawable.height >= 2048) { + RADEON_FALLBACK(("Source w/h too large (%d,%d).\n", + pSrcPixmap->drawable.width, + pSrcPixmap->drawable.height)); + } + + pDstPixmap = RADEONGetDrawablePixmap(pDstPicture->pDrawable); + + if (pDstPixmap->drawable.width >= 2560 || + pDstPixmap->drawable.height >= 2560) { + RADEON_FALLBACK(("Dest w/h too large (%d,%d).\n", + pDstPixmap->drawable.width, + pDstPixmap->drawable.height)); + } + + if (pMaskPicture) { + PixmapPtr pMaskPixmap = RADEONGetDrawablePixmap(pMaskPicture->pDrawable); + + if (pMaskPixmap->drawable.width >= 2048 || + pMaskPixmap->drawable.height >= 2048) { + RADEON_FALLBACK(("Mask w/h too large (%d,%d).\n", + pMaskPixmap->drawable.width, + pMaskPixmap->drawable.height)); + } + + if (pMaskPicture->componentAlpha) { + /* Check if it's component alpha that relies on a source alpha and + * on the source value. We can only get one of those into the + * single source value that we get to blend with. + */ + if (RadeonBlendOp[op].src_alpha && + (RadeonBlendOp[op].blend_cntl & RADEON_SRC_BLEND_MASK) != + RADEON_SRC_BLEND_GL_ZERO) { + RADEON_FALLBACK(("Component alpha not supported with source " + "alpha and source value blending.\n")); + } } + + if (!R300CheckCompositeTexture(pMaskPicture, 1)) + return FALSE; } if (!R300CheckCompositeTexture(pSrcPicture, 0)) return FALSE; - if (pMaskPicture != NULL && !R300CheckCompositeTexture(pMaskPicture, 1)) - return FALSE; if (!R300GetDestFormat(pDstPicture, &tmp1)) return FALSE;