EGL10.EGL_NO_XXX objects for displays, surfaces, and contexts.
This allows clients to compare the returned object against
the public EGL10.EGL_NO_XXX object using a simple == operation.
This fixes bug 2303947 "Java layer EGL API makes it difficult
to tell when certain methods have failed"
Merge commit 'ca00dee21425882619aef4ecbe3e0d08de0544e5' into eclair-mr2
* commit 'ca00dee21425882619aef4ecbe3e0d08de0544e5':
Improve the exception message text by including eglGetError().
+ The mDone flag is now a pair of flags: mShouldExit and mExited. The
problem with mDone was that it meant "had been asked to exit", but was
being used by some observers as "had exited". Using two variables means
that observers can observe either "had been asked to exit" or "had exited",
as they prefer.
+ Simplyify where we check for mShouldExit. We now check for it at the
top of our innermost guardedRun while loop.
+ requestExitAndWait now waits for mExited to be set to true to know
that a thread has exited, rather than using join(). This means we can use
wait() for the check, which releases the sGLThreadManager
monitor, avoiding a potential deadlock.
+ move the event queue into the sGLThreadManager monitor. This avoids
having to acquire two locks in order to enque/deque events, which also
avoids the potential for lock ordering deadlocks.
+ Simplify the event dequeueing code. We now deque one event each time
through the main GLSurfaceView loop. Events still have priority over
rendering, so there isn't any semantic change, it just cleans up the code.
+ Avoid trying to acquire an egl Surface if we're paused.
+ To simplify reasoning about the code, call sGLThreadManager.notifyAll()
in every case where we modify one of the variables that's protected by
the sGLThreadManager monitor. It would be slightly more efficient to only
notify when we change variables that could cause a thread to wait(), but
then we would have to redo our analysis every time we change any code.
+ Clean up the logic for creating the EGL surface and then calling the
renderer's onSurfaceCreated / onSurfaceChanged methods.
+ Implement work-around for bug 2263168 "Need to draw twice after
screen rotation..."
Merge commit '274072089ceff6eacb9ccfb59290a18f43739c87' into eclair-mr2
* commit '274072089ceff6eacb9ccfb59290a18f43739c87':
fix [2236865] STOPSHIP: bump soft gl and egl minor version number
There were potential deadlocks between the per-GLThread monitors and the
GLThreadManager monitor.
To avoid these deadlocks we now use a single monitor for
both the GLThreadManager state and the per-GLThread state.
Converted GLThreadManager's semaphore into the equivalent
synchronized-wait-notifyAll code. This enables us to wait for
either mDone, or user events, or the EGL surface with a single "wait()".
Simplified the logic used to acquire and release the EGL surface. The
EGL surface is now only requested while the surfaceFlinger surface
is acquired.
Removed the "egl surface stealing" policy we had recently inserted.
It's not needed now that we reliably quit when requested.
Pulled user event processing outside of the GLThreadManager monitor
so that we don't call any potentially-long-running code while
inside the monitor.
This should help with bug 2228262.
We currently only allow one GLThread to have an active EGL Surface at a
time.(This may be lifted in the future, when EGL and GL are reentrant.)
Prior to this change we would enforce this rule by having older GLThreads
quit when a new GLThread started. That had the drawback of leaving the
older GLSurfaceViews in a zombie state -- their GLThreads would be
gone.
We now enforce this rule by just releasing and reacquiring the EGL surface
context as needed.
Specific changes to the code:
created private helper methods - startEgl and stopEgl to help manage
starting and stopping EGL.
Move the calls to sGLThreadManager start and end from the outermost run
method into the startEgl / stopEgl methods.
Reworked the wait loop to handle starting and stopping EGL as needed.
needToWait() gets simpler -- just looks at current status.
sGLThreadManager.shouldQuit was replaced by shouldHaveEgl.
This is another step in fixing bug 2228262.
The code intended to copy the old value of a field, before the
field was updated. However, what the code was actually doing was
copying the new value of the field, after the field was updated.
The fix was to move the copy to before the update.
This is work towards fixing bug 2228262
This is work towards fixing bug 2228262
Specific issues fixed by this change:
+ GLThread names now include the thread id, making it easier to tell one
GLThread from another.
+ A private final static boolean LOG_THREADS can be set to true at compile
time to print out thread-related trace information, helpful for debugging
GLSurfaceView behavior. This static defaults to "false".
+ Changed calls to "notify" to "notifyAll" to make the code more
robust in case more than two threads are blocked on the same monitor.
+ Add a GLThreadManager to help manage the transition to
a new GLThread. Currently only one GLThread can be active in an address
space. When the second thread starts up, the GLThreadManager helps the old
GLThread to shut down,
+ Make sure we stop waiting for dead GLThreads. This is done by adding
checks for a variable mDone being true to our monitor wait loops. And
we use a "finally" clause at the end of GLThread.run() method to set mDone
and notifyAll any wait loops.
Merge commit '36fe3eeaa056ff13455c0df73b495b2bae8c1469' into eclair-mr2
* commit '36fe3eeaa056ff13455c0df73b495b2bae8c1469':
part of fix [2186418] switch passion to 24-bits framebuffer
Merge commit '9a54d7dddcbc982d644c627693dc39fb2cb5c0fb' into eclair-mr2
* commit '9a54d7dddcbc982d644c627693dc39fb2cb5c0fb':
fix [2236832] software OpenGL ES driver doesn't work on sholes
Merge commit '21977eb0f1d22497d0beed0492e579f953a56552' into eclair-mr2
* commit '21977eb0f1d22497d0beed0492e579f953a56552':
fix [2231527] Compatibility with SpaceJunk game (OpenGL)
Merge commit '8637759a1d34a4adda292579d5f8790587659235' into eclair-mr2
* commit '8637759a1d34a4adda292579d5f8790587659235':
fix[2228133] pixelflinger ignores the "vertical stride" leading to artifacts when playing back video
we lost the concept of vertical stride when moving video playback to EGLImage.
Here we bring it back in a somewhat hacky-way that will work only for the
softgl/mdp backend.
Merge commit '77bd91f8af44867935ea2df22f69fb244b009b94' into eclair-mr2
* commit '77bd91f8af44867935ea2df22f69fb244b009b94':
Turns out the SGX driver is correct and the bug was in this test.
Merge commit 'd01767f8b7038108f9125cd2122b117db9919824' into eclair-mr2
* commit 'd01767f8b7038108f9125cd2122b117db9919824':
fix[2222341] Soft reset while going back from camcorder settings
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
Merge commit '5dc7a21cbbd4af908e39e55e5ca7ab14cda25d4a' into eclair-mr2
* commit '5dc7a21cbbd4af908e39e55e5ca7ab14cda25d4a':
update line test to expose some bug on SGX530 ed4
Merge commit '7bde36e64e66c81f0150d0372e1357a31f4ec704' into eclair-mr2
* commit '7bde36e64e66c81f0150d0372e1357a31f4ec704':
added GL test for textured lines
Merge commit '73e17015d3cd67c93ccad5d63d31c439ff6fa694' into eclair-mr2
* commit '73e17015d3cd67c93ccad5d63d31c439ff6fa694':
fix [2143798] Need to figure out how to do video