obijywk
Posts: 9
Joined: Sat May 12, 2012 10:56 pm
Location: New York

hardware-accelerated cairo on raspbian

Mon May 21, 2012 7:35 pm

I've rebuilt the raspbian cairo packages with both GLESv2 and OpenVG support enabled (via EGL), and gotten both cairo backends to work with a test program, with a few caveats:

- the OpenVG/EGL cairo backend seems to be hard coded to only render to offscreen surfaces (pbuffers), I'm not sure why it was written this way. I think fixing this might require a cairo-vg API change. Saving the output to a file demonstrated that the rendering is indeed working though.

- the GLESv2/EGL backend was able to render to the screen. There is a weird text rendering issue where the first glyph rendered is missing (I suspect a cairo bug, I may investigate further). The performance did not seem great (although I did not rigorously measure this), I suspect that much of the work is being done in software.

I would be happy to post instructions how I built this, or the .deb packages themselves, if anyone is interested. Any suggestions on a good way to share the .deb packages? Is there something similar to ubuntu PPA, but for debian?

A few other observations:
- raspbian is awesome - thanks for working on it!
- raspbian needs a packaging solution for the broadcom egl, gles, and openvg libs. I hand-wrote some pkg-config files to get this to build.
- compiling cairo on the Raspberry Pi took several hours... I would probably spend some time looking into setting up a cross-compilation environment if I were to rebuild large packages again.

plugwash
Forum Moderator
Forum Moderator
Posts: 3435
Joined: Wed Dec 28, 2011 11:45 pm

Re: hardware-accelerated cairo on raspbian

Mon May 21, 2012 9:52 pm

The reason I haven't worked on packaging the broadcom libraries yet is because i'm not sure how they should be packaged. Should they replace the corresponding mesa libraries and if so will that break stuff (my understanding is that the broadcom libraries are currently incompatible with X is that correct?).

As for a cross environment it would be good if someone could figure out how to set one up and post instructutions. We probablly won't use it for official builds since from what i've read cross-building deps is kinda hacky but it would be very useful for dev work on larger packages (multi-day package build times really make dealing with problems difficult).

Once we have worked out how to package the Pi specific stuff my plan is to create a dedicated "area" in the repositry for it so that those who want a pure debian experiance can get it while those that want Pi specific stuff can have it.

shirro
Posts: 248
Joined: Tue Jan 24, 2012 4:54 am

Re: hardware-accelerated cairo on raspbian

Mon May 21, 2012 10:47 pm

plugwash wrote: Once we have worked out how to package the Pi specific stuff my plan is to create a dedicated "area" in the repositry for it so that those who want a pure debian experiance can get it while those that want Pi specific stuff can have it.
It would be good to have some sort of scratch area just to record ideas as there is a lot to be considered. And perhaps we can vote on some of these issues such as how to package the libs. For instance we need those pkgconfig files. And we probably all have udev.rules and other stuff lying about that isn't being collected.

Congrats to @obijywk for building Cairo with gles and openvg support. I checked out cairo and tried to do that and couldn't get configure to find some dependencies then read lots of stuff about "work in progress". So kind of wondering what does work and what doesn't. I might have to have another go now. I would quite like to see some gtk apps rendering to cairo on opengles to see what the speed is like. Can you run cairo-perf-trace on one of the smaller scripts in the trace benchmarks directory?

[ah, just saw rebuilt cairo package. I was building from git - perhaps something was broken. time to try again]

obijywk
Posts: 9
Joined: Sat May 12, 2012 10:56 pm
Location: New York

Re: hardware-accelerated cairo on raspbian

Fri May 25, 2012 6:36 pm

So as it turns out, a lot of the OpenVG + EGL backend does not work - I've seen some simple examples partially work, but have not gotten any useful subset of the cairo perf microbenchmarks fully working (and I've had to hack up the cairo OpenVG backend code quite a bit to even get this far). Some benchmarks crash, and some render incorrectly. When it does work though, the performance is SIGNIFICANTLY better than both the OpenGL and image backends!

OpenGL ES + EGL works reliably, but has bad performance - I suspect that most of the work is not being hardware accelerated at all (the timings for the OpenGL and image backends are about the same).

I don't have a cairo-perf-trace of this yet but will try to upload one later. For now, here are the timings from a cairo-perf-micro run of the many-curves tests - the OpenVG results look correct for the 'hair' tests but not for the 'wide' and 'filled' tests (maybe width is unimplemented).

Code: Select all

$ perf/cairo-perf-micro -i 1 curves
[ # ]  backend.content                    test-size min(ticks)  min(ms) median(ms) stddev. iterations overhead
[  0]      egl.rgba    many-curves-hair-stroked.32  534223600.000 [5342236000/10]  534.224  534.224  0.00%   1
[  1]      egl.rgba    many-curves-wide-stroked.32  691561400.000 [6915614000/10]  691.561  691.561  0.00%   1
[  2]      egl.rgba          many-curves-filled.32  492572800.000 [4925728000/10]  492.573  492.573  0.00%   1
[  3]      egl.rgba    many-curves-hair-stroked.64  954153200.000 [9541532000/10]  954.153  954.153  0.00%   1
[  4]      egl.rgba    many-curves-wide-stroked.64  1084897000.000 [10848970000/10] 1084.897 1084.897  0.00%   1
[  5]      egl.rgba          many-curves-filled.64  924724500.000 [9247245000/10]  924.725  924.725  0.00%   1
[  6]      egl.rgba    many-curves-hair-stroked.128 1758966600.000 [17589666000/10] 1758.967 1758.967  0.00%   1
[  7]      egl.rgba    many-curves-wide-stroked.128 1861903100.000 [18619031000/10] 1861.903 1861.903  0.00%   1
[  8]      egl.rgba          many-curves-filled.128 1752058600.000 [17520586000/10] 1752.059 1752.059  0.00%   1
[  9]      egl.rgba    many-curves-hair-stroked.256 3488631800.000 [34886318000/10] 3488.632 3488.632  0.00%   1
[ 10]      egl.rgba    many-curves-wide-stroked.256 3440735400.000 [34407354000/10] 3440.735 3440.735  0.00%   1
[ 11]      egl.rgba          many-curves-filled.256 3450092000.000 [34500920000/10] 3450.092 3450.092  0.00%   1
[ 12]      egl.rgba    many-curves-hair-stroked.512 7418203500.000 [74182035000/10] 7418.204 7418.204  0.00%   1
[ 13]      egl.rgba    many-curves-wide-stroked.512 6651275100.000 [66512751000/10] 6651.275 6651.275  0.00%   1
[ 14]      egl.rgba          many-curves-filled.512 6887823300.000 [68878233000/10] 6887.823 6887.823  0.00%   1
[  0]   vg-egl.rgba    many-curves-hair-stroked.32  7124386.441 [2101694000/295]    7.124    7.124  0.00%   1
[  1]   vg-egl.rgba    many-curves-wide-stroked.32  7125415.541 [2109123000/296]    7.125    7.125  0.00%   1
[  2]   vg-egl.rgba          many-curves-filled.32  18242141.667 [2189057000/120]   18.242   18.242  0.00%   1
[  3]   vg-egl.rgba    many-curves-hair-stroked.64  7122416.949 [2101113000/295]    7.122    7.122  0.00%   1
[  4]   vg-egl.rgba    many-curves-wide-stroked.64  7107993.266 [2111074000/297]    7.108    7.108  0.00%   1
[  5]   vg-egl.rgba          many-curves-filled.64  18063900.826 [2185732000/121]   18.064   18.064  0.00%   1
[  6]   vg-egl.rgba    many-curves-hair-stroked.128 7135578.231 [2097860000/294]    7.136    7.136  0.00%   1
[  7]   vg-egl.rgba    many-curves-wide-stroked.128 7118166.102 [2099859000/295]    7.118    7.118  0.00%   1
[  8]   vg-egl.rgba          many-curves-filled.128 17974082.645 [2174864000/121]   17.974   17.974  0.00%   1
[  9]   vg-egl.rgba    many-curves-hair-stroked.256 7123240.678 [2101356000/295]    7.123    7.123  0.00%   1
[ 10]   vg-egl.rgba    many-curves-wide-stroked.256 7107597.973 [2103849000/296]    7.108    7.108  0.00%   1
[ 11]   vg-egl.rgba          many-curves-filled.256 17946793.388 [2171562000/121]   17.947   17.947  0.00%   1
[ 12]   vg-egl.rgba    many-curves-hair-stroked.512 7145496.599 [2100776000/294]    7.145    7.145  0.00%   1
[ 13]   vg-egl.rgba    many-curves-wide-stroked.512 7137527.027 [2112708000/296]    7.138    7.138  0.00%   1
[ 14]   vg-egl.rgba          many-curves-filled.512 18011325.000 [2161359000/120]   18.011   18.011  0.00%   1
[  0]    image.rgba    many-curves-hair-stroked.32  538176200.000 [5381762000/10]  538.176  538.176  0.00%   1
[  1]    image.rgba    many-curves-wide-stroked.32  691344400.000 [6913444000/10]  691.344  691.344  0.00%   1
[  2]    image.rgba          many-curves-filled.32  516155800.000 [5161558000/10]  516.156  516.156  0.00%   1
[  3]    image.rgba    many-curves-hair-stroked.64  955766400.000 [9557664000/10]  955.766  955.766  0.00%   1
[  4]    image.rgba    many-curves-wide-stroked.64  1089804900.000 [10898049000/10] 1089.805 1089.805  0.00%   1
[  5]    image.rgba          many-curves-filled.64  917924900.000 [9179249000/10]  917.925  917.925  0.00%   1
[  6]    image.rgba    many-curves-hair-stroked.128 1745801300.000 [17458013000/10] 1745.801 1745.801  0.00%   1
[  7]    image.rgba    many-curves-wide-stroked.128 1864549600.000 [18645496000/10] 1864.550 1864.550  0.00%   1
[  8]    image.rgba          many-curves-filled.128 1725251900.000 [17252519000/10] 1725.252 1725.252  0.00%   1
[  9]    image.rgba    many-curves-hair-stroked.256 3392766000.000 [33927660000/10] 3392.766 3392.766  0.00%   1
[ 10]    image.rgba    many-curves-wide-stroked.256 3438351900.000 [34383519000/10] 3438.352 3438.352  0.00%   1
[ 11]    image.rgba          many-curves-filled.256 3365933400.000 [33659334000/10] 3365.933 3365.933  0.00%   1
[ 12]    image.rgba    many-curves-hair-stroked.512 6647461600.000 [66474616000/10] 6647.462 6647.462  0.00%   1
[ 13]    image.rgba    many-curves-wide-stroked.512 6497929900.000 [64979299000/10] 6497.930 6497.930  0.00%   1
[ 14]    image.rgba          many-curves-filled.512 6544117200.000 [65441172000/10] 6544.117 6544.117  0.00%   1

dmattp
Posts: 2
Joined: Sun Jul 01, 2012 1:25 am

Re: hardware-accelerated cairo on raspbian

Sat Jul 28, 2012 1:03 am

Is there any way you could post your test / example code? I'm interested in using cairo on the rpi but am having trouble finding examples of using cairo with the openvg backend.

hojuruku
Posts: 6
Joined: Fri Mar 20, 2015 11:26 am

Re: hardware-accelerated cairo on raspbian

Wed May 06, 2015 2:57 pm

I am working on Gentoo & Sabayon PI 1/2 Support

http://gci.copyleftgames.org/tasks/ebui ... cairo.html

That looks interesting. Where's your deb build scripts / code?

User avatar
PeterO
Posts: 4882
Joined: Sun Jul 22, 2012 4:14 pm

Re: hardware-accelerated cairo on raspbian

Wed May 06, 2015 3:20 pm

3 year old necrothread!
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Return to “Debian”