I’m using the GraphicBuffer from the private Api to update textures.
uint8_t *ptr;
sp<GraphicBuffer> gBuffer = new GraphicBuffer(width,height,format,usage);
gBuffer->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&ptr));
//Copy Data
gBuffer->unlock();
EGLClient clientBuffer = (EGLClientBuffer)gBuffer->getNativeBuffer();
EGLImageKHR img = eglCreateImageKHR(eglGetDisplay(EGL_DEFAULT_DISPLAY), EGL_NO_CONTEXT, EGL_NATIVE_BUFFER_ANDROID,clientBuffer, NULL);
glBindTexture(GL_TEXTURE_EXTERNAL_OES, textureHandle);
glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, (GLeglImageOES)img);
Everything is fine here except when I want to update the texture using the created graphicbuffer:
uint8_t *ptr;
gBuffer->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&ptr));
//Copy Data
gBuffer->unlock();
The second time I try to update I get an error:
E/gralloc ( 1418): GetBufferLock timed out for thread 1472 buffer 0xea usage 0x33 LockState 1
The above code is only failing on tegra 3 devices. It works great in adreno or mali.
More info:
http://malideveloper.arm.com/downloads/deved/tutorial/SDK/android/egl_image.html
http://snorp.net/2011/12/16/android-direct-texture.html
I would appreciate any help. Thanks.