Saturday, January 5, 2013

Wayland and software rendering

Recently I spent few evenings for hacking wayland. I like idea of wayland - rendering is done completely on client (in whatever way), compositor (server part) is responsible in rendering buffers from clients on the screen. Issue for me was rendering part of weston (reference compositor for wayland) - it uses GLES for compositing, but I want to try wayland and weston on devices without hw acceleration (pure software rendering), and running software GL on PXA270@312MHz does not sound like a good idea, does it? :)

So I asked on #wayland@irc.freenode.org if it possible to implement software renderer, Kristian Høgsberg (khr) responded that in master branch of weston repo there's a nice abstraction of renderer, so it's possible to implement pixman renderer. So I did :)

weston with x11-backend and pixman renderer

khr and pq from #wayland were very helpful, and described place of renderer in wayland architecture, here're some points

  • renderer just performs rendering of surface in order passed by compositor (compositor::surfaces_list)
  • each surface has opaque (surface::opaque region) and non-opaque regions, for performance optimization it makes sense to render them differently (with different composite operators, PIXMAN_OP_SRC and PIXMAN_OP_OVER respectively)
  • surface::opaque region is in surface coordinates, and damage region is in global coordinates, so one needs to translate surface::opaque region into global coordinates before compositing
I've also added MIT-SHM support to x11-backend to test pixman renderer, it's activated by passing "--use-shm" argument to weston.

I plan to add 16bpp formats support to wayland (currently it supports only 32bpp) and implement fbdev backend. As one maybe guessed, then I want to try wayland on my PDAs: Zipit Z2 and iPAQs :)

As usual, code is on github, I'll submit it upstream tomorrow.

3 comments:

Maksim Melnikau said...

llvmpipe already do same task, isn't it?

Vasily Khoruzhick said...

Maksim: it's not, pixman renderer does not emulate GL, it just does compositing (surface clipping and blending) in software (via pixman). llvmpipe is just another GL implementation

Vasily Khoruzhick said...

Maksim, see: pixman-renderer.c