diff options
Diffstat (limited to 'include/gui')
-rw-r--r-- | include/gui/ISurfaceTexture.h | 12 | ||||
-rw-r--r-- | include/gui/SurfaceTexture.h | 23 | ||||
-rw-r--r-- | include/gui/SurfaceTextureClient.h | 4 |
3 files changed, 23 insertions, 16 deletions
diff --git a/include/gui/ISurfaceTexture.h b/include/gui/ISurfaceTexture.h index e764425..1eda646 100644 --- a/include/gui/ISurfaceTexture.h +++ b/include/gui/ISurfaceTexture.h @@ -51,7 +51,7 @@ protected: // the given slot index, and the client is expected to mirror the // slot->buffer mapping so that it's not necessary to transfer a // GraphicBuffer for every dequeue operation. - virtual sp<GraphicBuffer> requestBuffer(int slot) = 0; + virtual status_t requestBuffer(int slot, sp<GraphicBuffer>* buf) = 0; // setBufferCount sets the number of buffer slots available. Calling this // will also cause all buffer slots to be emptied. The caller should empty @@ -79,8 +79,8 @@ protected: // must be monotonically increasing. Its other properties (zero point, etc) // are client-dependent, and should be documented by the client. // - // outWidth, outHeight and outTransform are filed with the default width - // default height of the window and current transform applied to buffers, + // outWidth, outHeight and outTransform are filled with the default width + // and height of the window and current transform applied to buffers, // respectively. virtual status_t queueBuffer(int slot, int64_t timestamp, uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) = 0; @@ -94,12 +94,6 @@ protected: virtual status_t setTransform(uint32_t transform) = 0; virtual status_t setScalingMode(int mode) = 0; - // getAllocator retrieves the binder object that must be referenced as long - // as the GraphicBuffers dequeued from this ISurfaceTexture are referenced. - // Holding this binder reference prevents SurfaceFlinger from freeing the - // buffers before the client is done with them. - virtual sp<IBinder> getAllocator() = 0; - // query retrieves some information for this surface // 'what' tokens allowed are that of android_natives.h virtual int query(int what, int* value) = 0; diff --git a/include/gui/SurfaceTexture.h b/include/gui/SurfaceTexture.h index 945f4bc..134c208 100644 --- a/include/gui/SurfaceTexture.h +++ b/include/gui/SurfaceTexture.h @@ -69,7 +69,7 @@ public: // SurfaceTexture object (i.e. they are not owned by the client). virtual status_t setBufferCount(int bufferCount); - virtual sp<GraphicBuffer> requestBuffer(int buf); + virtual status_t requestBuffer(int slot, sp<GraphicBuffer>* buf); // dequeueBuffer gets the next buffer slot index for the client to use. If a // buffer slot is available then that slot index is written to the location @@ -190,6 +190,17 @@ public: // getCurrentScalingMode returns the scaling mode of the current buffer uint32_t getCurrentScalingMode() const; + // abandon frees all the buffers and puts the SurfaceTexture into the + // 'abandoned' state. Once put in this state the SurfaceTexture can never + // leave it. When in the 'abandoned' state, all methods of the + // ISurfaceTexture interface will fail with the NO_INIT error. + // + // Note that while calling this method causes all the buffers to be freed + // from the perspective of the the SurfaceTexture, if there are additional + // references on the buffers (e.g. if a buffer is referenced by a client or + // by OpenGL ES as a texture) then those buffer will remain allocated. + void abandon(); + // dump our state in a String void dump(String8& result) const; void dump(String8& result, const char* prefix, char* buffer, size_t SIZE) const; @@ -343,8 +354,7 @@ private: // mCurrentTextureBuf is the graphic buffer of the current texture. It's // possible that this buffer is not associated with any buffer slot, so we - // must track it separately in order to properly use - // IGraphicBufferAlloc::freeAllGraphicBuffersExcept. + // must track it separately in order to support the getCurrentBuffer method. sp<GraphicBuffer> mCurrentTextureBuf; // mCurrentCrop is the crop rectangle that applies to the current texture. @@ -412,6 +422,13 @@ private: typedef Vector<int> Fifo; Fifo mQueue; + // mAbandoned indicates that the SurfaceTexture will no longer be used to + // consume images buffers pushed to it using the ISurfaceTexture interface. + // It is initialized to false, and set to true in the abandon method. A + // SurfaceTexture that has been abandoned will return the NO_INIT error from + // all ISurfaceTexture methods capable of returning an error. + bool mAbandoned; + // mMutex is the mutex used to prevent concurrent access to the member // variables of SurfaceTexture objects. It must be locked whenever the // member variables are accessed. diff --git a/include/gui/SurfaceTextureClient.h b/include/gui/SurfaceTextureClient.h index 829d8ab..56f029f 100644 --- a/include/gui/SurfaceTextureClient.h +++ b/include/gui/SurfaceTextureClient.h @@ -106,10 +106,6 @@ private: // interactions with the server using this interface. sp<ISurfaceTexture> mSurfaceTexture; - // mAllocator is the binder object that is referenced to prevent the - // dequeued buffers from being freed prematurely. - sp<IBinder> mAllocator; - // mSlots stores the buffers that have been allocated for each buffer slot. // It is initialized to null pointers, and gets filled in with the result of // ISurfaceTexture::requestBuffer when the client dequeues a buffer from a |