[Qt-interest] Comments on: 220548 - X11: Use PictStandardA8 instead of PictStandardA1 in X11 paint engine

Trond Kjernaasen trond at trolltech.com
Mon Feb 2 17:51:32 CET 2009


Clemens Eisserer wrote:
> Hello,
> 
> Ever since switching to QT4 I saw suboptimal performance on Linux 
> compared to QT3.
> I did some profiling and found some problems in the way how QT4 uses the 
> XRender API:
> 
> 1.) QT's paint engine renders trapezoids into a A1 mask picture in the 
> aliased case.
> However using A1 surfaces as mask isn't support by modern GPUs, thats 
> the case why Cairo as well as my XRender Java2D backend use A8 masks 
> everywhere.
> 
> This is causing heavy migration ping-pong, where pixmap contents are 
> moved back and forth between system memory and VRAM.
> 
> The same is true for the font-engine, it uses A1 masks to store aliased 
> glyphs.
> However Xorg-1.6 contains some work-arrounds to use A8 always, and 
> convert the uploaded glpyhs to A8.
> 
> The problem can be easily seen with QGears2, with antialiasing it 
> reaches about 80fps on my intel i945GM, with antialiasing off only ~20fps.

We can change the A1 mask picture, but I don't see any huge differences 
on my local box. I'm not sure what part of that demo you are looking at 
(GEARSFANCY, GEARS, COMPO or TEXT), but for me the aliased version is 
about 2 times faster than the antialiased one when running GEARSFANCY.
Also note that the code path that uses the A1 mask is only used when you 
draw a polygon or path with a texture brush that has an alpha channel.

> 2.) When using a fill-texture:
> An explicit mask image is created, the trapezoids are *blended* using an 
> implicit/temporary mask image, composition happends and then the mask 
> image is freed.
> I guess there is some reason why the code does look like this, but its 
> extremly inefficient, especially with all the quirks EXA has.
> 
> Why not simply call XRenderCompositeTrapezoids with the texture as source?

Needless to say, this is suboptimal - however there is a reason for it.
The texture offsets are reset for every trapezoid that is rendered (at 
least it is in every RENDER implementation I've tested). We need to 
adjust the offset for each individual trapezoid to get the correct output.

> 3.) qt_XRenderCompositeTrapezoids:
> This seems to be a work-arround, however it breaks antialiasing :-/

Why does it break antialiasing?

> 4.) In the fill-texture case where depth==1:
> Each trapezoids is composited one after another.
> For each trapezoids the following happens:
>  1. Allocate temporary mask pixmap
>  2. Render the trapezoid in software
>  3. Copy software-generated image to VRAM
>  4. Composite using the GPU

Same thing as with 2). The texture offset needs to be set for each 
individual trapezoid.

> Don't know if anybody every benchmarked this on EXA, but this will lead 
> to horrible performance.
> 
> I would be really happy about feedback, would be great if at least the 
> common cases could be fixed in QT-4.5.
> 
> Thanks, Clemens

Regards,
--
Trond K.



More information about the Qt-interest-old mailing list