Re: Run Cairo with OpenGL ES 2 backend on Android

Ngoc Dao <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <CAHqXiK=8Aev2Kyc26AeJBvrfJCNxZro_-EcWw=DcYEsSj7jw7g@mail.gmail.com>
Henry,

Thanks for your instruction but result is the same:
* The Android app crashes on some devices
* On some other devices, it does not crash but the screen is blank, nothing
is displayed

I've created this Android project:
https://github.com/ngocdaothanh/android-cairogles

You can build and run it to investigate on your machine.

Thanks.


On Thu, Jul 4, 2013 at 2:56 AM, Henry (Yu) Song - SISA <
[email protected]> wrote:

> Hi, Ngoc
>
> I could not extract much from your log.  It seems somewhere in
> cairo_device_create_for_egl has error.  Did you compile cairo with debug.
>
> EGL_SAMPLES and EGL_SAMPLE_BUFFERS are attributes setting when you
> eglChooseConfig, like following snippet
>
>         EGLint attr[] = {
>             EGL_SURFACE_TYPE, EGL_WINDOW_BIT, // window surface instead of
> pixmap or pbuffer surface
>             EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,  // configure for
> opengl es 2
>             EGL_STENCIL_SIZE, 1, // minimal stencil size
>             EGL_RED_SIZE, 1,
>             EGL_GREEN_SIZE, 1,
>             EGL_BLUE_SIZE, 1,
>             EGL_ALPHA_SIZE, 1,
>             EGL_SAMPLES, 4, // 4x msaa
>             EGL_SAMPLE_BUFFERS, 1, // must be 1
>             EGL_NONE
>         };
>
>         if(!eglChooseConfig (egl_display, attr, &egl_config, 1, &num)) {
>             printf("cannot choose config\n");
>             exit(-1);
>         }
>
>         if (num != 1) {
>             printf("did not get exactly one config = %d\n", num);
>             exit(-1);
>         }
>
>         // create an egl window surface from existing native window (in x
> case, win = XCreateWindow()/XCreateSimpleWindow() )
>         EGLSurface egl_surface = eglCreateWindowSurface (egl_display,
>                 egl_config, (NativeWindowType) window, NULL);
>
>
> Hope this helps
>
> Henry
> ________________________________________
> From: Ngoc Dao [[email protected]]
> Sent: Wednesday, July 03, 2013 4:43 AM
> To: Henry (Yu) Song - SISA
> Cc: [email protected]
> Subject: Re: [cairo] Run Cairo with OpenGL ES 2 backend on Android
>
> Hi Henry,
>
> How to set EGL_SAMPLES and EGL_SAMPLE_BUFFERS?
> Is it OK to set CAIRO_GL_COMPOSITOR like this?
> putenv("CAIRO_GL_COMPOSITOR=msaa");
>
> Attached is the error log.
>
>
> On Tue, Jun 25, 2013 at 11:22 PM, Henry (Yu) Song - SISA <
> [email protected]<mailto:[email protected]>> wrote:
> Hi, Ngoc
>
> CAIRO_GL_COMPOSITOR=msaa is not a compile time setting.  At runtime, cairo
> checks this setting.
>
> Regarding to crash, can you send log?
>
> Henry
>
> From: Ngoc Dao [mailto:[email protected]<mailto:
> [email protected]>]
> Sent: Tuesday, June 25, 2013 2:18 AM
> To: Henry (Yu) Song - SISA
> Cc: [email protected]<mailto:[email protected]>
> Subject: Re: [cairo] Run Cairo with OpenGL ES 2 backend on Android
>
> Hi Henry,
> Thanks for the info.
>
> I use Samsung Galaxy S3 (Android 4.0.2) and S3 alpha (Android 4.1.1).
>
> I updated my code as you instructed:
>
> CAIRO_GL_COMPOSITOR=msaa:
>
> https://github.com/ngocdaothanh/jsg/blob/cairogles/android/jni/cairo.mk#L149
>
> EGL init:
>
> https://github.com/ngocdaothanh/jsg/blob/cairogles/android/jni/jsg/jsg.cpp#L373
> Could you please check the code above to see if there's anything wrong?
> It still crashes on S3 and slow (and nothing is shown on the screen) on S3
> alpha.
>
> Regards,
> Ngoc
>
> On Tue, Jun 25, 2013 at 1:29 AM, Henry (Yu) Song - SISA <
> [email protected]<mailto:[email protected]>> wrote:
> Hi, Ngoc
>
> Which cairo git did you get cairogles from?  At this moment, there are
> three gl compositors in cairo.
>
> I don’t have android to test.  If you give me some more info, I might be
> able to help you.
>
>
> 1.       What is the GL driver on your android phone?
>
> 2.       Does it support GL_IMG_multisampled_render_to_texture or
> GL_EXT_multisampled_render_to_texture extensions?
>
> 3.       When you initialize EGL, do you use EGL_SAMPLES and
> EGL_SAMPLE_BUFFERS in configuration?
>
> The reason I ask is that if you enable/or your driver supports MSAA, there
> is a faster GL compositor in cairo, called msaa compositor.  The msaa
> compositor is being upstreamed at this moment, but not all of it has been
> upstreamed, about 20 patches left.
>
> If you want to test with msaa compositor, please visit our branch in
> github - https://github.com/SRA-SiliconValley/cairogles, please pull
> release branch, it is synced with cairo-1.12.14.
>
> When you run cairo, set env CAIRO_GL_COMPOSITOR=msaa, in addition, if your
> app is single-threaded or you have dedicated thread for GL rendering,
> please use cairo_gl_device_set_thread_aware (device, FALSE) to avoid
> unnecessary context switch.
>
> If you want to try shadow/blur in cairo, please pull filters-wip branch.
>  We have implemented Gaussian filter and drop shadow in that branch for
> both image and gl backends as well.  Tests show our GL backend blur/shadow
> performance is very good, beat skia’s drawBlurLooper hands-down.
>  Image-backend performance is not near as good as skia, due to slow
> performance on pixman bilinear sampling, at least on PC.  If you have idea
> to improve, please feel free comment or send patches.
>
> Henry
>
> From: [email protected]<mailto:
> [email protected]> [mailto:cairo-bounces+hsong<mailto:
> cairo-bounces%2Bhsong>[email protected]<mailto:
> [email protected]>] On Behalf Of Ngoc Dao
> Sent: Wednesday, June 19, 2013 11:23 PM
> To: [email protected]<mailto:[email protected]>
> Subject: [cairo] Run Cairo with OpenGL ES 2 backend on Android
>
> Hi.
>
> Have anyone tried to run Cairo with OpenGL ES 2 backend on Android? Is
> there any crash? How's the speed?
>
> I've created a project here (branch master: image backend, cairogles
> branch: OpenGL ES 2 backend):
> https://github.com/ngocdaothanh/jsg
> Some basic results from the project above:
>
> OpenGL ES 2 backend:
> * Crashes on Android 2.3, 4.0.2 etc. with shader compilation problem
> * Doesn't crash on Android 4.1.1, but very very slow, 0.5 FPS/s
> Image backend is stable but slow, 12 FPS/s.
> Ngoc
>
>

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.