Forums - Possible bug in Adreno 200/205, when using glReadPixels on a PBuffer

1 post / 0 new
Possible bug in Adreno 200/205, when using glReadPixels on a PBuffer
sanchiski
Join Date: 29 Jan 13
Posts: 4
Posted: Fri, 2013-09-06 08:19

I'm facing a problem with devices using the Adreno 200 or Adreno 205, on Android devices.

When calling glReadPixels on a Pbuffer some devices will just kill the app with no message at all. Others will give me the next trace and then freeze for around 10 seconds before killing the app.

    Unable to Find Phys Addr for 0
 
So far the affected devices where the problem is reproducible are:
     
   Galaxy Y, Galaxy Ace, Galaxy Mini, Galaxy Young
 
Which all have an Adreno 200 or 205 GPU.
 
I've also tested the code in the next devices where it works correctly as expected, no problems at all:
 
    Nexy 4, Nexus 7, Nexus Galaxy, SGI, SGII, SGIII, Motorola Mini-Defy, and some others more.
 
I've put together a quick test function which reproduces the problem. Maybe someone can spot the issue. Please this is only a test method, no reviews about it are necessary as I just put it together to allow testing the bug, if I missed something let me know. Thanks
 
private static void bugTest()
{
EGL10 egl = (EGL10)EGLContext.getEGL();
EGLDisplay eglDisplay = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
 
// Initialize
int[] version = new int[2];
egl.eglInitialize(eglDisplay, version);
 
// Query total number of configurations
int[] totalConfigurations = new int[1];
egl.eglGetConfigs(eglDisplay, null, 0, totalConfigurations);
 
EGLConfig[] configurationsList = new EGLConfig[totalConfigurations[0]];
int attribs[] = { EGL10.EGL_RENDERABLE_TYPE, 4 /* EGL_OPENGL_ES2_BIT */, EGL10.EGL_RED_SIZE, 1, EGL10.EGL_GREEN_SIZE, 1, EGL10.EGL_BLUE_SIZE, 1, EGL10.EGL_NONE };
 
if (egl.eglChooseConfig(eglDisplay, attribs, configurationsList, 1, totalConfigurations) == false)
{
Log.e(TAG, "Could not find config for GLES2"); 
egl.eglTerminate(eglDisplay);
return;
}
 
// Create the PBuffer
 
EGLSurface eglSurface = null;
final int surfaceWidth = 512;
final int surfaceHeight = 512;
 
try
{
int[] attribList = new int[] { EGL10.EGL_WIDTH, surfaceWidth, EGL10.EGL_HEIGHT, surfaceHeight, EGL10.EGL_NONE };
eglSurface = egl.eglCreatePbufferSurface(eglDisplay, configurationsList[0], attribList);
}
catch (Exception ex)
{
Log.e(TAG, "Failed to create surface"); 
egl.eglTerminate(eglDisplay);
return;
}
 
// BUG Test for glReadPixels
 
if (eglSurface != null)
{
// Create context
 
final int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
final int GLES_VERSION = 2;
int[] attribList = { EGL_CONTEXT_CLIENT_VERSION, GLES_VERSION, EGL10.EGL_NONE };
EGLContext eglContext = egl.eglCreateContext(eglDisplay, configurationsList[0], EGL10.EGL_NO_CONTEXT, attribList);
 
if (eglContext != null)
{
// Attach context to surface
 
if (egl.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext) == true)
{
// Perform the actual bug test
 
GL10 gl = (GL10)eglContext.getGL();
int buffer[] = new int[surfaceWidth * surfaceHeight];
IntBuffer wrappedBuffer = IntBuffer.wrap(buffer);
wrappedBuffer.position(0);
 
// BUG: Line of failure
gl.glReadPixels(0, 0, surfaceWidth, surfaceHeight, GL10.GL_RGB, GL10.GL_UNSIGNED_BYTE, wrappedBuffer);
 
// Also fails when using RGBA 
//gl.glReadPixels(0, 0, surfaceWidth, surfaceHeight, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, wrappedBuffer);
}
 
egl.eglDestroyContext(eglDisplay, eglContext);
}
 
egl.eglDestroySurface(display, eglSurface);
}
 
egl.eglTerminate(eglDisplay);
}

 

  • Up0
  • Down0

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.