[cairo] cairomm hardware acceleration

Chris Wilson chris at chris-wilson.co.uk
Wed Apr 21 00:48:13 PDT 2010


On Wed, 21 Apr 2010 00:01:13 -0400, Noah Ready-Campbell <noah.readcamp at gmail.com> wrote:
> I believe that Gentoo automatically includes the XRender extension into its
> X server ebuild, so I'm pretty sure I have that.  Do you have any idea how
> to get Cairomm to use hardware acceleration?  Or, failing that, how to tell
> if any Cairo applications do, and if Cairo and XRender are integrating
> properly?

cairo delegates the responsibility for creating the surfaces (and thus the
backend and whether hardware acceleration is used) to the application) as
it simply impossible for cairo to get it right by guessing the
applications intentions.

In order to use RENDER acceleration you will need to create a Display and
a Pixmap, and then use one of the cairo_xlib_surface_create_with_xrender()
family of functions. (Any of the cairo_xlib_surface_create* will do,
adjust to taste.)

In order to use OpenGL acceleration, you will need to create either an
EGLDisplay, EGLContext and then cairo_egl_context_create(), or a
Display, GLXContext and cairo_glx_context_create(), and then
cairo_gl_surface_create().

Etc.

To be honest, for your task I would be surprised if GPU offloading
(especially in light of the h/w and drivers you have) is beneficial.
The corollary to using h/w acceleration is that read back is extremely
slow, and that nearly all drivers accelerate Cairo operations miserably.

If you would like to share your application, I would like to see how we
might improve cairo for this task.

Hope this helps and you have a lot of fun using Cairo and evolving Mona
Lisa's smile!
-ickle

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the cairo mailing list