[RFC weston] compositor: optimize/simplify shaders

Pekka Paalanen ppaalanen at gmail.com
Mon Aug 27 07:03:10 PDT 2012


On Wed, 22 Aug 2012 19:09:28 -0500
Rob Clark <rob.clark at linaro.org> wrote:

> From: Rob Clark <rob at ti.com>
> 
> Re-work how the shaders and emitted vertices work.  Rather than always
> rendering clip-rect sized quads and doing transformation in tex coords
> (and requiring the corresponding clipping in frag shader), instead
> emit transformed vertices, clipped wrt. dirty region, and use simpler
> frag shaders.  Also, split the rendering, so blended surfaces with an
> opaque region have the opaque region drawn with blend disabled.  The
> result is considerably fewer pixels drawn with blend enabled, and much
> fewer cycles in the frag shader.
> 
> This requires having some more complex logic to figure out the vertices
> of the shape which forms the intersection of the clip rect and the
> transformed surface.  Which has perhaps got a few bugs or missing cases,
> still (visual glitches in some cases) but at this point more or less is
> starting to work.  I think it is at least far enough along to get some
> initial review.
> 
> The result, on small SoC GPU (omap4/pandaboard) on 1920x1080 display,
> for simple stuff like moving windows around, I get 60fps (before 30fps
> or less), and pushing YUV buffers for hw decoded 1080p video goes from
> ~6fps to 30fps, with no drop in framerate for transformed/rotated video
> surface.
> 
> TODO: compositor-wayland also needs to be updated..
> ---
>  src/compositor.c |  560 +++++++++++++++++++++++++++++++++++++++++++-----------
>  src/compositor.h |    5 +-
>  2 files changed, 456 insertions(+), 109 deletions(-)

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 following changes since commit 5418a904ca007a109f6af8c0c75ca97a134986d9:

  toytoolkit: don't ignore resizes with negative width or height (2012-08-16 10:33:56 -0400)

are available in the git repository at:
  git://git.collabora.co.uk/git/user/pq/wayland-demos.git shaders

Pekka Paalanen (4):
      compositor: fix build against WL_bind_wayland_display extension
      compositor: re-enable full-surface alpha
      compositor: specialised fragment shader for RGBX
      compositor: fix blending for full-surface alpha

Rob Clark (2):
      compositor: add support for OES_EGL_image_external
      compositor: optimize/simplify shaders

 src/compositor.c     |  621 ++++++++++++++++++++++++++++++++++++++++----------
 src/compositor.h     |    9 +-
 src/weston-egl-ext.h |    4 +
 3 files changed, 510 insertions(+), 124 deletions(-)

I should get to reviewing the geometry tomorrow.


Thanks,
pq


More information about the wayland-devel mailing list