Forums - Android limited GL context question

5 posts / 0 new
Last post
Android limited GL context question
Hongwei_Li
Join Date: 21 Apr 12
Posts: 2
Posted: Sat, 2012-04-21 02:08

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.

  • Up0
  • Down0
dr.frank.stain@...
Join Date: 4 Apr 12
Posts: 7
Posted: Fri, 2012-04-27 22:15

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.

  • Up0
  • Down0
Mark_Feldman Moderator
Join Date: 4 Jan 12
Posts: 58
Posted: Fri, 2012-05-04 10:21

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.

  • Up0
  • Down0
dr.frank.stain@...
Join Date: 4 Apr 12
Posts: 7
Posted: Fri, 2012-05-04 23:34

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.

  • Up0
  • Down0
damien.dejean
Join Date: 12 Dec 12
Posts: 5
Posted: Wed, 2012-12-12 23:58

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 ?

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.