[RFC weston] compositor: optimize/simplify shaders

Pekka Paalanen ppaalanen at gmail.com
Thu Aug 30 06:34:41 PDT 2012


On Thu, 30 Aug 2012 14:11:41 +0300
Pekka Paalanen <ppaalanen at gmail.com> wrote:

> On Wed, 29 Aug 2012 19:18:17 -0500
> Rob Clark <rob.clark at linaro.org> wrote:
> 
> > On Tue, Aug 28, 2012 at 8:27 AM, Pekka Paalanen <ppaalanen at gmail.com> wrote:
> > > On Mon, 27 Aug 2012 17:03:10 +0300
> > > Pekka Paalanen <ppaalanen at gmail.com> wrote:
> > >
> > >> Hi Rob,
> > >>
> > >> I've started reviewing your patch and fixing the remaining bugs. So far
> > >> I think I got most of the blend/opaque region stuff sorted out. I
> > >> haven't still gotten to the geometry, where I can trigger visual bugs
> > >> with and without getting your TODO printouts.
> > >>
> > >> I'm guessing the xwayland surfaces will come and haunt us, because I
> > >> think they contain both an opaque region with undefined alpha values,
> > >> and opaque and non-opaque regions with valid alpha values.I haven't
> > >> even tested them yet, but I guess a quick fix would be to paint opaque
> > >> regions always with a shader that forces texture alpha to 1.0. Would it
> > >> better as a different shader program or a uniform flag for a shader, I
> > >> don't know.
> > >>
> > >> I'm not sure we should have nested functions in Weston code base. Also
> > >> like you noted, compositor_wayland.c does not build anymore.
> > >>
> > >> Here's my WIP tree that may be rebased!
> > >
> > > The tree is still here and updated:
> > > http://cgit.collabora.com/git/user/pq/wayland-demos.git/log/?h=shaders
> > > I don't think I will be rebasing it anymore.
> > >
> > > I merged Rob's updates there.
> > >
> > > Rob, I will leave cleaning up the series for you, once we are done. You
> > > probably want to squash some things etc.
> > 
> > Fyi, I've squashed/reordered a bit.  And pushed some nice updates to
> > your debug draw stuff, so now it is quite fun to look at:
> > 
> >   git://github.com/robclark/weston.git master
> 
> Hi Rob,
> 
> that's definitely interesting. I'm working based on your 'pq' branch,
> though, because you missed these commits:
> 
> 1e17e4a compositor: fix blending for full-surface alpha
> 87af9c8 compositor: specialised fragment shader for RGBX
> 0c37514 compositor: re-enable full-surface alpha
> 82ffb58 compositor: fix build against WL_bind_wayland_display extension
> 
> and it seems the 'pq' branch is up to date still.
> 
> I got these with your 'pq' branch:
> 
> http://people.collabora.com/~pq/geometry-debug-6.png
> It appears the clean-up painting paints something wrong, but I haven't
> been able to reproduce that otherwise. The flower is rotated about 45
> degrees. Notice the three green pixels down from the word "Thu" in the
> panel clock. Those pixels flicker when I move the mouse cursor, even
> though there should not be damage anywhere near. The green pixels are
> where the surface's top-left corner is.
> 
> http://people.collabora.com/~pq/geometry-debug-7.png
> This shows a problem with screen-aligned surfaces. The center vertex is
> not in the center, implying that there are duplicate vertices. Good
> thing I didn't remove the center vertex yet.
> 
> If I disable the fan debug line clean-up, it is hard to spot or trigger
> any problems, apart from the center point thing.

It's so complex piece, that I decided to write a manual unit test.

You can find a new app called cliptest in
http://cgit.collabora.com/git/user/pq/wayland-demos.git/log/?h=shaders

It looks like this:
http://people.collabora.com/~pq/geometry-debug-8.png

Blue is the clip rectangle, red is the surface, and the green line is
what vertices calculate_edges() produces.

I plan to add the following controls:
- arrow keys to move clip box
- some other keys to rotate the surface box
- print vertex indices next to them, so we spot duplicates

Hmm, and we need box size controls, too.

Anyway, that should make it easier to create reproducible test cases.
The damage regions in weston tend to change all the time, and we cannot
really affect the rects in a region in a sane way.

Maybe with cairo we could actually produce automatic tests.


Thanks,
pq


More information about the wayland-devel mailing list