[cairo] acceleration
Henry (Yu) Song - SISA
hsong at sisa.samsung.com
Tue Oct 2 18:14:20 PDT 2012
Hi, Pat
If the app you are porting uses gl calls directly, why not retain gl part? you might have to modify windowing system from the app to Linux using GTK/EFL
1. clutter/cogl supports both GL (> 1.4) and ES (both 1 and 2) - if you decide to use that
2. Pycairo does not have interface to cairo_gl_surface - unless you are will to add.
3. You will have performance hit by using nouveau as the driver does not support MSAA. Try nvidia proprietary driver that supports MSAA ("glxinfo -v | grep multSample" to get idea on msaa support). If the nvidia close-source driver supports MSAA, you might want to try a new MSAA backend for cairo (http://code.google.com/p/cairogles, checkout "release" branch) - it supports MSAA and has lots of optimization and is more stable/faster than gl-backend in cairo upstream. I am in the process of upstream it to cairo main source. The code is well tested on MSAA-capable drivers, like fglrx, nvidia, and other embedded drivers). If you try and decide to use that, set env EXPORT CAIRO_GL_COMPOSITOR=msaa, and if you app has cairo running in a single thread, cairo_gl_device_set_thread_aware (device, FALSE) to reduce context switch. You also want to add GLX_SAMPLES, 4 and GLX_SAMPLE_BUFFERS, 1, GLX_STENCIL_SIZE, 1 to your glx attribs.
Please let me know if you encounter problems so that I can fix it promptly
Henry
________________________________________
From: cairo-bounces+hsong=sisa.samsung.com at cairographics.org [cairo-bounces+hsong=sisa.samsung.com at cairographics.org] on behalf of Patrick Shirkey [pshirkey at boosthardware.com]
Sent: Tuesday, October 02, 2012 5:36 PM
To: cairo at cairographics.org
Subject: Re: [cairo] acceleration
On Wed, October 3, 2012 10:03 am, Henry (Yu) Song - SISA wrote:
> Hi, Patrix
>
> The answer to your question is YES, cairo runs on Opengl and Opengl es 2.0
> (no gles 1 though). I might be able to help you more if you can give me
> more info on your gl driver. Is it open source intel, radeon, nouveau
> driver? it is ATI fglrx driver or NVidia unified driver? Are you running
> on embedded device with Opengl es 2, what is the embedded GPU/driver?
>
The machine I am developing on is running the nouveau driver and the
device is
NVIDIA Corporation G96 [Quadro FX 580]
I have tested the cairo_gl_surface example code on this machine and it
loads the gears example and various clutter examples too.
I porting an app from that other os to Linux and I would like to be able
to reuse the existing opengl code so it looks like cairo_gl_surface is the
way to go for that task as I have been told clutter only has support for
gles.
My options at the moment are:
1: Port the cairo_gl_surface example from c to python3
2: Port the existing opengl to gles and load in clutter
3: Reimplement the existing opengl code as clutter/cogl
I would prefer to do 1 but at the moment the only code I can get to run in
python is the clutter examples so I have to make a decision.
Patrick
> They are all different.
>
> Henry
> ________________________________________
> From: cairo-bounces+henry.song=samsung.com at cairographics.org
> [cairo-bounces+henry.song=samsung.com at cairographics.org] on behalf of
> Patrick Shirkey [pshirkey at boosthardware.com]
> Sent: Tuesday, October 02, 2012 4:25 PM
> To: cairo at cairographics.org
> Subject: Re: [cairo] acceleration
>
> On Wed, October 3, 2012 9:10 am, Henry (Yu) Song - SISA wrote:
>> I am not sure your question. acceleration in gl driver? or acceleration
>> using gl-backend vs. image-backend in cairo?
>>
>
> According to wikipedia cairo "uses acceleration when available". So as
> that is rather vague I need to prove or disprove that cairo will use the
> GPU for 2d acceleration for the image-backend. My experience with cairo on
> gtk2 suggests that the computations are handled by the cpu unless
> explicitly requested to use cairo_gl_surface.
>
>
>> if you want to use gl backend, create cairo_gl_surface instead of using
>> cairo_image_surface. Again, the performance of cairo_gl_surface vs.
>> cairo_image_surface depends on your gl driver quality as Chris said.
>>
>
> Thanks, does cairo_gl_surface work with all opengl or only opengl es ?
>
>
>> Henry
>> ________________________________________
>> From: cairo-bounces+hsong=sisa.samsung.com at cairographics.org
>> [cairo-bounces+hsong=sisa.samsung.com at cairographics.org] on behalf of
>> Patrick Shirkey [pshirkey at boosthardware.com]
>> Sent: Tuesday, October 02, 2012 3:46 PM
>> To: cairo at cairographics.org
>> Subject: Re: [cairo] acceleration
>>
>> On Tue, October 2, 2012 9:39 pm, Chris Wilson wrote:
>>> On Tue, 2 Oct 2012 21:25:43 +1000 (EST), "Patrick Shirkey"
>>> <pshirkey at boosthardware.com> wrote:
>>>>
>>>> On Tue, October 2, 2012 9:16 pm, Chris Wilson wrote:
>>>> > On Tue, 2 Oct 2012 15:35:38 +1000 (EST), "Patrick Shirkey"
>>>> > <pshirkey at boosthardware.com> wrote:
>>>> >> Hi,
>>>> >>
>>>> >> Is there a simple test to know if cairo is using acceleration or is
>>>> it
>>>> >> just a matter of running a desktop with glx?
>>>> >
>>>> > Cairo dodges the complicated question of how to setup the rendering
>>>> > pipeline leaving that to the application/toolkit. So in order for
>>>> cairo
>>>> > to use GL, the application must create a set of output Windows
>>>> > compatible with GL and pass those and the context to cairo to use.
>>>> The
>>>> > degree of acceleration then depends upon the quality of the driver
>>>> and
>>>> > the style of rendering. In short, do not expect to switching to
>>>> cairo-gl
>>>> > to be an easy task to get fast rendering.
>>>>
>>
>>
>> In terms of 2d acceleration how would I know if cario is using the GPU
>> or
>> CPU?
>>
>>
>>
>>
>>>> Thanks Chris.
>>>>
>>>> Is the recommended approached to use cogl directly, cairo or clutter?
>>>
>>> Use the appropriate tool to hand :)
>>>
>>> Clutter is excellent for controlling animations and emergent behaviour.
>>> Cairo offers a simple means for describing a page layout (or parts
>>> there
>>> of).
>>> Cogl aims to make using OpenGL simpler and more portable, with a few
>>> additional smarts.
>>>
>>>> FYI, I am using python3 with gtk3 and so far the only code I have been
>>>> able to make work with this combination are the clutter examples.
>>>>
>>>> I have some existing opengl. I am looking at either porting it to
>>>> cogl/clutter or if there is a way to load it directly with cairo that
>>>> I
>>>> have yet to come across.
>>>
>>> If you are starting from OpenGL, probably easier to go to clutter+cogl.
>>> Cairo comes into its own for having a higher level description of paths
>>> and shapes, but if you already are well versed in translating into
>>> OpenGL, then you probably do not need Cairo and will probably be better
>>> to avoid the impedance mismatch between the PDF rendering model and
>>> OpenGL. However, if Cairo makes your design and maintenance easier,
>>> have
>>> fun!
>>> -Chris
>>>
>>> --
>>> Chris Wilson, Intel Open Source Technology Centre
>>>
>>
>>
>> --
>> Patrick Shirkey
>> Boost Hardware Ltd
>> --
>> cairo mailing list
>> cairo at cairographics.org
>> http://lists.cairographics.org/mailman/listinfo/cairo
>>
>
>
> --
> Patrick Shirkey
> Boost Hardware Ltd
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>
--
Patrick Shirkey
Boost Hardware Ltd
--
cairo mailing list
cairo at cairographics.org
http://lists.cairographics.org/mailman/listinfo/cairo
More information about the cairo
mailing list