blob: 2a8e7255602b0e8b10763276852b318c78b73976 [file] [log] [blame]
Jamie Gennis8ba32fa2010-12-20 11:27:26 -08001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_GUI_SURFACETEXTURE_H
18#define ANDROID_GUI_SURFACETEXTURE_H
19
20#include <EGL/egl.h>
21#include <EGL/eglext.h>
22#include <GLES2/gl2.h>
23
24#include <gui/ISurfaceTexture.h>
25
26#include <ui/GraphicBuffer.h>
27
28#include <utils/threads.h>
Jamie Gennis9a78c902011-01-12 18:30:40 -080029#include <utils/Vector.h>
Jamie Gennis8ba32fa2010-12-20 11:27:26 -080030
31#define ANDROID_GRAPHICS_SURFACETEXTURE_JNI_ID "mSurfaceTexture"
32
33namespace android {
34// ----------------------------------------------------------------------------
35
Jamie Gennis9a78c902011-01-12 18:30:40 -080036class IGraphicBufferAlloc;
Mathias Agopian68c77942011-05-09 19:08:33 -070037class String8;
Jamie Gennis9a78c902011-01-12 18:30:40 -080038
Jamie Gennis8ba32fa2010-12-20 11:27:26 -080039class SurfaceTexture : public BnSurfaceTexture {
40public:
Jamie Gennis9d4d6c12011-02-27 14:10:20 -080041 enum { MIN_UNDEQUEUED_BUFFERS = 2 };
Mathias Agopian80727112011-05-02 19:51:12 -070042 enum {
43 MIN_ASYNC_BUFFER_SLOTS = MIN_UNDEQUEUED_BUFFERS + 1,
44 MIN_SYNC_BUFFER_SLOTS = MIN_UNDEQUEUED_BUFFERS
45 };
Jamie Gennis8ba32fa2010-12-20 11:27:26 -080046 enum { NUM_BUFFER_SLOTS = 32 };
Jamie Gennisfe0a87b2011-07-13 19:12:20 -070047 enum { NO_CONNECTED_API = 0 };
Jamie Gennis8ba32fa2010-12-20 11:27:26 -080048
Jamie Gennisc4d4aea2011-01-13 14:43:36 -080049 struct FrameAvailableListener : public virtual RefBase {
Jamie Gennis3d8063b2011-06-26 18:27:47 -070050 // onFrameAvailable() is called from queueBuffer() each time an
51 // additional frame becomes available for consumption. This means that
52 // frames that are queued while in asynchronous mode only trigger the
53 // callback if no previous frames are pending. Frames queued while in
54 // synchronous mode always trigger the callback.
55 //
56 // This is called without any lock held and can be called concurrently
57 // by multiple threads.
Jamie Gennisc4d4aea2011-01-13 14:43:36 -080058 virtual void onFrameAvailable() = 0;
59 };
60
Jamie Gennis8ba32fa2010-12-20 11:27:26 -080061 // tex indicates the name OpenGL texture to which images are to be streamed.
62 // This texture name cannot be changed once the SurfaceTexture is created.
Grace Kloba14a0e582011-06-23 21:21:47 -070063 SurfaceTexture(GLuint tex, bool allowSynchronousMode = true);
Jamie Gennis8ba32fa2010-12-20 11:27:26 -080064
65 virtual ~SurfaceTexture();
66
67 // setBufferCount updates the number of available buffer slots. After
68 // calling this all buffer slots are both unallocated and owned by the
69 // SurfaceTexture object (i.e. they are not owned by the client).
70 virtual status_t setBufferCount(int bufferCount);
71
Jamie Gennis7b305ff2011-07-19 12:08:33 -070072 virtual status_t requestBuffer(int slot, sp<GraphicBuffer>* buf);
Jamie Gennis8ba32fa2010-12-20 11:27:26 -080073
74 // dequeueBuffer gets the next buffer slot index for the client to use. If a
75 // buffer slot is available then that slot index is written to the location
76 // pointed to by the buf argument and a status of OK is returned. If no
77 // slot is available then a status of -EBUSY is returned and buf is
78 // unmodified.
Mathias Agopianc04f1532011-04-25 20:22:14 -070079 virtual status_t dequeueBuffer(int *buf, uint32_t w, uint32_t h,
80 uint32_t format, uint32_t usage);
Jamie Gennis8ba32fa2010-12-20 11:27:26 -080081
Eino-Ville Talvala1d01a122011-02-18 11:02:42 -080082 // queueBuffer returns a filled buffer to the SurfaceTexture. In addition, a
83 // timestamp must be provided for the buffer. The timestamp is in
84 // nanoseconds, and must be monotonically increasing. Its other semantics
85 // (zero point, etc) are client-dependent and should be documented by the
86 // client.
Mathias Agopian97c602c2011-07-19 15:24:46 -070087 virtual status_t queueBuffer(int buf, int64_t timestamp,
88 uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform);
Jamie Gennis8ba32fa2010-12-20 11:27:26 -080089 virtual void cancelBuffer(int buf);
90 virtual status_t setCrop(const Rect& reg);
91 virtual status_t setTransform(uint32_t transform);
Mathias Agopian7734ebf2011-07-13 15:24:42 -070092 virtual status_t setScalingMode(int mode);
Jamie Gennis8ba32fa2010-12-20 11:27:26 -080093
Mathias Agopianeafabcd2011-04-20 14:20:59 -070094 virtual int query(int what, int* value);
95
Mathias Agopian80727112011-05-02 19:51:12 -070096 // setSynchronousMode set whether dequeueBuffer is synchronous or
97 // asynchronous. In synchronous mode, dequeueBuffer blocks until
98 // a buffer is available, the currently bound buffer can be dequeued and
99 // queued buffers will be retired in order.
100 // The default mode is asynchronous.
101 virtual status_t setSynchronousMode(bool enabled);
102
Jamie Gennisfe0a87b2011-07-13 19:12:20 -0700103 // connect attempts to connect a client API to the SurfaceTexture. This
104 // must be called before any other ISurfaceTexture methods are called except
105 // for getAllocator.
106 //
107 // This method will fail if the connect was previously called on the
108 // SurfaceTexture and no corresponding disconnect call was made.
109 virtual status_t connect(int api);
110
111 // disconnect attempts to disconnect a client API from the SurfaceTexture.
112 // Calling this method will cause any subsequent calls to other
113 // ISurfaceTexture methods to fail except for getAllocator and connect.
114 // Successfully calling connect after this will allow the other methods to
115 // succeed again.
116 //
117 // This method will fail if the the SurfaceTexture is not currently
118 // connected to the specified client API.
119 virtual status_t disconnect(int api);
120
Jamie Gennis8ba32fa2010-12-20 11:27:26 -0800121 // updateTexImage sets the image contents of the target texture to that of
122 // the most recently queued buffer.
123 //
124 // This call may only be made while the OpenGL ES context to which the
125 // target texture belongs is bound to the calling thread.
126 status_t updateTexImage();
127
Mathias Agopian80727112011-05-02 19:51:12 -0700128 // setBufferCountServer set the buffer count. If the client has requested
129 // a buffer count using setBufferCount, the server-buffer count will
130 // take effect once the client sets the count back to zero.
131 status_t setBufferCountServer(int bufferCount);
132
Jamie Gennisf238e282011-01-09 16:33:17 -0800133 // getTransformMatrix retrieves the 4x4 texture coordinate transform matrix
134 // associated with the texture image set by the most recent call to
135 // updateTexImage.
136 //
137 // This transform matrix maps 2D homogeneous texture coordinates of the form
138 // (s, t, 0, 1) with s and t in the inclusive range [0, 1] to the texture
139 // coordinate that should be used to sample that location from the texture.
140 // Sampling the texture outside of the range of this transform is undefined.
141 //
142 // This transform is necessary to compensate for transforms that the stream
143 // content producer may implicitly apply to the content. By forcing users of
144 // a SurfaceTexture to apply this transform we avoid performing an extra
145 // copy of the data that would be needed to hide the transform from the
146 // user.
147 //
148 // The matrix is stored in column-major order so that it may be passed
149 // directly to OpenGL ES via the glLoadMatrixf or glUniformMatrix4fv
150 // functions.
151 void getTransformMatrix(float mtx[16]);
152
Eino-Ville Talvala1d01a122011-02-18 11:02:42 -0800153 // getTimestamp retrieves the timestamp associated with the texture image
154 // set by the most recent call to updateTexImage.
155 //
156 // The timestamp is in nanoseconds, and is monotonically increasing. Its
157 // other semantics (zero point, etc) are source-dependent and should be
158 // documented by the source.
159 int64_t getTimestamp();
160
Jamie Gennisc4d4aea2011-01-13 14:43:36 -0800161 // setFrameAvailableListener sets the listener object that will be notified
162 // when a new frame becomes available.
Pannag Sanketi292a31a2011-06-24 09:56:27 -0700163 void setFrameAvailableListener(const sp<FrameAvailableListener>& listener);
Jamie Gennisc4d4aea2011-01-13 14:43:36 -0800164
Jamie Gennis1b20cde2011-02-02 15:31:47 -0800165 // getAllocator retrieves the binder object that must be referenced as long
166 // as the GraphicBuffers dequeued from this SurfaceTexture are referenced.
167 // Holding this binder reference prevents SurfaceFlinger from freeing the
168 // buffers before the client is done with them.
169 sp<IBinder> getAllocator();
170
Mathias Agopiana5c75c02011-03-31 19:10:24 -0700171 // setDefaultBufferSize is used to set the size of buffers returned by
172 // requestBuffers when a with and height of zero is requested.
173 // A call to setDefaultBufferSize() may trigger requestBuffers() to
174 // be called from the client.
175 status_t setDefaultBufferSize(uint32_t w, uint32_t h);
176
Mathias Agopian7a042bf2011-04-11 21:19:55 -0700177 // getCurrentBuffer returns the buffer associated with the current image.
178 sp<GraphicBuffer> getCurrentBuffer() const;
179
180 // getCurrentTextureTarget returns the texture target of the current
181 // texture as returned by updateTexImage().
182 GLenum getCurrentTextureTarget() const;
183
184 // getCurrentCrop returns the cropping rectangle of the current buffer
185 Rect getCurrentCrop() const;
186
187 // getCurrentTransform returns the transform of the current buffer
188 uint32_t getCurrentTransform() const;
189
Mathias Agopian7734ebf2011-07-13 15:24:42 -0700190 // getCurrentScalingMode returns the scaling mode of the current buffer
191 uint32_t getCurrentScalingMode() const;
192
Jamie Gennis7b305ff2011-07-19 12:08:33 -0700193 // abandon frees all the buffers and puts the SurfaceTexture into the
194 // 'abandoned' state. Once put in this state the SurfaceTexture can never
195 // leave it. When in the 'abandoned' state, all methods of the
196 // ISurfaceTexture interface will fail with the NO_INIT error.
197 //
198 // Note that while calling this method causes all the buffers to be freed
199 // from the perspective of the the SurfaceTexture, if there are additional
200 // references on the buffers (e.g. if a buffer is referenced by a client or
201 // by OpenGL ES as a texture) then those buffer will remain allocated.
202 void abandon();
203
Mathias Agopian68c77942011-05-09 19:08:33 -0700204 // dump our state in a String
205 void dump(String8& result) const;
206 void dump(String8& result, const char* prefix, char* buffer, size_t SIZE) const;
207
Mathias Agopian7a042bf2011-04-11 21:19:55 -0700208protected:
Jamie Gennis8ba32fa2010-12-20 11:27:26 -0800209
210 // freeAllBuffers frees the resources (both GraphicBuffer and EGLImage) for
211 // all slots.
212 void freeAllBuffers();
Mathias Agopian7a042bf2011-04-11 21:19:55 -0700213 static bool isExternalFormat(uint32_t format);
Mathias Agopian7a042bf2011-04-11 21:19:55 -0700214
215private:
Jamie Gennis8ba32fa2010-12-20 11:27:26 -0800216
217 // createImage creates a new EGLImage from a GraphicBuffer.
218 EGLImageKHR createImage(EGLDisplay dpy,
219 const sp<GraphicBuffer>& graphicBuffer);
220
Mathias Agopian80727112011-05-02 19:51:12 -0700221 status_t setBufferCountServerLocked(int bufferCount);
222
Jamie Gennis736aa952011-06-12 17:03:06 -0700223 // computeCurrentTransformMatrix computes the transform matrix for the
224 // current texture. It uses mCurrentTransform and the current GraphicBuffer
225 // to compute this matrix and stores it in mCurrentTransformMatrix.
226 void computeCurrentTransformMatrix();
227
Jamie Gennis8ba32fa2010-12-20 11:27:26 -0800228 enum { INVALID_BUFFER_SLOT = -1 };
229
230 struct BufferSlot {
Mathias Agopianb3e518c2011-04-21 18:52:51 -0700231
232 BufferSlot()
233 : mEglImage(EGL_NO_IMAGE_KHR),
234 mEglDisplay(EGL_NO_DISPLAY),
235 mBufferState(BufferSlot::FREE),
236 mRequestBufferCalled(false),
Jamie Gennis8cd5ba42011-05-19 13:33:00 -0700237 mTransform(0),
Mathias Agopian7734ebf2011-07-13 15:24:42 -0700238 mScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE),
Jamie Gennis8cd5ba42011-05-19 13:33:00 -0700239 mTimestamp(0) {
240 mCrop.makeInvalid();
Mathias Agopianb3e518c2011-04-21 18:52:51 -0700241 }
242
Jamie Gennis8ba32fa2010-12-20 11:27:26 -0800243 // mGraphicBuffer points to the buffer allocated for this slot or is NULL
244 // if no buffer has been allocated.
245 sp<GraphicBuffer> mGraphicBuffer;
246
247 // mEglImage is the EGLImage created from mGraphicBuffer.
248 EGLImageKHR mEglImage;
249
250 // mEglDisplay is the EGLDisplay used to create mEglImage.
251 EGLDisplay mEglDisplay;
252
Jamie Gennis8cd5ba42011-05-19 13:33:00 -0700253 // BufferState represents the different states in which a buffer slot
254 // can be.
255 enum BufferState {
256 // FREE indicates that the buffer is not currently being used and
257 // will not be used in the future until it gets dequeued and
258 // subseqently queued by the client.
259 FREE = 0,
Mathias Agopianb3e518c2011-04-21 18:52:51 -0700260
Jamie Gennis8cd5ba42011-05-19 13:33:00 -0700261 // DEQUEUED indicates that the buffer has been dequeued by the
262 // client, but has not yet been queued or canceled. The buffer is
263 // considered 'owned' by the client, and the server should not use
264 // it for anything.
265 //
266 // Note that when in synchronous-mode (mSynchronousMode == true),
267 // the buffer that's currently attached to the texture may be
268 // dequeued by the client. That means that the current buffer can
269 // be in either the DEQUEUED or QUEUED state. In asynchronous mode,
270 // however, the current buffer is always in the QUEUED state.
271 DEQUEUED = 1,
272
273 // QUEUED indicates that the buffer has been queued by the client,
274 // and has not since been made available for the client to dequeue.
275 // Attaching the buffer to the texture does NOT transition the
276 // buffer away from the QUEUED state. However, in Synchronous mode
277 // the current buffer may be dequeued by the client under some
278 // circumstances. See the note about the current buffer in the
279 // documentation for DEQUEUED.
280 QUEUED = 2,
281 };
282
283 // mBufferState is the current state of this buffer slot.
284 BufferState mBufferState;
Mathias Agopianb3e518c2011-04-21 18:52:51 -0700285
286 // mRequestBufferCalled is used for validating that the client did
287 // call requestBuffer() when told to do so. Technically this is not
288 // needed but useful for debugging and catching client bugs.
289 bool mRequestBufferCalled;
290
Jamie Gennis8cd5ba42011-05-19 13:33:00 -0700291 // mCrop is the current crop rectangle for this buffer slot. This gets
292 // set to mNextCrop each time queueBuffer gets called for this buffer.
293 Rect mCrop;
Mathias Agopianb3e518c2011-04-21 18:52:51 -0700294
Jamie Gennis8cd5ba42011-05-19 13:33:00 -0700295 // mTransform is the current transform flags for this buffer slot. This
296 // gets set to mNextTransform each time queueBuffer gets called for this
297 // slot.
298 uint32_t mTransform;
Mathias Agopianb3e518c2011-04-21 18:52:51 -0700299
Mathias Agopian7734ebf2011-07-13 15:24:42 -0700300 // mScalingMode is the current scaling mode for this buffer slot. This
301 // gets set to mNextScalingMode each time queueBuffer gets called for
302 // this slot.
303 uint32_t mScalingMode;
304
Jamie Gennis8cd5ba42011-05-19 13:33:00 -0700305 // mTimestamp is the current timestamp for this buffer slot. This gets
306 // to set by queueBuffer each time this slot is queued.
307 int64_t mTimestamp;
Jamie Gennis8ba32fa2010-12-20 11:27:26 -0800308 };
309
310 // mSlots is the array of buffer slots that must be mirrored on the client
311 // side. This allows buffer ownership to be transferred between the client
312 // and server without sending a GraphicBuffer over binder. The entire array
313 // is initialized to NULL at construction time, and buffers are allocated
314 // for a slot when requestBuffer is called with that slot's index.
315 BufferSlot mSlots[NUM_BUFFER_SLOTS];
316
Mathias Agopiana5c75c02011-03-31 19:10:24 -0700317 // mDefaultWidth holds the default width of allocated buffers. It is used
318 // in requestBuffers() if a width and height of zero is specified.
319 uint32_t mDefaultWidth;
320
321 // mDefaultHeight holds the default height of allocated buffers. It is used
322 // in requestBuffers() if a width and height of zero is specified.
323 uint32_t mDefaultHeight;
324
325 // mPixelFormat holds the pixel format of allocated buffers. It is used
326 // in requestBuffers() if a format of zero is specified.
327 uint32_t mPixelFormat;
328
Jamie Gennis8ba32fa2010-12-20 11:27:26 -0800329 // mBufferCount is the number of buffer slots that the client and server
Mathias Agopian80727112011-05-02 19:51:12 -0700330 // must maintain. It defaults to MIN_ASYNC_BUFFER_SLOTS and can be changed
331 // by calling setBufferCount or setBufferCountServer
Jamie Gennis8ba32fa2010-12-20 11:27:26 -0800332 int mBufferCount;
333
Jamie Gennisae468f42011-06-12 14:11:39 -0700334 // mClientBufferCount is the number of buffer slots requested by the client.
335 // The default is zero, which means the client doesn't care how many buffers
336 // there is.
Mathias Agopian80727112011-05-02 19:51:12 -0700337 int mClientBufferCount;
338
339 // mServerBufferCount buffer count requested by the server-side
340 int mServerBufferCount;
341
Jamie Gennis8ba32fa2010-12-20 11:27:26 -0800342 // mCurrentTexture is the buffer slot index of the buffer that is currently
Jamie Gennis67eedd72011-01-09 13:25:39 -0800343 // bound to the OpenGL texture. It is initialized to INVALID_BUFFER_SLOT,
344 // indicating that no buffer slot is currently bound to the texture. Note,
345 // however, that a value of INVALID_BUFFER_SLOT does not necessarily mean
346 // that no buffer is bound to the texture. A call to setBufferCount will
347 // reset mCurrentTexture to INVALID_BUFFER_SLOT.
Jamie Gennis8ba32fa2010-12-20 11:27:26 -0800348 int mCurrentTexture;
349
Jamie Gennis9a78c902011-01-12 18:30:40 -0800350 // mCurrentTextureBuf is the graphic buffer of the current texture. It's
351 // possible that this buffer is not associated with any buffer slot, so we
Jamie Gennis29c87022011-07-19 12:11:52 -0700352 // must track it separately in order to support the getCurrentBuffer method.
Jamie Gennis9a78c902011-01-12 18:30:40 -0800353 sp<GraphicBuffer> mCurrentTextureBuf;
354
Jamie Gennisf238e282011-01-09 16:33:17 -0800355 // mCurrentCrop is the crop rectangle that applies to the current texture.
Mathias Agopian7734ebf2011-07-13 15:24:42 -0700356 // It gets set each time updateTexImage is called.
Jamie Gennisf238e282011-01-09 16:33:17 -0800357 Rect mCurrentCrop;
358
359 // mCurrentTransform is the transform identifier for the current texture. It
Mathias Agopian7734ebf2011-07-13 15:24:42 -0700360 // gets set each time updateTexImage is called.
Jamie Gennisf238e282011-01-09 16:33:17 -0800361 uint32_t mCurrentTransform;
362
Mathias Agopian7734ebf2011-07-13 15:24:42 -0700363 // mCurrentScalingMode is the scaling mode for the current texture. It gets
364 // set to each time updateTexImage is called.
365 uint32_t mCurrentScalingMode;
366
Jamie Gennis736aa952011-06-12 17:03:06 -0700367 // mCurrentTransformMatrix is the transform matrix for the current texture.
368 // It gets computed by computeTransformMatrix each time updateTexImage is
369 // called.
370 float mCurrentTransformMatrix[16];
371
Eino-Ville Talvala1d01a122011-02-18 11:02:42 -0800372 // mCurrentTimestamp is the timestamp for the current texture. It
Mathias Agopian7734ebf2011-07-13 15:24:42 -0700373 // gets set each time updateTexImage is called.
Eino-Ville Talvala1d01a122011-02-18 11:02:42 -0800374 int64_t mCurrentTimestamp;
375
Jamie Gennisf238e282011-01-09 16:33:17 -0800376 // mNextCrop is the crop rectangle that will be used for the next buffer
377 // that gets queued. It is set by calling setCrop.
378 Rect mNextCrop;
379
380 // mNextTransform is the transform identifier that will be used for the next
381 // buffer that gets queued. It is set by calling setTransform.
382 uint32_t mNextTransform;
383
Mathias Agopian7734ebf2011-07-13 15:24:42 -0700384 // mNextScalingMode is the scaling mode that will be used for the next
385 // buffers that get queued. It is set by calling setScalingMode.
386 int mNextScalingMode;
387
Jamie Gennis8ba32fa2010-12-20 11:27:26 -0800388 // mTexName is the name of the OpenGL texture to which streamed images will
Pannag Sanketi292a31a2011-06-24 09:56:27 -0700389 // be bound when updateTexImage is called. It is set at construction time
Jamie Gennis8ba32fa2010-12-20 11:27:26 -0800390 // changed with a call to setTexName.
391 const GLuint mTexName;
392
Jamie Gennis9a78c902011-01-12 18:30:40 -0800393 // mGraphicBufferAlloc is the connection to SurfaceFlinger that is used to
394 // allocate new GraphicBuffer objects.
395 sp<IGraphicBufferAlloc> mGraphicBufferAlloc;
396
Jamie Gennisc4d4aea2011-01-13 14:43:36 -0800397 // mFrameAvailableListener is the listener object that will be called when a
398 // new frame becomes available. If it is not NULL it will be called from
399 // queueBuffer.
400 sp<FrameAvailableListener> mFrameAvailableListener;
401
Mathias Agopianb3e518c2011-04-21 18:52:51 -0700402 // mSynchronousMode whether we're in synchronous mode or not
403 bool mSynchronousMode;
404
Grace Kloba14a0e582011-06-23 21:21:47 -0700405 // mAllowSynchronousMode whether we allow synchronous mode or not
406 const bool mAllowSynchronousMode;
407
Jamie Gennisfe0a87b2011-07-13 19:12:20 -0700408 // mConnectedApi indicates the API that is currently connected to this
409 // SurfaceTexture. It defaults to NO_CONNECTED_API (= 0), and gets updated
410 // by the connect and disconnect methods.
411 int mConnectedApi;
412
Mathias Agopianb3e518c2011-04-21 18:52:51 -0700413 // mDequeueCondition condition used for dequeueBuffer in synchronous mode
414 mutable Condition mDequeueCondition;
415
416 // mQueue is a FIFO of queued buffers used in synchronous mode
417 typedef Vector<int> Fifo;
418 Fifo mQueue;
419
Jamie Gennis7b305ff2011-07-19 12:08:33 -0700420 // mAbandoned indicates that the SurfaceTexture will no longer be used to
421 // consume images buffers pushed to it using the ISurfaceTexture interface.
422 // It is initialized to false, and set to true in the abandon method. A
423 // SurfaceTexture that has been abandoned will return the NO_INIT error from
424 // all ISurfaceTexture methods capable of returning an error.
425 bool mAbandoned;
426
Jamie Gennis8ba32fa2010-12-20 11:27:26 -0800427 // mMutex is the mutex used to prevent concurrent access to the member
428 // variables of SurfaceTexture objects. It must be locked whenever the
429 // member variables are accessed.
Mathias Agopian7a042bf2011-04-11 21:19:55 -0700430 mutable Mutex mMutex;
Jamie Gennis736aa952011-06-12 17:03:06 -0700431
Jamie Gennis8ba32fa2010-12-20 11:27:26 -0800432};
433
434// ----------------------------------------------------------------------------
435}; // namespace android
436
437#endif // ANDROID_GUI_SURFACETEXTURE_H