first step for fixing [2066786] EGL object lifetime management doesn't respect the EGL spec
first step for fixing [2066786] EGL object lifetime management doesn't respect the EGL spec

this change fixes the lifetime mgt of EGLSurface, EGLContext and EGLImageKHR in the EGL wrapper.
EGLDisplay is still somewhat bogus and libagl's EGL is still incorrect.

The idea of the change is that EGL objects are put in a list when created and removed when destroyed.
Before each use, we first verify if the object is in the list and if so a reference is taken and kept
for the scope of the whole EGL API being called, if not, an error is returned.

Upon object destruction, the object is simply marked as "terminated" (this is not protected by a lock
because it doesn't really matter). This flag is only used to deny access to the object by other APIs
while it's still valid (for instance current or being used by another function in another thread).
A reference is also removed and the object can then actually be destroyed when going out of scope.

xorware/android_frameworks_base,xorware/android_frameworks_base,xorware/android_frameworks_base,xorware/android_frameworks_base,xorware/android_frameworks_base,xorware/android_frameworks_base