-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I have an application that uses EGL. It creates an EGLSurface in the
normal manner, draws on it, etc. Then the user presses the HOME button.

The EGL spec says this:

>     Following a power management event, calls to eglSwapBuffers, eglCopy-
> Buffers, or eglMakeCurrent will indicate failure by returning EGL FALSE. The
> error EGL CONTEXT LOST will be returned if a power management event has oc-
> curred.
>     On detection of this error, the application must destroy all contexts (by 
> calling
> eglDestroyContext for each context). To continue rendering the application 
> must
> recreate any contexts it requires, and subsequently restore any client API 
> state and
> objects it wishes to use.
>     Any EGLSurfaces that the application has created need not be destroyed
> following a power management event, but their contents will be invalid.

I would expect that my app detaching from the screen to be considered
this sort of power management event.

However, Android doesn't do this. Instead what happens is that it calls
my SurfaceHolder.Callback.surfaceDestroyed() method and then nukes the
surface without telling me. The Android docs say this:

> This is called immediately before a surface is being destroyed. After
> returning from this call, you should no longer try to access this
> surface. If you have a rendering thread that directly accesses the
> surface, you must ensure that thread is no longer touching the Surface
> before returning from this function.

It doesn't explicitly mention what happens to the EGLSurface attached to
the Surface that's been destroyed, but it appears to stop working ---
I've certainly spotted calls to eglSwapBuffers() just hang, with these
messages being produced:

W/SurfaceComposerClient(  297): lock_layer timed out (is the CPU
pegged?) layer=2, lcblk=0x4235c120, state=00000043 (was 00000043)

This is a big problem for me. My (third party, can't change) renderer
ist rendering in a different thread, and is expecting EGL to behave
according to the spec; that is, that the EGLSurface survives being
disconnected from the screen. Android's insistence on asynchronously
destroying it and leaving behind a bogus pointer is not useful.

Is there any way of getting Android to behave in a more
standards-compliant manner, and not destroy (or invalidate) the EGLSurface?

- --
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│
│ "Sufficiently advanced incompetence is indistinguishable from
│ malice." -- Vernon Schryver
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAksFgyMACgkQf9E0noFvlzh94wCfSepclO6XaZpA/umeMqVlrgRZ
WokAoISSm2F51G0sT07W5EQh4wsJE9Pa
=ur5V
-----END PGP SIGNATURE-----

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to