A simple drawing library and some wayland ports

Michael Forney mforney at mforney.org
Fri Jul 26 01:02:34 PDT 2013


Hi,

A while back I was interested in porting dmenu[0] and st[1] to wayland.
However, the available rendering stack (cairo + pango + glib +
opengl/pixman) seemed a bit overkill to me when all I needed was two
simple operations, "fill rectangle with color" and "draw monochrome text
with color".

So I ended up writing a simple drawing library called wld[2] which
implements these two operations. Right now there are two backends, one
that uses pixman, and one for Intel GPUs which uses the BLT engine
(using a library I wrote called libintelbatch[3]). The intel backend is
only tested with my (rather old now) GEN5 laptop, but shouldn't be hard
to get working with newer chips. Also, the pixman renderer should work
fine.

wld uses FreeType for rendering text, and currently only supports
monochrome output, but this may change in the future (should be trivial
with the pixman backend, probably more complicated with the intel one).

wld does not actually require wayland to be installed (so it can be used
for rendering in other contexts). However, with wayland, it can create
buffers using the wl_shm or wl_drm interfaces. It can also optionally
track damage for you and copy it from the front buffer and/or submit it
with wl_surface_damage.

My wayland ports (using wld) of st and dmenu are available here (in the
wayland branch):

    git://github.com/michaelforney/st
    git://github.com/michaelforney/dmenu

dmenu ideally requires some sort of panel wayland protocol extension
(otherwise it spawns randomly about the screen). I mocked up an
example[4], and added support to my dmenu port in the wayland-panel
branch. However, I have not implemented support of panel.xml in weston.

Anyway, I hope you find this interesting. wld was done for my own
personal use, but maybe other projects along the same lines as st and
dmenu may find it useful. If you'd like to try dmenu or st under
wayland, but aren't interested in wld, it should be pretty
straightforward to make my ports use cairo or whatever instead.

Comments and questions are welcome!

[0]: http://tools.suckless.org/dmenu/
[1]: http://st.suckless.org/
[2]: git://github.com/michaelforney/wld
[3]: git://github.com/michaelforney/libintelbatch
[4]: https://github.com/michaelforney/dmenu/blob/wayland-panel/panel.xml

-- 
Michael Forney <mforney at mforney.org>


More information about the wayland-devel mailing list