[cairo] [PATCH] Updates for the scaling test and more fixes
siarhei.siamashka at nokia.com
Wed May 6 04:05:44 PDT 2009
On Monday 27 April 2009 22:30:07 ext Soeren Sandmann wrote:
> Siarhei Siamashka <siarhei.siamashka at nokia.com> writes:
> > > It is true that pixels with alpha=0 and color channels != 0 can't be
> > > skipped, but the
> > >
> > > if (a)
> > >
> > > optimization is actually fairly important because memory access is so
> > > expensive. So a better fix is to check that the whole source is 0
> > > rather than just the alpha.
> > I would not be too sure about this. In the case where (almost) the whole
> > source image is transparent it would definitely help. But in the case
> > when we have interleaving transparent/opaque pixels, this extra pixel
> > write skipping logic may negatively affect performance:
> > 1. It's an extra branch in the code and in some cases it might not play
> > nice with the branch predictor.
> > 2. It might confuse write combining buffer and negatively impact
> > performance. Also if we even have only one pixel that needs to be
> > read/modified per cache line, skipping some of the writes will not help
> > to reduce memory bandwidth much.
> I benchmarked it several years ago, and was surprised to find that
> skipping pixels with alpha=0 and alpha=ff really was a solid
> improvement on the types of images that actually happened in
> practice. It was a big improvement even on glyph masks where there is
> a lot of variation in opacity.
> This was with the images in normal, cached memory. For images in
> uncached memory, the check was such a huge improvement that it wasn't
> even funny.
> You are welcome to do the experiment again of course. Things could
> have changed in the meantime, but until then, we should keep the
> > Also when alpha blending is fused with scaling and processed in a
> > single pass, CPU usage reduction may be more important than memory
> > write optimizations.
> Note that this is not just a memory *write*. It's also about memory
OK, here is a revised patch (check if the whole source is zero).
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1215 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20090506/c3332684/attachment-0001.patch
More information about the cairo