[cairo] Optimizing trap rasterization?

Chris Wilson chris at chris-wilson.co.uk
Thu Feb 4 12:20:36 PST 2010


On Thu, 4 Feb 2010 14:43:21 -0500, Clemens Eisserer <linuxhippy at gmail.com> wrote:
> Hi,
> 
> Especially for larger fills, trapezoid rasterization seems to be quite slow.
> The edge rasterization code seems to have a few fast-paths implemented
> (ADD_SATURATE_8) & MEMSET_WRAPPED
> however a in a simple benchmark i wrote those are never triggered
> (ADD_SATURATE a few times, but only with length 1 which is pointless).
> 
> I don't think I can modify rasterize_edge directly, it seems way too
> complex and cryptic to me.
> However cairo generates long horizontal traps, which could be
> optimized quite well by seperating the "edge" part from the "fill"
> part of the trapezoid.
> Instead of ADD'ing byte-by-byte with manual overflow-detection, the
> fill part could be done using MMX filling 64 bytes at once :)
> 
> However I've heard cairo will be moving away from trapezoids anyway,
> so is there any point optimizing this at all?

Hi Clemens, thanks for taking a look at this, and there does indeed seem
like a lot of scope for improvements. Whilst cairo itself has moved
towards scan line rasterisation for its mask generation, we still rely on
the trapezoid code for RENDER -- and so we will need it for quite some
time yet. And of course, if using traps were faster (even in a limited yet
predicable set of cases) then we use traps again. :)
-ickle

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the cairo mailing list