compositor: simplify shaders
authorRob Clark <rob@ti.com>
Thu, 30 Aug 2012 21:47:18 +0000 (16:47 -0500)
committerKristian Høgsberg <krh@bitplanet.net>
Fri, 31 Aug 2012 21:51:50 +0000 (17:51 -0400)
commit0e5a2d02191587146ad3d19d5eedda3f3d0eace9
treea6872ccea7cde4c4a2b8fd0b2c03c33d616fc037
parente3b9591513eabedeb7ce62b2912135c5bf31a871
compositor: simplify shaders

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.

v1: original
v2: check that perpendicular intersect vertex falls within bounds of
    transformed surface
v3: update w/ comments and fixes from Pekka Paalanen
v4: fix for full surface alpha from Pekka Paalanen, fix compositor-
    wayland build

Signed-off-by: Rob Clark <rob@ti.com>
src/compositor-wayland.c
src/compositor.c
src/compositor.h