Why is XRenderAddTraps preferred over XRenderCompositeTrapezoids?

Clemens Eisserer linuxhippy at gmail.com
Mon Jun 23 02:27:57 PDT 2008

Hi Carl,

> Also, with XRenderCompositeTrapezoids the server is allocating an
> intermediate surface onto which the mask is composited.
> Meanwhile, XRenderAddTraps attempts to address both of these
> issues. First, the client allocates its own mask surface and passes
> that. Then, each call is simply adding trapezoids to the mask. Any
> compositing is done afterward with an explicit XRenderComposite call,
> so any batching of the trapezoids won't introduce any seams.

Thanks a lot for the detailed explanation.
I am a bit concerned about performance. Isn't it expensive to allocate
a mask-pixmap  and clear it every time a composition request takes
Do you know if the X server does any optimizations regarding this?

For trap-mask-generation I guess it should be possible to e.g.
pre-allocate a 512x512 "trap-buffer", and use this.
If its too small the composition-request could be tiled, at least for
the no-AA case.

>> Or will uploading the generated mask be slower than the
>> per-primitive-overhead I experience?
> I won't guess about the performance implications, (particularly since
> they depend on so many variables like your video card and driver,
> etc.). Try it out and see!
At least on my machine it seems rendering using an intermediate mask
filled with scanline-"traps" is about 4 times faster than
line-per-line compositing, when using an A8 mask.
However results differ a lot between Xorg-1.3 and Xorg-1.5 and EXA/XAA
and whats fast there, is slow on the other one ;)
I guess I'll focus on EXA for now.

Thanks a lot, Clemens

More information about the xorg mailing list