I saw the following lines in the Android 4.0.3 GLSurfaceView.java.
mLimitedGLESContexts = !mMultipleGLESContextsAllowed || renderer.startsWith(kADRENO);
If mLimitedGLESContext is true, application's OpenGL context will be deleted when the application is about to pause. I don't understand here why all Qualcomm chips are with limited context. At fact, since Adreno 200, multiple context is support though with a limited number. I guess there must be particular reason that Qualcomm supports only one context in Android. Could someone tell me why? Or I missed something important. Thanks.
I can't understand this thing too. More then, why such limitation present only on Android? Samsung Wave 3 (Bada 2.0) based on Adreno 205 and no context limitations was found there.
We don't believe our drivers were ever limited to a singled GL context. Even with the initial Adreno 200 drivers we supported a minimum of 8 contexts. We're not able to track the history of that change, but perhaps it was made for an optimization because our early mulitcontent support was slow.
Thanks for your answer, Mark.
Here this code in a sources : https://github.com/android/platform_frameworks_base/blob/master/opengl/j...
It seems that such limitation included because of strange problem with GLES 1.1 contexts on Adreno. It's all about eglCreateContext() function and third parameter - 'share_context'.
I'll try to explain. When we tries to use this code (NDK used):
EGLint context_attr[] = {
EGL_CONTEXT_CLIENT_VERSION, 1,
EGL_NONE
};
m_render.m_context = eglCreateContext( m_display, m_render.m_config, EGL_NO_CONTEXT, context_attr );
if( EGL_NO_CONTEXT == m_render.m_context ){
G_LOG_E( "eglCreateContext() failed with code : 0x?X", eglGetError() );
return false;
};
// Second context will share resources with first one. Look at 'm_render.m_context' as 'share_context'
m_storage.m_context = eglCreateContext( m_display, m_storage.m_config, m_render.m_context, context_attr );
if( EGL_NO_CONTEXT == m_render.m_context ){
G_LOG_E( "eglCreateContext() failed with code : 0x?X", eglGetError() );
return false;
};
On devices with Adreno GPU the program dies inside second eglCreateContext().
Stacktrace is here :
scr 20000012
#00 pc 00000000
#01 pc 000225ec /system/lib/egl/libGLESv1_CM_adreno200.so [initShaderCache() : ??]
#02 pc 00021750 /system/lib/egl/libGLESv1_CM_adreno200.so [gliInitContext() : ??]
code around pc:
This stacktrace is generated by Sony Xperia S (LT26i), which now runs Android 2.3.7.
Also i have such problem on Devices with Adreno 205 (HTC Desire S, S.E. Xperia Neo) and on Adreno 200 (Samsung Galaxy Ace).
Our programm is a crossplatform and it perfectly works on Bada and iOS. Actually it works perfectly on Android too, but i saw only two devices on which programm works fine. That devices are : S.E. Xperia X10i (Android 2.3.3 and Adreno 200) and Samsung Galaxy S (SGX GPU).
I think, people from android devteam see this problem too and wrote code for context limitation.
Mark, can you tell us something about this strange problem? Thanks in advance.
Actually we're facing exactly the same issue on a Motorola Scorpion Mini, while using a shared OpenGL context. We call eglCreateContext with a context already shared with a previous call and we get:
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
backtrace:
#00 pc 00000000 <unknown>
#01 pc 0002bfaf /system/lib/egl/libGLESv2_adreno200.so
#02 pc 0002cc4b /system/lib/egl/libGLESv2_adreno200.so (qgl2DrvAPI_glUseProgram+26)
#03 pc 0001f437 /system/lib/egl/libGLESv2_adreno200.so (glUseProgram+10)
#04 pc 000220f5 /system/lib/egl/libGLESv1_CM_adreno200.so (initShaderCache+84)
#05 pc 00020f01 /system/lib/egl/libGLESv1_CM_adreno200.so (gliInitContext+120)
#06 pc 0002119b /system/lib/egl/libGLESv1_CM_adreno200.so (gliCreateContext+34)
#07 pc 00024127 /system/lib/egl/libGLESv1_CM_adreno200.so (oglCreateContext+54)
#08 pc 000167f8 /system/lib/egl/libEGL_adreno200.so (eglCreateClientApiContext+288)
#09 pc 0000dfdc /system/lib/egl/libEGL_adreno200.so (qeglDrvAPI_eglCreateContext+688)
#10 pc 00005a88 /system/lib/egl/libEGL_adreno200.so (eglCreateContext+16)
#11 pc 0000b975 /system/lib/libEGL.so (eglCreateContext+52)
If we specify "EGL_NO_CONTEXT' in the second call, there's no SEGFAULT. For information, the same code works perfectly with Mali or PowerVR GPU and it's why we're suspecting an issue in Adreno OpenGL stack. Are shared context supported on Adreno ? Is there any limitation on context sharing ?