rework how our EGL wrapper manages EGLConfig:
- we now store the EGLConfig with the EGLSurface and EGLContext
so that we can have easy access to it from eglQueryContext
and eglQuerySurface.
- EGLConfig now are an index into a sorted table of egl_config_t,
we use a binary search to retrieve our EGLConfig (the index) from
the implementation's EGLConfig.
- egl_config_t keeps track of the implementation's index,
EGLConfig and CONFIG_ID as well as our CONFIG_ID.
In many ways, this implementation is simpler and more robust, as it doesn't
assume anything about the number of implementations nor what EGLConfig is
made of (the previous code assumed EGLConfig didn't usem more than 24-bits).
Change-Id: Id5abe923aacb6e1fd2b63bd8c15d7b04ae824922
the EGL specification states that this should be treated as though it was
an empty list terminated with EGL_NONE.
Change-Id: I294104370a86b5e5c34c7bcf15c5459eab464631
Previously we imlpemented the standard semantics for
eglInitialize / eglTerminate, which are that
eglInitialize may be called any number of times,
but the first call to eglTerminate will terminate
the display.
Now we follow reference-countins semantics, which
means that eglTerminate will only terminate the
display when the reference count returns to zero.
This change allows EGL to be used by multiple
independently written modules in the same process.
(Otherwise there is no way for the independent
modules to coordinate their use of the display.)
add a way to convert a mapped "pushbuffer" buffer to a gralloc handle
which then can be safely used by surfaceflinger, without including
gralloc_priv.h
Instead of using a different function pointer table for ES 1.x and ES 2.x,
we use a single one that is the union (sort|uniq) of both tables. Two
instances of this table are initialized with pointers to GL ES 1.x and GL ES 2.x
entry-points.
When a context is created, we store its version number and when it is bound to a
thread we set the approruiate table based on the stored version.
This introduce no penalty while dispatching gl calls to the right API version.
[Pending Dr No approval for MR1]
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.
refactored the code so that:
- EGL APIs that can be called before or after eglInitialize() will work by loading the drivers first
- make eglGetDisplay() a lot more efficient
- make sure that EGL drivers are loaded in a thread-safe way
- don't unload the drivers upon calling eglTerminate(), they're now never unloaded, since there is no safe way to do it (some thread could be running)
- updated our EGL version to 1.4
- return better error codes if errors happen during initialization
Merge commit '46e28db8818332e3cda4cc410cc89a1ed7ce4db6'
* commit '46e28db8818332e3cda4cc410cc89a1ed7ce4db6':
fix for [1969185] valgrind errors in new gl stuff
we now look for a config file in /system/lib/egl/egl.cfg that describes the association of a display to a driver.
these drivers are named: /system/lib/egl/lib{[EGL|GLESv1_CM|GLESv2] | GLES}_$TAG.so
ANDROID_swap_rectangle allows to specify the rectangle affected by eglSwapBuffers(), anything outside of this rectangle is unchanged. in particular EGL_BUFFER_DESTROYED only applies to that rectangle. This extension as well as EGL_BUFFER_PRESERVED allow major optimizations on surfaceflinger, which can redraw only the dirty area during compositing.
However, ANDROID_swap_rectangle allows further optimizations in EGL by reducing the amount of copy-back needed. ANDROID_swap_rectangle is particularily important for software implementations.