[cairo] [pixman] speedup nearest scaling

Soeren Sandmann sandmann at daimi.au.dk
Fri Nov 21 17:07:55 PST 2008


Jeff Muizelaar <jeff at infidigm.net> writes:

> The attached patch speeds up the NEAREST scaling with
> the source operator on matching surfaces by about 2x on my
> x86 box.
> 
> There is more speedup possible, but I'm more interested in getting
> something simple in at this point.

This looks basically good. I only have one minor comment.

> +    if (pSrc->type == BITS
> +            && srcTransform
> +            && !pMask
> +            && op == PIXMAN_OP_SRC
> +            && !maskAlphaMap && !srcAlphaMap && !dstAlphaMap
> +            && (pSrc->common.filter == PIXMAN_FILTER_NEAREST)
> +            && PIXMAN_FORMAT_BPP(pDst->bits.format) == 32
> +            && pSrc->bits.format == pDst->bits.format
> +            && pSrc->common.src_clip == &(pSrc->common.full_region)
> +            && !pSrc->common.read_func && !pSrc->common.write_func
> +            && !pDst->common.read_func && !pDst->common.write_func)
> +    {
> +        if (pSrc->common.transform->matrix[0][1] == 0 &&
> +            pSrc->common.transform->matrix[1][0] == 0 &&
> +            pSrc->common.transform->matrix[2][0] == 0 &&
> +            pSrc->common.transform->matrix[2][1] == 0 &&
> +            pSrc->common.transform->matrix[2][2] == pixman_fixed_1) {
> +            func = fbCompositeSrcScaleNearest;
> +        }
> +    }

Maybe put an 'else' here?

> +
> +
>      if ((pSrc->type == BITS || pixman_image_can_get_solid (pSrc)) && (!pMask || pMask->type == BITS)
>          && !srcTransform && !maskTransform
>          && !maskAlphaMap && !srcAlphaMap && !dstAlphaMap

The other patch you had changing the types of the intermediate buffer
looked good as well.


Thanks,
Soren


More information about the cairo mailing list