Shader Optimizations Greatly Speed-Up Wayland

Written by Michael Larabel in Wayland on 23 August 2012 at 08:56 AM EDT. 2 Comments
WAYLAND
Rob Clark, the Texas Instruments developer known for his work on the OMAP DRM driver, DMA-BUF, and hacking a Qualcomm open-source driver in his spare time, has been dabbling with Wayland. Rob's done some optimizations and simplifications to shaders used by Wayland's Weston reference compositor that greatly improve the performance.

With a patch posted under an "RFC" (Request For Comments) flag on the Wayland development list for Weston, he's optimized and simplified some shaders used by the Wayland compositor. When trying to run Wayland on a small SoC GPU like the TI OMAP4 PandaBoard at 1080p, Rob Clark can now obtain 60 FPS while pushing around windows. When pushing YUV buffers for hardware-accelerated decode of 1080p videos he gets 30 FPS. These numbers are compared to below 30 FPS and about 6 FPS, respectively, before writing these optimized shaders. This work should benefit all Weston users, but especially those on mobile/embedded hardware with less-powerful graphics processors.
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..
Rob Clark will be speaking next week in San Diego, which will be covered on Phoronix.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week