= How Android is using Gralloc =
== EGLSurface, ANativeWindow, etc. ==
'''EGLSurface''' is a portable EGL abstraction for a possibly multi-buffered render target.
'''ANativeWindow''' is the Android-specific abstraction for a possibly multi-buffered render target. The eglCreateWindowSurface function allows to create an EGLSurface from an ANativeWindow. There are two concrete implementations of ANativeWindow in Android: '''FramebufferNativeWindow''' and '''SurfaceTextureClient'''.
EGLSurface
^ EGL world
| opaque handles
|
----------------------------+---------------------------------------
|
| Android world
C++ classes
ANativeWindow
=============
abstract base class
/ \
/ \
/ \
FramebufferNativeWindow SurfaceTextureClient
======================= ====================
Directly linked to fbdev What everybody uses
Only 1 instance system-wide
While ANativeWindow abstracts a possibly multi-buffered render target, the individual buffers managed by ANativeWindow are instances of '''ANativeWindowBuffer'''.
The concrete implementation of ANativeWindowBuffer is '''GraphicBuffer''', the class discussed above in this document.
== SurfaceTexture ==