OSDN Git Service

Allow a GLThread to release and reacquire the EGL Surface as needed.
authorJack Palevich <jackpal@google.com>
Sun, 8 Nov 2009 02:55:56 +0000 (10:55 +0800)
committerJack Palevich <jackpal@google.com>
Sun, 8 Nov 2009 02:55:56 +0000 (10:55 +0800)
commit32d416518473f3bf5323d660e5910ca5633ffed6
tree91f2387a92133132b0faf49989245c5ca5709291
parenta44249500f6c1c7a75b5c420fa2e81c2aa317a10
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.
opengl/java/android/opengl/GLSurfaceView.java