cairo-glesv2 and pango: CAIRO_STATUS_DEVICE_ERROR
Hello,
I guess I need your help troubleshooting what possibly could be a bug in cairo.
I'm developing an embedded UI that uses cairo for drawing its contents and
pango for layouting text. For hardware acceleration I'm planning to use the cairo-gl surface backend
(compiled with --enable-glesv2
to be exact), since that is supported well on the target hardware (RaPi 3b+) and showed promising results overall on first tests (big kudos for that!) The UI will run inside a weston compositor, as native wayland client, using EGL to get a OpenGL ES 2.0 context.
Sadly, I get pretty weird behavior related to font rendering. There are three possible states:
- The UI totally works. This was mostly the case only when development started.
- The UI refuses to start, every call to cairo_show_text() or pango_cairo_show_layout() returns
CAIRO_STATUS_DEVICE_ERROR
immediately. Further drawing is not possible. - The UI starts, but everything drawn before the text calls is blacked out,only the elements drawn after are visible.
I tried to put a minimal example of this here:
https://gist.github.com/sahib/320c2fdfce983ffaf2a931940bd68318
To run this, you need to have two things:
- An instance of weston running (usually this just means to install & start
weston
from a X.org session) -
libcairo
compiled with --enable-glesv2
The behavior is the same on my development machine and on the target hardware. On my home machine though it appears to work reliably (different GPU?). Note that this example doesn't seem to fail on all machines I tried. However the actual full UI fails a lot more "reliably", I can't show you the code though. Would be a cairo trace helpful?
Now, here's the catch:
If I compile cairo with --enable-glesv3
, everything works perfectly fine on my machine (except that glesv3 won't work well on the Pi, sadly) I'm happy to provide more data if required, but I'm a bit stuck here on what to try next. Would be very glad if you could push me in the right direction.
For reference:
- both
cairo 1.16
and latestcairo
master from git show the same issue - I'm using
weston 6.0.0
- I'm using
pango 1.43.0
andfreetype 2.10.0
- Are there any other libraries involved?