18ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis/* 28ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis * Copyright (C) 2010 The Android Open Source Project 38ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis * 48ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis * Licensed under the Apache License, Version 2.0 (the "License"); 58ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis * you may not use this file except in compliance with the License. 68ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis * You may obtain a copy of the License at 78ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis * 88ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis * http://www.apache.org/licenses/LICENSE-2.0 98ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis * 108ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis * Unless required by applicable law or agreed to in writing, software 118ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis * distributed under the License is distributed on an "AS IS" BASIS, 128ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 138ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis * See the License for the specific language governing permissions and 148ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis * limitations under the License. 158ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis */ 168ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis 178ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis#ifndef ANDROID_GUI_SURFACETEXTURE_H 188ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis#define ANDROID_GUI_SURFACETEXTURE_H 198ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis 208ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis#include <EGL/egl.h> 218ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis#include <EGL/eglext.h> 228ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis#include <GLES2/gl2.h> 23fb1b5a2f333800574b0da435d1200cf9b13d723fJamie Gennis#include <GLES2/gl2ext.h> 248ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis 258ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis#include <gui/ISurfaceTexture.h> 266b091c53000c843211c218ce40287a7edca9bc63Daniel Lam#include <gui/BufferQueue.h> 279fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis#include <gui/ConsumerBase.h> 288ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis 298ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis#include <ui/GraphicBuffer.h> 308ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis 31fa28c35c21d1bf8b38f541758c291bc17a2d7270Jamie Gennis#include <utils/String8.h> 329a78c90cd46b2a3bd637b056873149d3b94384b4Jamie Gennis#include <utils/Vector.h> 33fa28c35c21d1bf8b38f541758c291bc17a2d7270Jamie Gennis#include <utils/threads.h> 348ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis 358ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis#define ANDROID_GRAPHICS_SURFACETEXTURE_JNI_ID "mSurfaceTexture" 368ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis 378ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennisnamespace android { 388ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis// ---------------------------------------------------------------------------- 398ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis 406b091c53000c843211c218ce40287a7edca9bc63Daniel Lam 4168c7794183a7dbfe3b20d4ce832f8eb79c2c619aMathias Agopianclass String8; 429a78c90cd46b2a3bd637b056873149d3b94384b4Jamie Gennis 439fea3421ffddf6480f57f55a25936a886043d909Jamie Gennisclass SurfaceTexture : public ConsumerBase { 448ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennispublic: 459fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis typedef ConsumerBase::FrameAvailableListener FrameAvailableListener; 46c4d4aeab52435c177ded6abdd578fec8191f0f5dJamie Gennis 4786edf4f6470ee0f108bf40d3c1d23bf0a78c9c38Jamie Gennis // SurfaceTexture constructs a new SurfaceTexture object. tex indicates the 4874bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // name of the OpenGL ES texture to which images are to be streamed. 4986edf4f6470ee0f108bf40d3c1d23bf0a78c9c38Jamie Gennis // allowSynchronousMode specifies whether or not synchronous mode can be 5086edf4f6470ee0f108bf40d3c1d23bf0a78c9c38Jamie Gennis // enabled. texTarget specifies the OpenGL ES texture target to which the 5186edf4f6470ee0f108bf40d3c1d23bf0a78c9c38Jamie Gennis // texture will be bound in updateTexImage. useFenceSync specifies whether 5286edf4f6470ee0f108bf40d3c1d23bf0a78c9c38Jamie Gennis // fences should be used to synchronize access to buffers if that behavior 53b267579ba8dfe3f47d2a481c5a3c2254e3d565a1Daniel Lam // is enabled at compile-time. A custom bufferQueue can be specified 54b267579ba8dfe3f47d2a481c5a3c2254e3d565a1Daniel Lam // if behavior for queue/dequeue/connect etc needs to be customized. 55b267579ba8dfe3f47d2a481c5a3c2254e3d565a1Daniel Lam // Otherwise a default BufferQueue will be created and used. 5674bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // 5774bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // For legacy reasons, the SurfaceTexture is created in a state where it is 5874bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // considered attached to an OpenGL ES context for the purposes of the 5974bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // attachToContext and detachFromContext methods. However, despite being 6074bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // considered "attached" to a context, the specific OpenGL ES context 6174bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // doesn't get latched until the first call to updateTexImage. After that 6274bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // point, all calls to updateTexImage must be made with the same OpenGL ES 6374bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // context current. 6474bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // 6574bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // A SurfaceTexture may be detached from one OpenGL ES context and then 6674bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // attached to a different context using the detachFromContext and 6774bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // attachToContext methods, respectively. The intention of these methods is 6874bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // purely to allow a SurfaceTexture to be transferred from one consumer 6974bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // context to another. If such a transfer is not needed there is no 7074bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // requirement that either of these methods be called. 71fb1b5a2f333800574b0da435d1200cf9b13d723fJamie Gennis SurfaceTexture(GLuint tex, bool allowSynchronousMode = true, 72b267579ba8dfe3f47d2a481c5a3c2254e3d565a1Daniel Lam GLenum texTarget = GL_TEXTURE_EXTERNAL_OES, bool useFenceSync = true, 73b267579ba8dfe3f47d2a481c5a3c2254e3d565a1Daniel Lam const sp<BufferQueue> &bufferQueue = 0); 748ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis 758ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis // updateTexImage sets the image contents of the target texture to that of 768ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis // the most recently queued buffer. 778ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis // 788ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis // This call may only be made while the OpenGL ES context to which the 798ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis // target texture belongs is bound to the calling thread. 8061e04b92bdeafc6fca89052d14dab1bd0c384a71Jamie Gennis // 8161e04b92bdeafc6fca89052d14dab1bd0c384a71Jamie Gennis // After calling this method the doGLFenceWait method must be called 8261e04b92bdeafc6fca89052d14dab1bd0c384a71Jamie Gennis // before issuing OpenGL ES commands that access the texture contents. 838ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis status_t updateTexImage(); 848ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis 85ef19414bd8b77a26f5751f3845be79025a8263feJesse Hall // setReleaseFence stores a fence file descriptor that will signal when the 86ef19414bd8b77a26f5751f3845be79025a8263feJesse Hall // current buffer is no longer being read. This fence will be returned to 87ef19414bd8b77a26f5751f3845be79025a8263feJesse Hall // the producer when the current buffer is released by updateTexImage(). 88ef19414bd8b77a26f5751f3845be79025a8263feJesse Hall // Multiple fences can be set for a given buffer; they will be merged into 89ef19414bd8b77a26f5751f3845be79025a8263feJesse Hall // a single union fence. The SurfaceTexture will close the file descriptor 90ef19414bd8b77a26f5751f3845be79025a8263feJesse Hall // when finished with it. 91ef19414bd8b77a26f5751f3845be79025a8263feJesse Hall void setReleaseFence(int fenceFd); 92ef19414bd8b77a26f5751f3845be79025a8263feJesse Hall 9331a353da225af5329735451c761b430d82dfda1bJamie Gennis // setDefaultMaxBufferCount sets the default limit on the maximum number 9431a353da225af5329735451c761b430d82dfda1bJamie Gennis // of buffers that will be allocated at one time. The image producer may 9531a353da225af5329735451c761b430d82dfda1bJamie Gennis // override the limit. 9631a353da225af5329735451c761b430d82dfda1bJamie Gennis status_t setDefaultMaxBufferCount(int bufferCount); 978072711307aa98ee5ee6f7369860ae38c3e19656Mathias Agopian 98f238e28500ca756fbd9e323f728ce7c8dda59475Jamie Gennis // getTransformMatrix retrieves the 4x4 texture coordinate transform matrix 99f238e28500ca756fbd9e323f728ce7c8dda59475Jamie Gennis // associated with the texture image set by the most recent call to 100f238e28500ca756fbd9e323f728ce7c8dda59475Jamie Gennis // updateTexImage. 101f238e28500ca756fbd9e323f728ce7c8dda59475Jamie Gennis // 102f238e28500ca756fbd9e323f728ce7c8dda59475Jamie Gennis // This transform matrix maps 2D homogeneous texture coordinates of the form 103f238e28500ca756fbd9e323f728ce7c8dda59475Jamie Gennis // (s, t, 0, 1) with s and t in the inclusive range [0, 1] to the texture 104f238e28500ca756fbd9e323f728ce7c8dda59475Jamie Gennis // coordinate that should be used to sample that location from the texture. 105f238e28500ca756fbd9e323f728ce7c8dda59475Jamie Gennis // Sampling the texture outside of the range of this transform is undefined. 106f238e28500ca756fbd9e323f728ce7c8dda59475Jamie Gennis // 107f238e28500ca756fbd9e323f728ce7c8dda59475Jamie Gennis // This transform is necessary to compensate for transforms that the stream 108f238e28500ca756fbd9e323f728ce7c8dda59475Jamie Gennis // content producer may implicitly apply to the content. By forcing users of 109f238e28500ca756fbd9e323f728ce7c8dda59475Jamie Gennis // a SurfaceTexture to apply this transform we avoid performing an extra 110f238e28500ca756fbd9e323f728ce7c8dda59475Jamie Gennis // copy of the data that would be needed to hide the transform from the 111f238e28500ca756fbd9e323f728ce7c8dda59475Jamie Gennis // user. 112f238e28500ca756fbd9e323f728ce7c8dda59475Jamie Gennis // 113f238e28500ca756fbd9e323f728ce7c8dda59475Jamie Gennis // The matrix is stored in column-major order so that it may be passed 114f238e28500ca756fbd9e323f728ce7c8dda59475Jamie Gennis // directly to OpenGL ES via the glLoadMatrixf or glUniformMatrix4fv 115f238e28500ca756fbd9e323f728ce7c8dda59475Jamie Gennis // functions. 116f238e28500ca756fbd9e323f728ce7c8dda59475Jamie Gennis void getTransformMatrix(float mtx[16]); 117f238e28500ca756fbd9e323f728ce7c8dda59475Jamie Gennis 1181d01a12e7150be569557b64da9b8663c62c13594Eino-Ville Talvala // getTimestamp retrieves the timestamp associated with the texture image 1191d01a12e7150be569557b64da9b8663c62c13594Eino-Ville Talvala // set by the most recent call to updateTexImage. 1201d01a12e7150be569557b64da9b8663c62c13594Eino-Ville Talvala // 1211d01a12e7150be569557b64da9b8663c62c13594Eino-Ville Talvala // The timestamp is in nanoseconds, and is monotonically increasing. Its 1221d01a12e7150be569557b64da9b8663c62c13594Eino-Ville Talvala // other semantics (zero point, etc) are source-dependent and should be 1231d01a12e7150be569557b64da9b8663c62c13594Eino-Ville Talvala // documented by the source. 1241d01a12e7150be569557b64da9b8663c62c13594Eino-Ville Talvala int64_t getTimestamp(); 1251d01a12e7150be569557b64da9b8663c62c13594Eino-Ville Talvala 126a5c75c01620179ce00812354778a29a80d76e71fMathias Agopian // setDefaultBufferSize is used to set the size of buffers returned by 127a5c75c01620179ce00812354778a29a80d76e71fMathias Agopian // requestBuffers when a with and height of zero is requested. 128a5c75c01620179ce00812354778a29a80d76e71fMathias Agopian // A call to setDefaultBufferSize() may trigger requestBuffers() to 129a5c75c01620179ce00812354778a29a80d76e71fMathias Agopian // be called from the client. 130194c76c0477189700fda068e19b953b1d9af201aMathias Agopian // The width and height parameters must be no greater than the minimum of 131194c76c0477189700fda068e19b953b1d9af201aMathias Agopian // GL_MAX_VIEWPORT_DIMS and GL_MAX_TEXTURE_SIZE (see: glGetIntegerv). 132194c76c0477189700fda068e19b953b1d9af201aMathias Agopian // An error due to invalid dimensions might not be reported until 133194c76c0477189700fda068e19b953b1d9af201aMathias Agopian // updateTexImage() is called. 134194c76c0477189700fda068e19b953b1d9af201aMathias Agopian status_t setDefaultBufferSize(uint32_t width, uint32_t height); 135a5c75c01620179ce00812354778a29a80d76e71fMathias Agopian 1365c1139fea3cc0fd9847a6594d853a458152b2fbcJamie Gennis // setFilteringEnabled sets whether the transform matrix should be computed 1375c1139fea3cc0fd9847a6594d853a458152b2fbcJamie Gennis // for use with bilinear filtering. 1385c1139fea3cc0fd9847a6594d853a458152b2fbcJamie Gennis void setFilteringEnabled(bool enabled); 1395c1139fea3cc0fd9847a6594d853a458152b2fbcJamie Gennis 1407a042bf324fe3f3d5d4085fda21fe50dc0c362b4Mathias Agopian // getCurrentBuffer returns the buffer associated with the current image. 1417a042bf324fe3f3d5d4085fda21fe50dc0c362b4Mathias Agopian sp<GraphicBuffer> getCurrentBuffer() const; 1427a042bf324fe3f3d5d4085fda21fe50dc0c362b4Mathias Agopian 1437a042bf324fe3f3d5d4085fda21fe50dc0c362b4Mathias Agopian // getCurrentTextureTarget returns the texture target of the current 1447a042bf324fe3f3d5d4085fda21fe50dc0c362b4Mathias Agopian // texture as returned by updateTexImage(). 1457a042bf324fe3f3d5d4085fda21fe50dc0c362b4Mathias Agopian GLenum getCurrentTextureTarget() const; 1467a042bf324fe3f3d5d4085fda21fe50dc0c362b4Mathias Agopian 147efc7ab6dcea8c22ddd7c0259ef4ab4bbf1e93044Jamie Gennis // getCurrentCrop returns the cropping rectangle of the current buffer. 1487a042bf324fe3f3d5d4085fda21fe50dc0c362b4Mathias Agopian Rect getCurrentCrop() const; 1497a042bf324fe3f3d5d4085fda21fe50dc0c362b4Mathias Agopian 150efc7ab6dcea8c22ddd7c0259ef4ab4bbf1e93044Jamie Gennis // getCurrentTransform returns the transform of the current buffer. 1517a042bf324fe3f3d5d4085fda21fe50dc0c362b4Mathias Agopian uint32_t getCurrentTransform() const; 1527a042bf324fe3f3d5d4085fda21fe50dc0c362b4Mathias Agopian 153efc7ab6dcea8c22ddd7c0259ef4ab4bbf1e93044Jamie Gennis // getCurrentScalingMode returns the scaling mode of the current buffer. 1547734ebfe47f42f980c1b44c1f284a91d8ad1d6c7Mathias Agopian uint32_t getCurrentScalingMode() const; 1557734ebfe47f42f980c1b44c1f284a91d8ad1d6c7Mathias Agopian 156dc5b485f74edf2d2f31c62054eb6c180421a3adeJesse Hall // getCurrentFence returns the fence indicating when the current buffer is 157dc5b485f74edf2d2f31c62054eb6c180421a3adeJesse Hall // ready to be read from. 158dc5b485f74edf2d2f31c62054eb6c180421a3adeJesse Hall sp<Fence> getCurrentFence() const; 159dc5b485f74edf2d2f31c62054eb6c180421a3adeJesse Hall 16061e04b92bdeafc6fca89052d14dab1bd0c384a71Jamie Gennis // doGLFenceWait inserts a wait command into the OpenGL ES command stream 16161e04b92bdeafc6fca89052d14dab1bd0c384a71Jamie Gennis // to ensure that it is safe for future OpenGL ES commands to access the 16261e04b92bdeafc6fca89052d14dab1bd0c384a71Jamie Gennis // current texture buffer. This must be called each time updateTexImage 16361e04b92bdeafc6fca89052d14dab1bd0c384a71Jamie Gennis // is called before issuing OpenGL ES commands that access the texture. 16461e04b92bdeafc6fca89052d14dab1bd0c384a71Jamie Gennis status_t doGLFenceWait() const; 16561e04b92bdeafc6fca89052d14dab1bd0c384a71Jamie Gennis 16659769469e4b9b2d8b12c020eb44b030b3927a50bJamie Gennis // isSynchronousMode returns whether the SurfaceTexture is currently in 16759769469e4b9b2d8b12c020eb44b030b3927a50bJamie Gennis // synchronous mode. 16859769469e4b9b2d8b12c020eb44b030b3927a50bJamie Gennis bool isSynchronousMode() const; 16959769469e4b9b2d8b12c020eb44b030b3927a50bJamie Gennis 170fa28c35c21d1bf8b38f541758c291bc17a2d7270Jamie Gennis // set the name of the SurfaceTexture that will be used to identify it in 171fa28c35c21d1bf8b38f541758c291bc17a2d7270Jamie Gennis // log messages. 172fa28c35c21d1bf8b38f541758c291bc17a2d7270Jamie Gennis void setName(const String8& name); 173fa28c35c21d1bf8b38f541758c291bc17a2d7270Jamie Gennis 174b267579ba8dfe3f47d2a481c5a3c2254e3d565a1Daniel Lam // These functions call the corresponding BufferQueue implementation 175b267579ba8dfe3f47d2a481c5a3c2254e3d565a1Daniel Lam // so the refactoring can proceed smoothly 176b267579ba8dfe3f47d2a481c5a3c2254e3d565a1Daniel Lam status_t setDefaultBufferFormat(uint32_t defaultFormat); 177b267579ba8dfe3f47d2a481c5a3c2254e3d565a1Daniel Lam status_t setConsumerUsageBits(uint32_t usage); 178b267579ba8dfe3f47d2a481c5a3c2254e3d565a1Daniel Lam status_t setTransformHint(uint32_t hint); 179b267579ba8dfe3f47d2a481c5a3c2254e3d565a1Daniel Lam virtual status_t setSynchronousMode(bool enabled); 180b267579ba8dfe3f47d2a481c5a3c2254e3d565a1Daniel Lam 18174bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // getBufferQueue returns the BufferQueue object to which this 18274bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // SurfaceTexture is connected. 1839fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis sp<BufferQueue> getBufferQueue() const { 1849fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis return mBufferQueue; 1859fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis } 186b267579ba8dfe3f47d2a481c5a3c2254e3d565a1Daniel Lam 18774bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // detachFromContext detaches the SurfaceTexture from the calling thread's 18874bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // current OpenGL ES context. This context must be the same as the context 18974bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // that was current for previous calls to updateTexImage. 19074bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // 19174bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // Detaching a SurfaceTexture from an OpenGL ES context will result in the 19274bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // deletion of the OpenGL ES texture object into which the images were being 19374bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // streamed. After a SurfaceTexture has been detached from the OpenGL ES 19474bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // context calls to updateTexImage will fail returning INVALID_OPERATION 19574bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // until the SurfaceTexture is attached to a new OpenGL ES context using the 19674bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // attachToContext method. 19774bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis status_t detachFromContext(); 19874bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis 19974bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // attachToContext attaches a SurfaceTexture that is currently in the 20074bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // 'detached' state to the current OpenGL ES context. A SurfaceTexture is 20174bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // in the 'detached' state iff detachFromContext has successfully been 20274bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // called and no calls to attachToContext have succeeded since the last 20374bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // detachFromContext call. Calls to attachToContext made on a 20474bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // SurfaceTexture that is not in the 'detached' state will result in an 20574bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // INVALID_OPERATION error. 20674bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // 20774bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // The tex argument specifies the OpenGL ES texture object name in the 20874bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // new context into which the image contents will be streamed. A successful 20974bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // call to attachToContext will result in this texture object being bound to 21074bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // the texture target and populated with the image contents that were 21174bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // current at the time of the last call to detachFromContext. 21274bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis status_t attachToContext(GLuint tex); 21374bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis 214ce7a6c0fc9d75b80da030d1790321e84475f956aJamie Gennisprotected: 215ed059a8d754770c3cf28b78dba30f7a6ba475dbeJamie Gennis 2169fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis // abandonLocked overrides the ConsumerBase method to clear 2179fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis // mCurrentTextureBuf in addition to the ConsumerBase behavior. 2189fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis virtual void abandonLocked(); 2199fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis 2209fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis // dumpLocked overrides the ConsumerBase method to dump SurfaceTexture- 2219fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis // specific info in addition to the ConsumerBase behavior. 2229fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis virtual void dumpLocked(String8& result, const char* prefix, char* buffer, 2239fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis size_t size) const; 2249fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis 2259fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis // acquireBufferLocked overrides the ConsumerBase method to update the 2269fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis // mEglSlots array in addition to the ConsumerBase behavior. 2279fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis virtual status_t acquireBufferLocked(BufferQueue::BufferItem *item); 2289fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis 2299fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis // releaseBufferLocked overrides the ConsumerBase method to update the 2309fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis // mEglSlots array in addition to the ConsumerBase. 2319fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis virtual status_t releaseBufferLocked(int buf, EGLDisplay display, 232b27254154642575dfb4bbfa79fbedde7d7ee23ddJamie Gennis EGLSyncKHR eglFence); 233fa5b40ebb8923133df12dc70591bfe35b3f1c9b3Jamie Gennis 2347a042bf324fe3f3d5d4085fda21fe50dc0c362b4Mathias Agopian static bool isExternalFormat(uint32_t format); 2357a042bf324fe3f3d5d4085fda21fe50dc0c362b4Mathias Agopian 2367a042bf324fe3f3d5d4085fda21fe50dc0c362b4Mathias Agopianprivate: 2372c8207e9627fe6c7a90e31fae8d71ae49df56845Mathias Agopian // this version of updateTexImage() takes a functor used to reject or not 2382c8207e9627fe6c7a90e31fae8d71ae49df56845Mathias Agopian // the newly acquired buffer. 2392c8207e9627fe6c7a90e31fae8d71ae49df56845Mathias Agopian // this API is TEMPORARY and intended to be used by SurfaceFlinger only, 2402c8207e9627fe6c7a90e31fae8d71ae49df56845Mathias Agopian // which is why class Layer is made a friend of SurfaceTexture below. 2412c8207e9627fe6c7a90e31fae8d71ae49df56845Mathias Agopian class BufferRejecter { 2422c8207e9627fe6c7a90e31fae8d71ae49df56845Mathias Agopian friend class SurfaceTexture; 2432c8207e9627fe6c7a90e31fae8d71ae49df56845Mathias Agopian virtual bool reject(const sp<GraphicBuffer>& buf, 2442c8207e9627fe6c7a90e31fae8d71ae49df56845Mathias Agopian const BufferQueue::BufferItem& item) = 0; 2452c8207e9627fe6c7a90e31fae8d71ae49df56845Mathias Agopian protected: 2462c8207e9627fe6c7a90e31fae8d71ae49df56845Mathias Agopian virtual ~BufferRejecter() { } 2472c8207e9627fe6c7a90e31fae8d71ae49df56845Mathias Agopian }; 2482c8207e9627fe6c7a90e31fae8d71ae49df56845Mathias Agopian friend class Layer; 2493941cb240d438bfdebe24920bb2ada86456a0bf9Jamie Gennis status_t updateTexImage(BufferRejecter* rejecter, bool skipSync); 2508ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis 2518ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis // createImage creates a new EGLImage from a GraphicBuffer. 2528ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis EGLImageKHR createImage(EGLDisplay dpy, 2538ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis const sp<GraphicBuffer>& graphicBuffer); 2548ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis 255fa5b40ebb8923133df12dc70591bfe35b3f1c9b3Jamie Gennis // freeBufferLocked frees up the given buffer slot. If the slot has been 256fa5b40ebb8923133df12dc70591bfe35b3f1c9b3Jamie Gennis // initialized this will release the reference to the GraphicBuffer in that 257fa5b40ebb8923133df12dc70591bfe35b3f1c9b3Jamie Gennis // slot and destroy the EGLImage in that slot. Otherwise it has no effect. 258fa5b40ebb8923133df12dc70591bfe35b3f1c9b3Jamie Gennis // 259fa5b40ebb8923133df12dc70591bfe35b3f1c9b3Jamie Gennis // This method must be called with mMutex locked. 2609fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis virtual void freeBufferLocked(int slotIndex); 261fa5b40ebb8923133df12dc70591bfe35b3f1c9b3Jamie Gennis 262e96e9e1093b5700e9f403a6e2479da7dc36d3b71Mathias Agopian // computeCurrentTransformMatrixLocked computes the transform matrix for the 263736aa9573bb7b78f9c315f396c104491b3639426Jamie Gennis // current texture. It uses mCurrentTransform and the current GraphicBuffer 264736aa9573bb7b78f9c315f396c104491b3639426Jamie Gennis // to compute this matrix and stores it in mCurrentTransformMatrix. 265e96e9e1093b5700e9f403a6e2479da7dc36d3b71Mathias Agopian // mCurrentTextureBuf must not be NULL. 266e96e9e1093b5700e9f403a6e2479da7dc36d3b71Mathias Agopian void computeCurrentTransformMatrixLocked(); 267736aa9573bb7b78f9c315f396c104491b3639426Jamie Gennis 2683941cb240d438bfdebe24920bb2ada86456a0bf9Jamie Gennis // doGLFenceWaitLocked inserts a wait command into the OpenGL ES command 2693941cb240d438bfdebe24920bb2ada86456a0bf9Jamie Gennis // stream to ensure that it is safe for future OpenGL ES commands to 2703941cb240d438bfdebe24920bb2ada86456a0bf9Jamie Gennis // access the current texture buffer. This must be called each time 2713941cb240d438bfdebe24920bb2ada86456a0bf9Jamie Gennis // updateTexImage is called before issuing OpenGL ES commands that access 2723941cb240d438bfdebe24920bb2ada86456a0bf9Jamie Gennis // the texture. 2733941cb240d438bfdebe24920bb2ada86456a0bf9Jamie Gennis status_t doGLFenceWaitLocked() const; 2743941cb240d438bfdebe24920bb2ada86456a0bf9Jamie Gennis 27574bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // syncForReleaseLocked performs the synchronization needed to release the 27674bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // current slot from an OpenGL ES context. If needed it will set the 27774bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // current slot's fence to guard against a producer accessing the buffer 27874bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // before the outstanding accesses have completed. 27974bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis status_t syncForReleaseLocked(EGLDisplay dpy); 28074bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis 28185b217668d6840c8e6a109adfb99461313676f8dEino-Ville Talvala // The default consumer usage flags that SurfaceTexture always sets on its 28285b217668d6840c8e6a109adfb99461313676f8dEino-Ville Talvala // BufferQueue instance; these will be OR:d with any additional flags passed 28385b217668d6840c8e6a109adfb99461313676f8dEino-Ville Talvala // from the SurfaceTexture user. In particular, SurfaceTexture will always 28485b217668d6840c8e6a109adfb99461313676f8dEino-Ville Talvala // consume buffers as hardware textures. 28585b217668d6840c8e6a109adfb99461313676f8dEino-Ville Talvala static const uint32_t DEFAULT_USAGE_FLAGS = GraphicBuffer::USAGE_HW_TEXTURE; 28685b217668d6840c8e6a109adfb99461313676f8dEino-Ville Talvala 2879a78c90cd46b2a3bd637b056873149d3b94384b4Jamie Gennis // mCurrentTextureBuf is the graphic buffer of the current texture. It's 2889a78c90cd46b2a3bd637b056873149d3b94384b4Jamie Gennis // possible that this buffer is not associated with any buffer slot, so we 28929c870271e8d3f8c40c356283650ba54fe71a16bJamie Gennis // must track it separately in order to support the getCurrentBuffer method. 2909a78c90cd46b2a3bd637b056873149d3b94384b4Jamie Gennis sp<GraphicBuffer> mCurrentTextureBuf; 2919a78c90cd46b2a3bd637b056873149d3b94384b4Jamie Gennis 292f238e28500ca756fbd9e323f728ce7c8dda59475Jamie Gennis // mCurrentCrop is the crop rectangle that applies to the current texture. 2937734ebfe47f42f980c1b44c1f284a91d8ad1d6c7Mathias Agopian // It gets set each time updateTexImage is called. 294f238e28500ca756fbd9e323f728ce7c8dda59475Jamie Gennis Rect mCurrentCrop; 295f238e28500ca756fbd9e323f728ce7c8dda59475Jamie Gennis 296f238e28500ca756fbd9e323f728ce7c8dda59475Jamie Gennis // mCurrentTransform is the transform identifier for the current texture. It 2977734ebfe47f42f980c1b44c1f284a91d8ad1d6c7Mathias Agopian // gets set each time updateTexImage is called. 298f238e28500ca756fbd9e323f728ce7c8dda59475Jamie Gennis uint32_t mCurrentTransform; 299f238e28500ca756fbd9e323f728ce7c8dda59475Jamie Gennis 3007734ebfe47f42f980c1b44c1f284a91d8ad1d6c7Mathias Agopian // mCurrentScalingMode is the scaling mode for the current texture. It gets 3017734ebfe47f42f980c1b44c1f284a91d8ad1d6c7Mathias Agopian // set to each time updateTexImage is called. 3027734ebfe47f42f980c1b44c1f284a91d8ad1d6c7Mathias Agopian uint32_t mCurrentScalingMode; 3037734ebfe47f42f980c1b44c1f284a91d8ad1d6c7Mathias Agopian 304dc5b485f74edf2d2f31c62054eb6c180421a3adeJesse Hall // mCurrentFence is the fence received from BufferQueue in updateTexImage. 305dc5b485f74edf2d2f31c62054eb6c180421a3adeJesse Hall sp<Fence> mCurrentFence; 306dc5b485f74edf2d2f31c62054eb6c180421a3adeJesse Hall 307736aa9573bb7b78f9c315f396c104491b3639426Jamie Gennis // mCurrentTransformMatrix is the transform matrix for the current texture. 308736aa9573bb7b78f9c315f396c104491b3639426Jamie Gennis // It gets computed by computeTransformMatrix each time updateTexImage is 309736aa9573bb7b78f9c315f396c104491b3639426Jamie Gennis // called. 310736aa9573bb7b78f9c315f396c104491b3639426Jamie Gennis float mCurrentTransformMatrix[16]; 311736aa9573bb7b78f9c315f396c104491b3639426Jamie Gennis 3121d01a12e7150be569557b64da9b8663c62c13594Eino-Ville Talvala // mCurrentTimestamp is the timestamp for the current texture. It 3137734ebfe47f42f980c1b44c1f284a91d8ad1d6c7Mathias Agopian // gets set each time updateTexImage is called. 3141d01a12e7150be569557b64da9b8663c62c13594Eino-Ville Talvala int64_t mCurrentTimestamp; 3151d01a12e7150be569557b64da9b8663c62c13594Eino-Ville Talvala 316016c8cbce4dde21f2703b9865f52d16b8d5d5ae2Daniel Lam uint32_t mDefaultWidth, mDefaultHeight; 317016c8cbce4dde21f2703b9865f52d16b8d5d5ae2Daniel Lam 3185c1139fea3cc0fd9847a6594d853a458152b2fbcJamie Gennis // mFilteringEnabled indicates whether the transform matrix is computed for 3195c1139fea3cc0fd9847a6594d853a458152b2fbcJamie Gennis // use with bilinear filtering. It defaults to true and is changed by 3205c1139fea3cc0fd9847a6594d853a458152b2fbcJamie Gennis // setFilteringEnabled(). 3215c1139fea3cc0fd9847a6594d853a458152b2fbcJamie Gennis bool mFilteringEnabled; 3225c1139fea3cc0fd9847a6594d853a458152b2fbcJamie Gennis 3238ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis // mTexName is the name of the OpenGL texture to which streamed images will 324292a31a4c2ae2f6faf134e8e4a726583017dad06Pannag Sanketi // be bound when updateTexImage is called. It is set at construction time 32574bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // and can be changed with a call to attachToContext. 32674bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis GLuint mTexName; 3278ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis 32886edf4f6470ee0f108bf40d3c1d23bf0a78c9c38Jamie Gennis // mUseFenceSync indicates whether creation of the EGL_KHR_fence_sync 32986edf4f6470ee0f108bf40d3c1d23bf0a78c9c38Jamie Gennis // extension should be used to prevent buffers from being dequeued before 33086edf4f6470ee0f108bf40d3c1d23bf0a78c9c38Jamie Gennis // it's safe for them to be written. It gets set at construction time and 33186edf4f6470ee0f108bf40d3c1d23bf0a78c9c38Jamie Gennis // never changes. 33286edf4f6470ee0f108bf40d3c1d23bf0a78c9c38Jamie Gennis const bool mUseFenceSync; 33386edf4f6470ee0f108bf40d3c1d23bf0a78c9c38Jamie Gennis 334fb1b5a2f333800574b0da435d1200cf9b13d723fJamie Gennis // mTexTarget is the GL texture target with which the GL texture object is 335fb1b5a2f333800574b0da435d1200cf9b13d723fJamie Gennis // associated. It is set in the constructor and never changed. It is 336fb1b5a2f333800574b0da435d1200cf9b13d723fJamie Gennis // almost always GL_TEXTURE_EXTERNAL_OES except for one use case in Android 337fb1b5a2f333800574b0da435d1200cf9b13d723fJamie Gennis // Browser. In that case it is set to GL_TEXTURE_2D to allow 338fb1b5a2f333800574b0da435d1200cf9b13d723fJamie Gennis // glCopyTexSubImage to read from the texture. This is a hack to work 339fb1b5a2f333800574b0da435d1200cf9b13d723fJamie Gennis // around a GL driver limitation on the number of FBO attachments, which the 340fb1b5a2f333800574b0da435d1200cf9b13d723fJamie Gennis // browser's tile cache exceeds. 341fb1b5a2f333800574b0da435d1200cf9b13d723fJamie Gennis const GLenum mTexTarget; 342a929748ddb67cbece3337c7fda7877fdeb973aa4Sunita Nadampalli 343fa5b40ebb8923133df12dc70591bfe35b3f1c9b3Jamie Gennis // EGLSlot contains the information and object references that 344fa5b40ebb8923133df12dc70591bfe35b3f1c9b3Jamie Gennis // SurfaceTexture maintains about a BufferQueue buffer slot. 345eae59d2ea77ef57aab203fb185a880ce37ac38d6Daniel Lam struct EGLSlot { 346eae59d2ea77ef57aab203fb185a880ce37ac38d6Daniel Lam EGLSlot() 347eae59d2ea77ef57aab203fb185a880ce37ac38d6Daniel Lam : mEglImage(EGL_NO_IMAGE_KHR), 3489fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis mEglFence(EGL_NO_SYNC_KHR) { 349eae59d2ea77ef57aab203fb185a880ce37ac38d6Daniel Lam } 350eae59d2ea77ef57aab203fb185a880ce37ac38d6Daniel Lam 351eae59d2ea77ef57aab203fb185a880ce37ac38d6Daniel Lam // mEglImage is the EGLImage created from mGraphicBuffer. 352eae59d2ea77ef57aab203fb185a880ce37ac38d6Daniel Lam EGLImageKHR mEglImage; 353eae59d2ea77ef57aab203fb185a880ce37ac38d6Daniel Lam 354eae59d2ea77ef57aab203fb185a880ce37ac38d6Daniel Lam // mFence is the EGL sync object that must signal before the buffer 355eae59d2ea77ef57aab203fb185a880ce37ac38d6Daniel Lam // associated with this buffer slot may be dequeued. It is initialized 356eae59d2ea77ef57aab203fb185a880ce37ac38d6Daniel Lam // to EGL_NO_SYNC_KHR when the buffer is created and (optionally, based 357eae59d2ea77ef57aab203fb185a880ce37ac38d6Daniel Lam // on a compile-time option) set to a new sync object in updateTexImage. 3589fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis EGLSyncKHR mEglFence; 359eae59d2ea77ef57aab203fb185a880ce37ac38d6Daniel Lam }; 360eae59d2ea77ef57aab203fb185a880ce37ac38d6Daniel Lam 361ce561372186c7549a8a5fe996ac5965cda087007Jamie Gennis // mEglDisplay is the EGLDisplay with which this SurfaceTexture is currently 362ce561372186c7549a8a5fe996ac5965cda087007Jamie Gennis // associated. It is intialized to EGL_NO_DISPLAY and gets set to the 36374bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // current display when updateTexImage is called for the first time and when 36474bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // attachToContext is called. 365ce561372186c7549a8a5fe996ac5965cda087007Jamie Gennis EGLDisplay mEglDisplay; 366ce561372186c7549a8a5fe996ac5965cda087007Jamie Gennis 367ce561372186c7549a8a5fe996ac5965cda087007Jamie Gennis // mEglContext is the OpenGL ES context with which this SurfaceTexture is 368ce561372186c7549a8a5fe996ac5965cda087007Jamie Gennis // currently associated. It is initialized to EGL_NO_CONTEXT and gets set 369ce561372186c7549a8a5fe996ac5965cda087007Jamie Gennis // to the current GL context when updateTexImage is called for the first 37074bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // time and when attachToContext is called. 371ce561372186c7549a8a5fe996ac5965cda087007Jamie Gennis EGLContext mEglContext; 372ce561372186c7549a8a5fe996ac5965cda087007Jamie Gennis 373fa5b40ebb8923133df12dc70591bfe35b3f1c9b3Jamie Gennis // mEGLSlots stores the buffers that have been allocated by the BufferQueue 374fa5b40ebb8923133df12dc70591bfe35b3f1c9b3Jamie Gennis // for each buffer slot. It is initialized to null pointers, and gets 375fa5b40ebb8923133df12dc70591bfe35b3f1c9b3Jamie Gennis // filled in with the result of BufferQueue::acquire when the 376fa5b40ebb8923133df12dc70591bfe35b3f1c9b3Jamie Gennis // client dequeues a buffer from a 377fa5b40ebb8923133df12dc70591bfe35b3f1c9b3Jamie Gennis // slot that has not yet been used. The buffer allocated to a slot will also 378fa5b40ebb8923133df12dc70591bfe35b3f1c9b3Jamie Gennis // be replaced if the requested buffer usage or geometry differs from that 379fa5b40ebb8923133df12dc70591bfe35b3f1c9b3Jamie Gennis // of the buffer allocated to a slot. 3809fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis EGLSlot mEglSlots[BufferQueue::NUM_BUFFER_SLOTS]; 381eae59d2ea77ef57aab203fb185a880ce37ac38d6Daniel Lam 382eae59d2ea77ef57aab203fb185a880ce37ac38d6Daniel Lam // mCurrentTexture is the buffer slot index of the buffer that is currently 383eae59d2ea77ef57aab203fb185a880ce37ac38d6Daniel Lam // bound to the OpenGL texture. It is initialized to INVALID_BUFFER_SLOT, 384eae59d2ea77ef57aab203fb185a880ce37ac38d6Daniel Lam // indicating that no buffer slot is currently bound to the texture. Note, 385eae59d2ea77ef57aab203fb185a880ce37ac38d6Daniel Lam // however, that a value of INVALID_BUFFER_SLOT does not necessarily mean 386eae59d2ea77ef57aab203fb185a880ce37ac38d6Daniel Lam // that no buffer is bound to the texture. A call to setBufferCount will 387eae59d2ea77ef57aab203fb185a880ce37ac38d6Daniel Lam // reset mCurrentTexture to INVALID_BUFFER_SLOT. 388eae59d2ea77ef57aab203fb185a880ce37ac38d6Daniel Lam int mCurrentTexture; 389eae59d2ea77ef57aab203fb185a880ce37ac38d6Daniel Lam 3909fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis // mAttached indicates whether the ConsumerBase is currently attached to 39174bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // an OpenGL ES context. For legacy reasons, this is initialized to true, 3929fea3421ffddf6480f57f55a25936a886043d909Jamie Gennis // indicating that the ConsumerBase is considered to be attached to 39374bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // whatever context is current at the time of the first updateTexImage call. 39474bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // It is set to false by detachFromContext, and then set to true again by 39574bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis // attachToContext. 39674bed55fff0132be319bcd1703970516ae28b3a9Jamie Gennis bool mAttached; 3978ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis}; 3988ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis 3998ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis// ---------------------------------------------------------------------------- 4008ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis}; // namespace android 4018ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis 4028ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis#endif // ANDROID_GUI_SURFACETEXTURE_H 403