Changes

Jump to: navigation, search

Platform/GFX/Gralloc

271 bytes added, 07:29, 20 May 2013
SurfaceTexture
SurfaceTexture is a client-server architecture. The SurfaceTextureClient implements EGLNativeWindow, into which the application renders. When the Android hardware UI is used, the SurfaceTextureClient is bound into a EGLSurface, and when the application wants to present the buffer, it calls eglSwapBuffers which calls to EGLNativeWindow::queue and EGLNativeWindow::dequeue.
SurfaceTexture has a buffer queue SurfaceTexture::mSlots to store a list of GraphicBuffers owned by this is the server-side class. SurfaceTextureClient is the client-side cache the shared class. Both store an array of GraphicBuffers , called mSlots. The GraphicBuffer objects are separate instances in its own mSlots once SurfaceTexture and in SurfaceTextureClient, but the underlying gralloc buffer allocatedhandles are the same. The mechenism mechanism here is the client side issues a SurfaceTextureClient::dequeueBuffer for call to get a new buffer, if to paint to. If there are no not already enough buffer buffers, and the buffer amount number of buffers is not over the limit(32), it cause sends an IPC message that results in a call to SurfaceTexture::dequeueBuffer occurs which allocate allocates the GraphicBuffer. And after buffer allocation, the client side will issue send an IPC message that results in a call to SurfaceTexture::requestBuffer to get the gralloc buffer handle serialized over IPC back to it, and construct a reference to the GraphicBuffer just allocatedaround this handle, and cache the buffer it into its own mSlots. Then SurfaceTexture The mSlots arrays on both sides mirror each other, so that the two sides can communicate with the buffer refer to GraphicBuffers by index rather then the GraphicBuffer.
When the client side calls EGLNativeWindow::queue to present the frame from eglSwapBuffers call, SurfaceTextureClient::queue is issued and send the index where the rendered buffer is to server side SurfaceTexture::queue. Which cause the index queued into SurfaceTexture::mQueue for rendering. SurfaceTexture::mQueue is a wait queue for frame that wants to be rendered. In sync mode, the frame are showed one after another, but may dropped in async mode.
Confirm
753
edits

Navigation menu