[PATCH weston] gl-renderer: compress pixman bands to simplify geometry

Pekka Paalanen ppaalanen at gmail.com
Fri Nov 21 02:52:33 PST 2014


On Wed, 19 Nov 2014 08:58:14 -0600
Derek Foreman <derekf at osg.samsung.com> wrote:

> On 19/11/14 08:33 AM, Pekka Paalanen wrote:
> > On Thu, 16 Oct 2014 16:37:02 -0500
> > Derek Foreman <derekf at osg.samsung.com> wrote:
> > 
> >> Pixman uses y-x banded rectangles to represent regions.  We use these
> >> y-x banded rectangles to generate triangle fans, resulting in more
> >> geometry than strictly necessary to draw the screen.
> >>
> >> This patch combines the bands to reduce geometry for complex scenes.
> >> ---
> >>  src/gl-renderer.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
> >>  1 file changed, 64 insertions(+), 3 deletions(-)

> > 
> > Hi Derek,
> > 
> > could you explain a bit where I can see the effect of this and how
> > big an improvement it is?
> 
> If you turn on triangle fan debug (something like shift+mod+space
> followed by f) then open a few windows you can see the difference.
> 
> The easiest way is to just open two terminals, put them side by side,
> run "yes" or something that constantly refreshes one, then drag the
> other one up and down beside it (but far enough away that the shadows
> don't overlap)
> 
> Before my patch you'll see extra triangles inserted where the horizontal
> boundaries of one window project across the other window.
> 
> If you've got a copy of pixman's src lying around, the comments near the
> top of pixman-region.c explain how regions are split.
> 
> The patch can result in a fairly dramatic reduction in polygon count in
> certain cases, but the smaller set of polygons will have the same coverage.
> 
> Honestly, I'm not sure how to benchmark this.

Oh yeah, I see it now if I use the DRM backend. On X11 backend I think
it always paints everything which means the mesh is a lot more messy.

One way to measure would be to print the vertex count of a repaint
cycle. I'd expect the difference in performance to be negligible. I
believe the only difference would be in CPU time, the overhead of
submitting draws to the GPU is probably a lot more than what a few less
vertices does, and the fragment count would be roughly the same anyway.

Maybe it could be profiled with 'perf', since the effect should be on
CPU time?

There is an Acked-by from Jasper, and Tested-by me, but I'm still not
sure this is worth the code it adds... to be honest, it feels like
premature optimization to me.

OTOH, it reduces the box-count, which reduces both calculate_edges and
glDrawArrays calls, so...

Pushed!


Thanks,
pq


More information about the wayland-devel mailing list