I wrote a sample Opengl-ES application running on Mali-400 GPU.
When I run first time then it runs fine.
If I exit the application and re-launch it, then eglInitialize fails with error eglGetError(): 12291
In my code I made sure that I cleaned up all the resources.
Below is the sequence of calls my application makes. I destroyed the context, surface and display . Did un-mapping. closed the device and exited the app gracefully.
What could be the reason for eglInitialize to fail?
eglGetDisplay
eglInitialize
eglCreateWindowSurface
eglCreateContext
open /dev/dri/card0
mmap
eglCreateImageKHR
glEGLImageTargetTexture2DOES
eglDestroyImageKHR
munmap
close /dev/dri/card0
eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
eglDestroyContext(display, context);
eglDestroySurface(display, surface);
eglTerminate(display);
Note: If I don't do mmap and munmap then there is no issue. But I need to do mmap and munmap for zero copy operation. I also checked that munmap was successful.