<div dir="ltr"><div><div>Henry,<br><br>Thanks for your instruction but result is the same:<br></div>* The Android app crashes on some devices<br></div>* On some other devices, it does not crash but the screen is blank, nothing is displayed<br>
<div><br></div><div>I've created this Android project:<br></div><div><div><div><a href="https://github.com/ngocdaothanh/android-cairogles">https://github.com/ngocdaothanh/android-cairogles</a><br><br></div><div>You can build and run it to investigate on your machine.<br>
<br></div><div>Thanks.<br></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 4, 2013 at 2:56 AM, Henry (Yu) Song - SISA <span dir="ltr"><<a href="mailto:henry.song@samsung.com" target="_blank">henry.song@samsung.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi, Ngoc<br>
<br>
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.<br>
<br>
EGL_SAMPLES and EGL_SAMPLE_BUFFERS are attributes setting when you eglChooseConfig, like following snippet<br>
<br>
EGLint attr[] = {<br>
EGL_SURFACE_TYPE, EGL_WINDOW_BIT, // window surface instead of pixmap or pbuffer surface<br>
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, // configure for opengl es 2<br>
EGL_STENCIL_SIZE, 1, // minimal stencil size<br>
EGL_RED_SIZE, 1,<br>
EGL_GREEN_SIZE, 1,<br>
EGL_BLUE_SIZE, 1,<br>
EGL_ALPHA_SIZE, 1,<br>
EGL_SAMPLES, 4, // 4x msaa<br>
EGL_SAMPLE_BUFFERS, 1, // must be 1<br>
EGL_NONE<br>
};<br>
<br>
if(!eglChooseConfig (egl_display, attr, &egl_config, 1, &num)) {<br>
printf("cannot choose config\n");<br>
exit(-1);<br>
}<br>
<br>
if (num != 1) {<br>
printf("did not get exactly one config = %d\n", num);<br>
exit(-1);<br>
}<br>
<br>
// create an egl window surface from existing native window (in x case, win = XCreateWindow()/XCreateSimpleWindow() )<br>
EGLSurface egl_surface = eglCreateWindowSurface (egl_display,<br>
egl_config, (NativeWindowType) window, NULL);<br>
<br>
<br>
Hope this helps<br>
<br>
Henry<br>
________________________________________<br>
From: Ngoc Dao [<a href="mailto:ngocdaothanh@gmail.com">ngocdaothanh@gmail.com</a>]<br>
Sent: Wednesday, July 03, 2013 4:43 AM<br>
<div class="im">To: Henry (Yu) Song - SISA<br>
Cc: <a href="mailto:cairo@cairographics.org">cairo@cairographics.org</a><br>
Subject: Re: [cairo] Run Cairo with OpenGL ES 2 backend on Android<br>
<br>
Hi Henry,<br>
<br>
</div><div class="im">How to set EGL_SAMPLES and EGL_SAMPLE_BUFFERS?<br>
Is it OK to set CAIRO_GL_COMPOSITOR like this?<br>
putenv("CAIRO_GL_COMPOSITOR=msaa");<br>
<br>
Attached is the error log.<br>
<br>
<br>
</div><div class="im">On Tue, Jun 25, 2013 at 11:22 PM, Henry (Yu) Song - SISA <<a href="mailto:henry.song@samsung.com">henry.song@samsung.com</a><mailto:<a href="mailto:henry.song@samsung.com">henry.song@samsung.com</a>>> wrote:<br>
Hi, Ngoc<br>
<br>
CAIRO_GL_COMPOSITOR=msaa is not a compile time setting. At runtime, cairo checks this setting.<br>
<br>
Regarding to crash, can you send log?<br>
<br>
Henry<br>
<br>
</div>From: Ngoc Dao [mailto:<a href="mailto:ngocdaothanh@gmail.com">ngocdaothanh@gmail.com</a><mailto:<a href="mailto:ngocdaothanh@gmail.com">ngocdaothanh@gmail.com</a>>]<br>
<div class="im">Sent: Tuesday, June 25, 2013 2:18 AM<br>
To: Henry (Yu) Song - SISA<br>
</div>Cc: <a href="mailto:cairo@cairographics.org">cairo@cairographics.org</a><mailto:<a href="mailto:cairo@cairographics.org">cairo@cairographics.org</a>><br>
<div class="im">Subject: Re: [cairo] Run Cairo with OpenGL ES 2 backend on Android<br>
<br>
Hi Henry,<br>
Thanks for the info.<br>
<br>
I use Samsung Galaxy S3 (Android 4.0.2) and S3 alpha (Android 4.1.1).<br>
<br>
I updated my code as you instructed:<br>
<br>
CAIRO_GL_COMPOSITOR=msaa:<br>
<a href="https://github.com/ngocdaothanh/jsg/blob/cairogles/android/jni/cairo.mk#L149" target="_blank">https://github.com/ngocdaothanh/jsg/blob/cairogles/android/jni/cairo.mk#L149</a><br>
<br>
EGL init:<br>
<a href="https://github.com/ngocdaothanh/jsg/blob/cairogles/android/jni/jsg/jsg.cpp#L373" target="_blank">https://github.com/ngocdaothanh/jsg/blob/cairogles/android/jni/jsg/jsg.cpp#L373</a><br>
Could you please check the code above to see if there's anything wrong?<br>
It still crashes on S3 and slow (and nothing is shown on the screen) on S3 alpha.<br>
<br>
Regards,<br>
Ngoc<br>
<br>
</div><div class="im">On Tue, Jun 25, 2013 at 1:29 AM, Henry (Yu) Song - SISA <<a href="mailto:henry.song@samsung.com">henry.song@samsung.com</a><mailto:<a href="mailto:henry.song@samsung.com">henry.song@samsung.com</a>>> wrote:<br>
Hi, Ngoc<br>
<br>
Which cairo git did you get cairogles from? At this moment, there are three gl compositors in cairo.<br>
<br>
I don’t have android to test. If you give me some more info, I might be able to help you.<br>
<br>
<br>
1. What is the GL driver on your android phone?<br>
<br>
2. Does it support GL_IMG_multisampled_render_to_texture or GL_EXT_multisampled_render_to_texture extensions?<br>
<br>
3. When you initialize EGL, do you use EGL_SAMPLES and EGL_SAMPLE_BUFFERS in configuration?<br>
<br>
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.<br>
<br>
If you want to test with msaa compositor, please visit our branch in github - <a href="https://github.com/SRA-SiliconValley/cairogles" target="_blank">https://github.com/SRA-SiliconValley/cairogles</a>, please pull release branch, it is synced with cairo-1.12.14.<br>
<br>
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.<br>
<br>
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.<br>
<br>
Henry<br>
<br>
</div>From: cairo-bounces+hsong=<a href="mailto:sisa.samsung.com@cairographics.org">sisa.samsung.com@cairographics.org</a><mailto:<a href="mailto:sisa.samsung.com@cairographics.org">sisa.samsung.com@cairographics.org</a>> [mailto:<a href="mailto:cairo-bounces%2Bhsong">cairo-bounces+hsong</a><mailto:<a href="mailto:cairo-bounces%252Bhsong">cairo-bounces%2Bhsong</a>>=<a href="mailto:sisa.samsung.com@cairographics.org">sisa.samsung.com@cairographics.org</a><mailto:<a href="mailto:sisa.samsung.com@cairographics.org">sisa.samsung.com@cairographics.org</a>>] On Behalf Of Ngoc Dao<br>
<div class="im">Sent: Wednesday, June 19, 2013 11:23 PM<br>
</div>To: <a href="mailto:cairo@cairographics.org">cairo@cairographics.org</a><mailto:<a href="mailto:cairo@cairographics.org">cairo@cairographics.org</a>><br>
<div class="HOEnZb"><div class="h5">Subject: [cairo] Run Cairo with OpenGL ES 2 backend on Android<br>
<br>
Hi.<br>
<br>
Have anyone tried to run Cairo with OpenGL ES 2 backend on Android? Is there any crash? How's the speed?<br>
<br>
I've created a project here (branch master: image backend, cairogles branch: OpenGL ES 2 backend):<br>
<a href="https://github.com/ngocdaothanh/jsg" target="_blank">https://github.com/ngocdaothanh/jsg</a><br>
Some basic results from the project above:<br>
<br>
OpenGL ES 2 backend:<br>
* Crashes on Android 2.3, 4.0.2 etc. with shader compilation problem<br>
* Doesn't crash on Android 4.1.1, but very very slow, 0.5 FPS/s<br>
Image backend is stable but slow, 12 FPS/s.<br>
Ngoc<br>
<br>
</div></div></blockquote></div><br></div>