[PATCH 4/4] EXA/evergreen/ni: accelerate PictOpOver with component alpha

Grigori Goronzy greg at chown.ath.cx
Tue Jul 30 15:55:32 PDT 2013


On 30.07.2013 17:26, Michel Dänzer wrote:
>
> Like Roland, I wonder if this trick couldn't be done in EXA instead of
> in the driver?
>

I don't see how, EXA/XRENDER do not know about constant blend colors or 
anything like it. The implementation in the backend is very simple 
anyway, it should be trivial to implement this in drivers that can 
support it.

>
>> diff --git a/src/evergreen_exa.c b/src/evergreen_exa.c
>> index 5b8a631..ee5b06b 100644
>> --- a/src/evergreen_exa.c
>> +++ b/src/evergreen_exa.c
>> @@ -704,6 +704,14 @@ static uint32_t EVERGREENGetBlendCntl(int op, PicturePtr pMask, uint32_t dst_for
>>   	} else if (dblend == (BLEND_ONE_MINUS_SRC_ALPHA << COLOR_DESTBLEND_shift)) {
>>   	    dblend = (BLEND_ONE_MINUS_SRC_COLOR << COLOR_DESTBLEND_shift);
>>   	}
>> +
>> +	/* With some tricks, we can still accelerate PictOpOver with solid src.
>> +	 * This is commonly used for text rendering, so it's worth the extra
>> +	 * effort.
>> +	 */
>> +	if (sblend == (BLEND_ONE << COLOR_SRCBLEND_shift)) {
>> +	    sblend = (BLEND_CONSTANT_COLOR << COLOR_SRCBLEND_shift);
>> +	}
>
> Is this correct for all cases where (sblend == (BLEND_ONE <<
> COLOR_SRCBLEND_shift))?
>

Yes. PictOpOver is the only case where we have this kind of src blend 
with src alpha.

>
>>   		if (EVERGREENBlendOp[op].src_alpha &&
>>   		    (EVERGREENBlendOp[op].blend_cntl & COLOR_SRCBLEND_mask) !=
>>   		    (BLEND_ZERO << COLOR_SRCBLEND_shift)) {
>> -		    RADEON_FALLBACK(("Component alpha not supported with source "
>> -				     "alpha and source value blending.\n"));
>> +		    if (pSrcPicture->pDrawable || op != 3)
>> +			RADEON_FALLBACK(("Component alpha not supported with source "
>> +					 "alpha and source value blending.\n"));
>>   		}
>>   	    }
>
> Please use PictOpOver instead of the magic number 3.
>

Right, I'll send a revised version of the patch.

Best regards
Grigori


More information about the xorg-driver-ati mailing list