Why is XRenderAddTraps preferred over XRenderCompositeTrapezoids?
cworth at cworth.org
Fri Jun 20 10:50:42 PDT 2008
On Fri, 20 Jun 2008 10:25:22 +0200, "Clemens Eisserer" wrote:
> 1.) It seems cairo plans since some time to switch from
> XRenderCompositeTrapezoids to XRenderAddTraps to render their traps.
> What are the advantages of XRenderAddTraps compared to
The issue here is that if you want to render a *lot* of trapezoids
with XRenderCompositeTrapezoids library call, that this will then
necessarily be broken down into multiple protocol requests. Then,
since each request composites individually, you will get visible seams
between each set of trapezoids.
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.
So those two reasons seem only good.
The reason cairo has never gotten around to switching is that there's
*another* independent change. The XRenderAddTraps call uses a
different specification of the trapezoid, (an XTrap rather than the
XTrapezoid of XRenderCompositeTrapezods). Adapting the cairo code to
generate these different trapezoids hasn't seemed easy or worthwhile
enough for us to make any change yet.
Meanwhile, it seems that in a recent conversation I had with Keith, he
expressed some misgivings about the XTrap trapezoids
specification---that perhaps it was a bad idea in the first place. I
don't recall the specifics of that though, and it could have been just
an offhand comment with no significance. He would have to elaborate if
there's any important issue there.
> 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!
> 3.) Is one call to XRenderFillRectangles with 100 rects much faster
> than 100 calls to XRenderFillRectangle?
> Is it just protocol related, or is there also a difference how those
> rects are processed by the driver/gpu?
My recollection (which could be faulty) is that the driver won't see
any difference here. So any difference that you might be able to
measure would only be protocol related.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
More information about the xorg