Imagination PowerVR SDK Blog

Crash in glFinish or eglMakeCurrent on Kindle devices


#1

Hi,

I am seeing a crash when running my application on Kindle devices with a PowerVR GPU (HD6 and HD10 2015). The bug does not occur on non-PowerVR Kindles.

The crash usually looks like this:

04-04 14:30:34.712 978 1001 V CrashDescriptorUtil: backtrace:
04-04 14:30:34.712 978 1001 V CrashDescriptorUtil: #00 pc 0000ce86 /system/vendor/lib/libsrv_um.so (RGXRetrievePartialRenderCountInFWRTData+25)
04-04 14:30:34.712 978 1001 V CrashDescriptorUtil: #01 pc 0002e563 /system/vendor/lib/egl/libGLESv2_POWERVR_ROGUE.so
04-04 14:30:34.712 978 1001 V CrashDescriptorUtil: #02 pc 0001a7b3 /system/vendor/lib/egl/libGLESv2_POWERVR_ROGUE.so
04-04 14:30:34.712 978 1001 V CrashDescriptorUtil: #03 pc 00016d13 /system/vendor/lib/egl/libGLESv2_POWERVR_ROGUE.so
04-04 14:30:34.712 978 1001 V CrashDescriptorUtil: #04 pc 000099a7 /system/vendor/lib/libIMGegl.so (IMGeglMakeCurrent+774)
04-04 14:30:34.712 978 1001 V CrashDescriptorUtil: #05 pc 00010493 /system/lib/libEGL.so (ZN7android13egl_display_t11makeCurrentEPNS_13egl_context_tES2_PvS3_S3_S3_S3_S3+96)
04-04 14:30:34.712 978 1001 V CrashDescriptorUtil: #06 pc 00012dc5 /system/lib/libEGL.so (eglMakeCurrent+284)

Sometimes the crash is in glFinish instead of eglMakeCurrent. In both cases, RGXRetrievePartialRenderCountInFWRTData is at the bottom of the stack. The context that crashes is not really doing anything fancy. It just draws a texture once.

I sometimes (not always) see a message like this in logcat:

PVR_K:(Error): 8065: GetHandleData: Handle index out of range (4294967295 >= 2048) [0, ]

Thanks.


#2

Hello,

It is difficult to tell with this limited information which might be the problem. It could be that when you call glMakeCurrent the surface handle is already lost. Is your application multi-threaded? Do you delete and recreate your surfaces? Try getting rid of that glFinish…
The error log might also be just a red herring and the crash might be due to a different undefined-behavior error like a buffer out of range.
Have you reported this problem to Amazon?

Regards.

Carlos.


#3

Hi,

Is your application multi-threaded?

Yes, we have multiple threads with with multiple contexts. Other than context creation, a thread only every has a single context. There is no context switching (we only call eglMakeCurrent once per context).

Do you delete and recreate surfaces?

The context that crashes is created with a 1x1 pbuffer surface. We upload a texture using share context. The main context generates a renderbuffer which we attach to the framebuffer. Then we draw the texture and read back the pixels (glReadPixels). Later we delete the program and call glFinish which crashes. Its weird that the glFinish crashes since the glReadPixels succeeded.

Have you reported this problem to Amazon?

What is the channel for doing that?

Below is a trace of the crashing context. Format is: [time] (thread) command.

[16:46:10.171] (8314) eglCreateContext(0x1, 0x23, 0x0, 0x821F432C) = 0xB81BE2B0
[16:46:10.173] (8468) eglMakeCurrent(0x1, 0xB82F4890, 0xB82F4890, 0xB81BE2B0) = 0x1
[16:46:10.174] (8468) glDisable(0xB44)
[16:46:10.174] (8468) glDisable(0xB71)
[16:46:10.175] (8468) glGetError() = 0x0
[16:46:10.175] (8468) glGetIntegerv(0xD33, 0x821F4668)
[16:46:10.175] (8468) glGetError() = 0x0
[16:46:10.209] (8468) glCreateShader(0x8B31) = 0x1
[16:46:10.209] (8468) glShaderSource(0x1, 0x1, 0x82672AD4, 0x0)
[16:46:10.210] (8468) glCompileShader(0x1)
[16:46:10.210] (8468) glGetShaderiv(0x1, 0x8B81, 0x82672AD0)
[16:46:10.210] (8468) glGetError() = 0x0
[16:46:10.211] (8468) glCreateShader(0x8B30) = 0x2
[16:46:10.211] (8468) glShaderSource(0x2, 0x1, 0x82672ACC, 0x0)
[16:46:10.211] (8468) glCompileShader(0x2)
[16:46:10.212] (8468) glGetShaderiv(0x2, 0x8B81, 0x82672AC8)
[16:46:10.212] (8468) glGetError() = 0x0
[16:46:10.212] (8468) glCreateProgram() = 0x3
[16:46:10.213] (8468) glAttachShader(0x3, 0x1)
[16:46:10.213] (8468) glAttachShader(0x3, 0x2)
[16:46:10.213] (8468) glGetAttachedShaders(0x3, 0x2, 0x826729AC, 0x826729B0)
[16:46:10.213] (8468) glGetShaderiv(0x1, 0x8B88, 0x82672A24)
[16:46:10.214] (8468) glGetShaderSource(0x1, 0x1DB, 0x82672A14, 0x12491680)
[16:46:10.214] (8468) glGetShaderiv(0x2, 0x8B88, 0x82672A24)
[16:46:10.214] (8468) glGetShaderSource(0x2, 0x392, 0x82672A14, 0x12151E00)
[16:46:10.217] (8468) glProgramBinaryOES(0x3, 0x9130, 0x86B5D020, 0x2711)
[16:46:10.227] (8468) glGetProgramiv(0x3, 0x8B82, 0x82672A44)
[16:46:10.228] (8468) glGetProgramiv(0x3, 0x8B82, 0x82672B84)
[16:46:10.228] (8468) glGetProgramiv(0x3, 0x8B86, 0x82672AB4)
[16:46:10.228] (8468) glGetProgramiv(0x3, 0x8B87, 0x82672AB0)
[16:46:10.229] (8468) glGetIntegerv(0x8872, 0x82672A9C)
[16:46:10.229] (8468) glGetActiveUniform(0x3, 0x0, 0x14, 0x0, 0x82672A90, 0x82672A8C, 0x82672A00)
[16:46:10.230] (8468) glGetUniformLocation(0x3, 0x82672A00) = 0x0
[16:46:10.230] (8468) glGetActiveUniform(0x3, 0x1, 0x14, 0x0, 0x82672A90, 0x82672A8C, 0x82672A00)
[16:46:10.231] (8468) glGetUniformLocation(0x3, 0x82672A00) = 0x1
[16:46:10.231] (8468) glGetActiveUniform(0x3, 0x2, 0x14, 0x0, 0x82672A90, 0x82672A8C, 0x82672A00)
[16:46:10.231] (8468) glGetUniformLocation(0x3, 0x82672A00) = 0x2
[16:46:10.232] (8468) glGetActiveUniform(0x3, 0x3, 0x14, 0x0, 0x82672A90, 0x82672A8C, 0x82672A00)
[16:46:10.232] (8468) glGetUniformLocation(0x3, 0x82672A00) = 0x3
[16:46:10.232] (8468) glGetActiveUniform(0x3, 0x4, 0x14, 0x0, 0x82672A90, 0x82672A8C, 0x82672A00)
[16:46:10.233] (8468) glGetUniformLocation(0x3, 0x82672A00) = 0x4
[16:46:10.233] (8468) glGetActiveUniform(0x3, 0x5, 0x14, 0x0, 0x82672A90, 0x82672A8C, 0x82672A00)
[16:46:10.233] (8468) glGetUniformLocation(0x3, 0x82672A00) = 0x5
[16:46:10.233] (8468) glGetError() = 0x0
[16:46:10.234] (8468) glGetProgramiv(0x3, 0x8B89, 0x82672ABC)
[16:46:10.234] (8468) glGetProgramiv(0x3, 0x8B8A, 0x82672AB8)
[16:46:10.234] (8468) glGetActiveAttrib(0x3, 0x0, 0xB, 0x0, 0x82672AA0, 0x82672A9C, 0x82672A28)
[16:46:10.235] (8468) glGetAttribLocation(0x3, 0x82672A28) = 0x0
[16:46:10.235] (8468) glGetActiveAttrib(0x3, 0x1, 0xB, 0x0, 0x82672AA0, 0x82672A9C, 0x82672A28)
[16:46:10.235] (8468) glGetAttribLocation(0x3, 0x82672A28) = 0x1
[16:46:10.236] (8468) glGetError() = 0x0
[16:46:10.236] (8468) glGetError() = 0x0
[16:46:10.236] (8468) glDeleteShader(0x2)
[16:46:10.237] (8468) glGetError() = 0x0
[16:46:10.237] (8468) glDeleteShader(0x1)
[16:46:10.238] (8468) glGetError() = 0x0
[16:46:10.238] (8468) glUseProgram(0x3)
[16:46:10.238] (8468) glGetError() = 0x0
[16:46:10.239] (8468) glGetError() = 0x0
[16:46:10.239] (8468) glDisable(0xBE2)
[16:46:10.239] (8468) glGetError() = 0x0
[16:46:10.239] (8468) glActiveTexture(0x84C0)
[16:46:10.240] (8468) glGetIntegerv(0x8069, 0x826732D4)
[16:46:10.515] (8468) glGetError() = 0x0
[16:46:10.519] (8468) glBindTexture(0xDE1, 0x1)
[16:46:10.519] (8468) glTexParameteri(0xDE1, 0x2801, 0x2601)
[16:46:10.519] (8468) glTexParameteri(0xDE1, 0x2800, 0x2601)
[16:46:10.520] (8468) glTexParameterf(0xDE1, 0x2802, 0x812F)
[16:46:10.520] (8468) glTexParameterf(0xDE1, 0x2803, 0x812F)
[16:46:10.520] (8468) glGetError() = 0x0
[16:46:10.520] (8468) glBindTexture(0xDE1, 0x0)
[16:46:10.520] (8468) glGetError() = 0x0
[16:46:10.520] (8468) glGenFramebuffers(0x1, 0x1298FECC)
[16:46:10.521] (8468) glGenRenderbuffers(0x1, 0x1298FED0)
[16:46:10.521] (8468) glBindFramebuffer(0x8D40, 0x1)
[16:46:10.521] (8468) glBindRenderbuffer(0x8D41, 0x1)
[16:46:10.521] (8468) glGetIntegerv(0x8CA7, 0x826731A8)
[16:46:10.521] (8468) glGetError() = 0x0
[16:46:10.522] (8468) glGetError() = 0x0
[16:46:10.522] (8468) glRenderbufferStorage(0x8D41, 0x8058, 0x320, 0x4B8)
[16:46:10.523] (8468) glGetError() = 0x0
[16:46:10.523] (8468) glFramebufferRenderbuffer(0x8D40, 0x8CE0, 0x8D41, 0x1)
[16:46:10.524] (8468) glGetRenderbufferParameteriv(0x8D41, 0x8D42, 0x826732B0)
[16:46:10.524] (8468) glGetRenderbufferParameteriv(0x8D41, 0x8D43, 0x826732AC)
[16:46:10.524] (8468) glCheckFramebufferStatus(0x8D40) = 0x8CD5
[16:46:10.524] (8468) glGetError() = 0x0
[16:46:10.524] (8468) glBindFramebuffer(0x8D40, 0x1)
[16:46:10.525] (8468) glViewport(0x0, 0x0, 0x320, 0x4B8)
[16:46:10.525] (8468) glGetError() = 0x0
[16:46:10.525] (8468) glGenBuffers(0x1, 0x978628C4)
[16:46:10.525] (8468) glBindBuffer(0x8892, 0x1)
[16:46:10.525] (8468) glBufferData(0x8892, 0x50, 0x826732A0, 0x88E4)
[16:46:10.526] (8468) glGetError() = 0x0
[16:46:10.526] (8468) glBindBuffer(0x8892, 0x1)
[16:46:10.527] (8468) glVertexAttribPointer(0x0, 0x3, 0x1406, 0x0, 0x14, 0x0)
[16:46:10.527] (8468) glEnableVertexAttribArray(0x0)
[16:46:10.527] (8468) glGetError() = 0x0
[16:46:10.527] (8468) glVertexAttribPointer(0x1, 0x2, 0x1406, 0x0, 0x14, 0xC)
[16:46:10.527] (8468) glEnableVertexAttribArray(0x1)
[16:46:10.527] (8468) glGetError() = 0x0
[16:46:10.528] (8468) glGetError() = 0x0
[16:46:10.528] (8468) glActiveTexture(0x84C2)
[16:46:10.528] (8468) glUniform1i(0x4, 0x2)
[16:46:10.528] (8468) glBindTexture(0xDE1, 0x1)
[16:46:10.528] (8468) glGetError() = 0x0
[16:46:10.528] (8468) glUniformMatrix4fv(0x0, 0x1, 0x0, 0x82673138)
[16:46:10.528] (8468) glGetError() = 0x0
[16:46:10.529] (8468) glUniform1f(0x1, 0x0)
[16:46:10.529] (8468) glGetError() = 0x0
[16:46:10.529] (8468) glUniformMatrix4fv(0x5, 0x1, 0x0, 0x82673138)
[16:46:10.529] (8468) glGetError() = 0x0
[16:46:10.529] (8468) glGetError() = 0x0
[16:46:10.529] (8468) glValidateProgram(0x3)
[16:46:10.529] (8468) glGetProgramiv(0x3, 0x8B84, 0x826732EC)
[16:46:10.530] (8468) glGetProgramiv(0x3, 0x8B83, 0x826732E8)
[16:46:10.530] (8468) glGetError() = 0x0
[16:46:10.530] (8468) glClear(0x4000)
[16:46:10.532] (8468) glDisable(0xB71)
[16:46:10.533] (8468) glDisable(0xB44)
[16:46:10.533] (8468) glDrawArrays(0x5, 0x0, 0x4)
[16:46:10.536] (8468) glGetError() = 0x0
[16:46:10.536] (8468) glGetError() = 0x0
[16:46:10.536] (8468) glActiveTexture(0x84C2)
[16:46:10.536] (8468) glUniform1i(0x4, 0x2)
[16:46:10.537] (8468) glBindTexture(0xDE1, 0x0)
[16:46:10.537] (8468) glGetError() = 0x0
[16:46:10.537] (8468) glDisableVertexAttribArray(0x0)
[16:46:10.537] (8468) glDisableVertexAttribArray(0x1)
[16:46:10.537] (8468) glBindBuffer(0x8892, 0x0)
[16:46:10.537] (8468) glFlush()
[16:46:10.538] (8468) glBindRenderbuffer(0x8D41, 0x1)
[16:46:10.538] (8468) glGetIntegerv(0x8CA7, 0x82673844)
[16:46:10.538] (8468) glGetError() = 0x0
[16:46:10.538] (8468) glGetError() = 0x0
[16:46:10.538] (8468) glReadPixels(0x0, 0x0, 0x320, 0x4B8, 0x1908, 0x1401, 0x7F568000)
[16:46:10.561] (8468) glGetError() = 0x0
[16:46:10.572] (8468) glGetError() = 0x0
[16:46:10.575] (8468) glGetError() = 0x0
[16:46:10.577] (8468) glUseProgram(0x3)
[16:46:10.577] (8468) glGetError() = 0x0
[16:46:10.578] (8468) glGetError() = 0x0
[16:46:10.578] (8468) glDisable(0xBE2)
[16:46:10.578] (8468) glGetError() = 0x0
[16:46:10.578] (8468) glActiveTexture(0x84C0)
[16:46:10.578] (8468) glGetIntegerv(0x8069, 0x860071FC)
[16:46:10.579] (8468) glBindTexture(0xDE1, 0x1)
[16:46:10.579] (8468) glTexParameteri(0xDE1, 0x2801, 0x2601)
[16:46:10.579] (8468) glTexParameteri(0xDE1, 0x2800, 0x2601)
[16:46:10.579] (8468) glTexParameterf(0xDE1, 0x2802, 0x812F)
[16:46:10.579] (8468) glTexParameterf(0xDE1, 0x2803, 0x812F)
[16:46:10.579] (8468) glGetError() = 0x0
[16:46:10.579] (8468) glBindTexture(0xDE1, 0x0)
[16:46:10.579] (8468) glGetError() = 0x0
[16:46:10.580] (8468) glBindFramebuffer(0x8D40, 0x1)
[16:46:10.580] (8468) glViewport(0x0, 0x0, 0x320, 0x4B8)
[16:46:10.580] (8468) glGetError() = 0x0
[16:46:10.580] (8468) glBindBuffer(0x8892, 0x1)
[16:46:10.580] (8468) glVertexAttribPointer(0x0, 0x3, 0x1406, 0x0, 0x14, 0x0)
[16:46:10.580] (8468) glEnableVertexAttribArray(0x0)
[16:46:10.580] (8468) glGetError() = 0x0
[16:46:10.581] (8468) glVertexAttribPointer(0x1, 0x2, 0x1406, 0x0, 0x14, 0xC)
[16:46:10.581] (8468) glEnableVertexAttribArray(0x1)
[16:46:10.581] (8468) glGetError() = 0x0
[16:46:10.581] (8468) glGetError() = 0x0
[16:46:10.581] (8468) glActiveTexture(0x84C2)
[16:46:10.581] (8468) glUniform1i(0x4, 0x2)
[16:46:10.581] (8468) glBindTexture(0xDE1, 0x1)
[16:46:10.582] (8468) glGetError() = 0x0
[16:46:10.582] (8468) glUniformMatrix4fv(0x0, 0x1, 0x0, 0x86007060)
[16:46:10.582] (8468) glGetError() = 0x0
[16:46:10.582] (8468) glUniform1f(0x1, 0x0)
[16:46:10.582] (8468) glGetError() = 0x0
[16:46:10.582] (8468) glUniformMatrix4fv(0x5, 0x1, 0x0, 0x86007060)
[16:46:10.583] (8468) glGetError() = 0x0
[16:46:10.583] (8468) glGetError() = 0x0
[16:46:10.583] (8468) glValidateProgram(0x3)
[16:46:10.583] (8468) glGetProgramiv(0x3, 0x8B84, 0x86007214)
[16:46:10.583] (8468) glGetProgramiv(0x3, 0x8B83, 0x86007210)
[16:46:10.583] (8468) glGetError() = 0x0
[16:46:10.584] (8468) glClear(0x4000)
[16:46:10.584] (8468) glDisable(0xB71)
[16:46:10.584] (8468) glDisable(0xB44)
[16:46:10.584] (8468) glDrawArrays(0x5, 0x0, 0x4)
[16:46:10.584] (8468) glGetError() = 0x0
[16:46:10.585] (8468) glGetError() = 0x0
[16:46:10.585] (8468) glActiveTexture(0x84C2)
[16:46:10.587] (8468) glUniform1i(0x4, 0x2)
[16:46:10.587] (8468) glBindTexture(0xDE1, 0x0)
[16:46:10.588] (8468) glGetError() = 0x0
[16:46:10.588] (8468) glDisableVertexAttribArray(0x0)
[16:46:10.589] (8468) glDisableVertexAttribArray(0x1)
[16:46:10.589] (8468) glBindBuffer(0x8892, 0x0)
[16:46:10.589] (8468) glFlush()
[16:46:10.590] (8468) glBindRenderbuffer(0x8D41, 0x1)
[16:46:10.590] (8468) glGetIntegerv(0x8CA7, 0x8600776C)
[16:46:10.591] (8468) glGetError() = 0x0
[16:46:10.591] (8468) glGetError() = 0x0
[16:46:10.591] (8468) glReadPixels(0x0, 0x0, 0x320, 0x4B8, 0x1908, 0x1401, 0x80B70000)
[16:46:10.618] (8468) glGetError() = 0x0
[16:46:10.631] (8468) glGetError() = 0x0
[16:46:10.634] (8468) glGetError() = 0x0
[16:47:14.935] (8468) glDeleteProgram(0x3)
[16:47:14.935] (8468) glGetError() = 0x0
[16:47:15.319] (8468) glFinish() -> CRASH!!!

Regards,
Mandeep

Summary

This text will be hidden


#4

Hi Mandeep,

Can you please try to capture a the GL calls using PVRTrace. It doesn’t have to be that Kindle device, I just want to see the GL calls.

thanks,
Marton