Allow a GLThread to release and reacquire the EGL Surface as needed.
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.
1 file changed