[cairo] question on cairo, opengl and x-window

Henry (Yu) Song - SISA hsong at sisa.samsung.com
Fri May 11 12:28:12 PDT 2012

Hi, Guo

Cairo has GL backend.  However, current cairo gl backend in cairo snapshot is not as good as expected.  We have created a new MSAA-enabled gl compositor.  It can be downloaded from http://code.google.com/p/cairogles/source/checkout,  checkout the code, and switch to "release" branch.  It supports MSAA for both glx and egl. We are still actively fixing bugs and optimization.  Please let us know if you encounter any problem.  The "release" branch is fully synced with cairo 1.12.2, and in the coming months, we hope we can upstream our code to cairo mainline.  It also supports using a non-texture surface as source/mask.  I will add a new API that fast-path of supporting non-texture surface as source/mask shortly.

Cairo GL supports both non-texture surface (e.g., x window, pixmap, pbuffer) as well as texture surface.  I don't see in your new logic why create cairo surface without window, you can create a cairo gl surface that binds to a X window., then you can draw into the surface and swap buffer directly on the window.


From: cairo-bounces+henry.song=samsung.com at cairographics.org [cairo-bounces+henry.song=samsung.com at cairographics.org] on behalf of Guo Tang [guo.tang at sonoartis.com]
Sent: Friday, May 11, 2012 12:04 PM
To: cairo at cairographics.org
Subject: [cairo] question on cairo, opengl and x-window


We have a software that uses cairo and X window system. The old design is using several X windows, several of them are transparent. We use Cairo to draw
image, curves and text annotation.

The design with several X windows causes us some problems when we move to a newer version of Linux. It also has lots of trouble with Xming X window manager.
We are thinking about a new design with just one X window. The image display part is already moved to OpenGL (for better performance reason). I am thinking about
still keep our old cairo codes for text annotation, but avoiding a separate X window.

The old logic:

from X window, create_cairo_context.
from a transparent png file, create a surface.
set the surface to cairo context
then draw things on cairo context

If I want to just use one X window (this window already has OpenGL context in it). Is the solution this way?

new logic:
create a cairo context without any X window (?).
png file to surface.
set the surface to cairo context
then draw things on cairo context
get the drawing result back to memory.
then use OpenGL to render it to hardware.

I am wondering whether new logic is possible? Will all the cairo rendering all done in software without hardware acceleration, versus old logic has? If without HW acceleration, I will only
be able to keep cairo for non real time drawing.
Any better way to link OpenGL and cairo together? Like user still uses cairo API to draw, but it is actually drawing using hardware (openGL), in a specify depth, and
with the opacity setting that I can control?

Your advise is appreciated.


More information about the cairo mailing list