[cairo] Information required for cairo gl backend regarding CAIRO_OPERATOR_SOURCE

Henry (Yu) Song - SISA hsong at sisa.samsung.com
Thu Sep 27 10:54:17 PDT 2012

Hi, Yuanhan

Which cairo do you use?  The gl/gles backend from cairo upstream is less stable and contains more bugs.  I suggest you to use our cairogles backend for cairo.  It is available in http://code.google.com/p/cairogles.  It is faster, stable and supports MSAA.  If your driver supports MSAA (number of samples > 1 and has glFramebufferTexture2DMultisampleEXT), I would suggest to use our cairogles.  We have not entirely upstreamed our code yet, but it is in progress.

To use our cairogles

1. set env - export CAIRO_GL_COMPOSITOR=msaa 
2. add EGL_SAMPLES, {2 | 4 | 8}, and EGL_SAMPLE_BUFFERS, 1, to your egl attributes - recompile your code

I have tested your code under radeon driver (on PC) and my embedded device with MSAA-supported driver, they both works with our cairogles (OVER, SOURCE)

The reason that SOURCE fails in upstream gles backend probably is your image_surface is BGRA format while your driver only allows RGB/RGBA format when you upload image (glTexSubImage2D()) - this is just my guess

More things to point out if you want to optimize your performance.
1. If you application is not multithreading, add cairo_gl_device_set_thread_aware (device, FALSE) to your code to reduce context switches
2. Instead of painting an image_surface to a gl_surface directly, you should first create a gl_surface same size as your image_surface, paint your image to the new gl_surface, and during each loop, you paint your new gl_surface to the final gl_surface where you want to show result.  The reason is that if you paint image_surface to gl_surface during every loop, the image in system memory has to be uploaded to texture every time, You definitely want to avoid this that slows down your app.

Please let us know if you have more questions and encouter any problems



From: cairo-bounces+henry.song=samsung.com at cairographics.org [cairo-bounces+henry.song=samsung.com at cairographics.org] on behalf of SUMIT PANWAR [sumit.panwar at samsung.com]
Sent: Tuesday, May 29, 2012 2:34 AM
To: Yuanhan Liu
Cc: cairo at cairographics.org
Subject: Re: [cairo] Information required for cairo gl backend regarding CAIRO_OPERATOR_SOURCE


I have attached the sample code for the issue. It takes command line argument to execute for OPERATOR SRC /OPERATOR OVER and to use cairo_paint or cairo_fill like

./sample  ------->>>> EGL_BACKEND, ROP OVER WITH CLIP (works)
./sample  -rop_source ------> ROP_SOURCE  (NOT working)
./sample  -rop_source  -cairo_fill ------> ROP_SOURCE WITH FILL (works)

The attached code uses X window to render the final output.

Please let me know if there is any issue in the sample.



------- Original Message -------

Sender : Yuanhan Liu<yuanhan.liu at linux.intel.com>

Date : May 29, 2012 10:51 (GMT+09:00)

Title : Re: [cairo] Information required for cairo gl backend regarding CAIRO_OPERATOR_SOURCE

On Mon, May 28, 2012 at 02:05:22PM +0000, SUMIT PANWAR wrote:
> Hi,
> We are writing some test cases to compare cairo gl backend with cairo image
> backend.
> 1) Image clipping does not work for CAIRO_OPERATOR_SOURCE.
> Though it works with bounded rectangle with cairo_fill.
> Below applicaiton code does NOT work. It throws gl error 1282(Invalid
> Operation)
> ---------------------------------------------------------
> cairo_rectangle(m_cr, 0, 0, width,height);
> cairo_clip(m_cr);
> cairo_set_source_surface(m_cr,glSrcSurface, 0 , 0);
> cairo_paint(m_cr);
> ---------------------------------------------------------
> What works is below:
> -------------------------
> cairo_rectangle(m_cr, 0, 0, width,height);
> cairo_set_source_surface(m_cr, glSrcSurface, 0 , 0);
> cairo_fill(m_cr);
> -------------------------


It would be good if you attach a full test code that can produce your
issue here.

Yuanhan Liu

> Image clipping with image surface works well.
> Please suggest waht could be the issue.
> Thanks in advance,
> Sumit
> [cid]
> *

> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo

[cid:BEI0XT4NZ5JE at namo.co.kr]

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 201205291504510_QKNMBDIF.jpg
Type: image/jpeg
Size: 72722 bytes
Desc: 201205291504510_QKNMBDIF.jpg
URL: <http://lists.cairographics.org/archives/cairo/attachments/20120927/d5143c00/attachment-0001.jpg>

More information about the cairo mailing list