[cairo] Does Cairo Use Hardware Acceleration?

Anthony Walter sysrpl at gmail.com
Tue Oct 9 20:43:05 PDT 2012

Thank you for that useful information. It's interesting that you
mention cairo_gl_surface. I did some google searching on that function
and found little information about it. I've done a bit of OpenGL
development  before including creating and managing GL contexts, so
some of what you mentioned is familiar to me.

My source code Cairo import unit doesn't define any OpenGL related
routines. I am going to go ahead an assume I would need to build Cairo
from source with the proper flags to enable an OpenGL render path. Can
you tell me if the Cairo OpenGL render path would work on Windows and
OSX in addition to Linux? Also, when building Cairo is the result and
only dependency I need either libcairo.so or libcairo.a or a static
lib on Linux, and libcairo.dll on Windows?

Also, I am using Pango with the Pango-Cairo bridge functions such as
"pango_cairo_create_layout". Does  Pango work equally well with an
OpenGL based Cairo context?

As for my current work, so far I am using a Gtk+ window and creating a
cairo context with the GdkDrawable* passed to the expose event like

  cr = gdk_cairo_create(drawable);
  //.. cairo draw code here

Or alternately painting to the window using a loop where I invoke code
similar to the following:

  GdkRegion* region = gdk_drawable_get_clip_region(drawable);
  gdk_window_begin_paint_region(drawable, region);
  cr = gdk_cairo_create(drawable);
  //.. cairo draw code here

I am running Ubuntu 12.04 with compositing effects on and proprietary
drivers installed. My test laptop has an Nvidia 8600M video card in
it, which was a mid range mobile graphics card in 2008. The rendering
seems to vary with scene complexity and some effects or rendering
types seem to slow down the render more than others.

>From what you said, it sounds like possible hardware is not being used
with approach, but maybe it is? Could anyone shed a more definitive
light on the two paths I described above?

Thanks again.

More information about the cairo mailing list