[cairo] Adding a cairo_content_t value to solid patterns

Jeff Muizelaar jeff at infidigm.net
Wed Apr 25 09:35:33 PDT 2007


On Wed, Apr 25, 2007 at 07:37:34AM -0700, Carl Worth wrote:
> Also, I'm curious to notice that we get the speedup only when
> rendering OVER an RGB image surface and there's no change at all when
> rendering OVER and ARGB surface. But with SOURCE the slowdown affects
> both RGB and ARGB destinations. Again, that might be due to the
> existence of particular optimized paths.

Reader beware: None of the following has been tested, so there could be
mistakes in my analysis.

For RGB OVER (ARGB|RGB) the code in question is:

                        case PICT_x8r8g8b8:
                        case PICT_x8b8g8r8:
                            if (pDst->format_code == pSrc->format_code &&
                                pMask->format_code == PICT_a8 && fbHaveMMX())
                                func = fbCompositeSrc_x888x8x8888mmx;
                            break;

However, the check is too strict causing us not to use
fbCompositeSrc_x888x8x8888mmx when the destination format is PICT_a8r8g8b8 or
PICT_a8b8g8r8. However, fbCompositeSrc_x888x8x8888mmx never uses the
destination alpha byte so these formats are supported by it. Therefore, it
should instead be something more like:

                         case PICT_x8r8g8b8:
                            if ((pDst->format == PICT_a8r8g8b8 ||
                                 pDst->format == PICT_x8r8g8b8) &&
                                pMask->format == PICT_a8 && fbHaveMMX())
                                func = fbCompositeSrc_x888x8x8888mmx;
                            break;
                        case PICT_x8b8g8r8:
                            if ((pDst->format_code == PICT_a8b8g8r8 ||
                                 pDst->format_code == PICT_x8b8g8r8) &&
                                pMask->format_code == PICT_a8 && fbHaveMMX())
                                func = fbCompositeSrc_x888x8x8888mmx;
                            break;

For ARGB OVER (ARGB|RGB) the relevant code is:

#if 0 /* This case fails rendercheck for me */
                        case PICT_a8r8g8b8:
                            if ((pDst->format == PICT_a8r8g8b8 ||
                                 pDst->format == PICT_x8r8g8b8) &&
                                pMask->format == PICT_a8 && fbHaveMMX())
                                func = fbCompositeSrc_8888x8x8888mmx;
                            break;
#endif

It is good that this code is commented out because
fbCompositeSrc_8888x8x8888mmx is indeed broken. On line 1227 of fbmmx.c we
have:
            *dst = store8888 (over (s, expand_alpha (s), d));
However, this should be:
            *dst = store8888 (in_over (s, expand_alpha (s), vmask, d));
Just like line 1255.

Fixing the problems mentioned above should give the speedup seen for RGB OVER
RGB to (ARGB|RGB) OVER (ARGB|RGB)

-Jeff


More information about the cairo mailing list