Loading include/gui/ISurfaceTexture.h +6 −0 Original line number Original line Diff line number Diff line Loading @@ -72,6 +72,12 @@ public: virtual status_t setCrop(const Rect& reg) = 0; virtual status_t setCrop(const Rect& reg) = 0; virtual status_t setTransform(uint32_t transform) = 0; virtual status_t setTransform(uint32_t transform) = 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; }; }; // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- Loading include/gui/SurfaceTexture.h +6 −0 Original line number Original line Diff line number Diff line Loading @@ -101,6 +101,12 @@ public: // when a new frame becomes available. // when a new frame becomes available. void setFrameAvailableListener(const sp<FrameAvailableListener>& l); void setFrameAvailableListener(const sp<FrameAvailableListener>& l); // getAllocator retrieves the binder object that must be referenced as long // as the GraphicBuffers dequeued from this SurfaceTexture are referenced. // Holding this binder reference prevents SurfaceFlinger from freeing the // buffers before the client is done with them. sp<IBinder> getAllocator(); private: private: // freeAllBuffers frees the resources (both GraphicBuffer and EGLImage) for // freeAllBuffers frees the resources (both GraphicBuffer and EGLImage) for Loading include/gui/SurfaceTextureClient.h +4 −0 Original line number Original line Diff line number Diff line Loading @@ -83,6 +83,10 @@ private: // interactions with the server using this interface. // interactions with the server using this interface. sp<ISurfaceTexture> mSurfaceTexture; 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. // 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 // It is initialized to null pointers, and gets filled in with the result of // ISurfaceTexture::requestBuffer when the client dequeues a buffer from a // ISurfaceTexture::requestBuffer when the client dequeues a buffer from a Loading libs/gui/ISurfaceTexture.cpp +14 −0 Original line number Original line Diff line number Diff line Loading @@ -38,6 +38,7 @@ enum { CANCEL_BUFFER, CANCEL_BUFFER, SET_CROP, SET_CROP, SET_TRANSFORM, SET_TRANSFORM, GET_ALLOCATOR, }; }; Loading Loading @@ -123,6 +124,13 @@ public: status_t result = reply.readInt32(); status_t result = reply.readInt32(); return result; return result; } } virtual sp<IBinder> getAllocator() { Parcel data, reply; data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor()); remote()->transact(GET_ALLOCATOR, data, &reply); return reply.readStrongBinder(); } }; }; IMPLEMENT_META_INTERFACE(SurfaceTexture, "android.gui.SurfaceTexture"); IMPLEMENT_META_INTERFACE(SurfaceTexture, "android.gui.SurfaceTexture"); Loading Loading @@ -195,6 +203,12 @@ status_t BnSurfaceTexture::onTransact( reply->writeInt32(result); reply->writeInt32(result); return NO_ERROR; return NO_ERROR; } break; } break; case GET_ALLOCATOR: { CHECK_INTERFACE(ISurfaceTexture, data, reply); sp<IBinder> result = getAllocator(); reply->writeStrongBinder(result); return NO_ERROR; } break; } } return BBinder::onTransact(code, data, reply, flags); return BBinder::onTransact(code, data, reply, flags); } } Loading libs/gui/SurfaceTexture.cpp +5 −0 Original line number Original line Diff line number Diff line Loading @@ -304,6 +304,11 @@ void SurfaceTexture::setFrameAvailableListener( mFrameAvailableListener = l; mFrameAvailableListener = l; } } sp<IBinder> SurfaceTexture::getAllocator() { LOGV("SurfaceTexture::getAllocator"); return mGraphicBufferAlloc->asBinder(); } void SurfaceTexture::freeAllBuffers() { void SurfaceTexture::freeAllBuffers() { for (int i = 0; i < NUM_BUFFER_SLOTS; i++) { for (int i = 0; i < NUM_BUFFER_SLOTS; i++) { mSlots[i].mGraphicBuffer = 0; mSlots[i].mGraphicBuffer = 0; Loading Loading
include/gui/ISurfaceTexture.h +6 −0 Original line number Original line Diff line number Diff line Loading @@ -72,6 +72,12 @@ public: virtual status_t setCrop(const Rect& reg) = 0; virtual status_t setCrop(const Rect& reg) = 0; virtual status_t setTransform(uint32_t transform) = 0; virtual status_t setTransform(uint32_t transform) = 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; }; }; // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- Loading
include/gui/SurfaceTexture.h +6 −0 Original line number Original line Diff line number Diff line Loading @@ -101,6 +101,12 @@ public: // when a new frame becomes available. // when a new frame becomes available. void setFrameAvailableListener(const sp<FrameAvailableListener>& l); void setFrameAvailableListener(const sp<FrameAvailableListener>& l); // getAllocator retrieves the binder object that must be referenced as long // as the GraphicBuffers dequeued from this SurfaceTexture are referenced. // Holding this binder reference prevents SurfaceFlinger from freeing the // buffers before the client is done with them. sp<IBinder> getAllocator(); private: private: // freeAllBuffers frees the resources (both GraphicBuffer and EGLImage) for // freeAllBuffers frees the resources (both GraphicBuffer and EGLImage) for Loading
include/gui/SurfaceTextureClient.h +4 −0 Original line number Original line Diff line number Diff line Loading @@ -83,6 +83,10 @@ private: // interactions with the server using this interface. // interactions with the server using this interface. sp<ISurfaceTexture> mSurfaceTexture; 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. // 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 // It is initialized to null pointers, and gets filled in with the result of // ISurfaceTexture::requestBuffer when the client dequeues a buffer from a // ISurfaceTexture::requestBuffer when the client dequeues a buffer from a Loading
libs/gui/ISurfaceTexture.cpp +14 −0 Original line number Original line Diff line number Diff line Loading @@ -38,6 +38,7 @@ enum { CANCEL_BUFFER, CANCEL_BUFFER, SET_CROP, SET_CROP, SET_TRANSFORM, SET_TRANSFORM, GET_ALLOCATOR, }; }; Loading Loading @@ -123,6 +124,13 @@ public: status_t result = reply.readInt32(); status_t result = reply.readInt32(); return result; return result; } } virtual sp<IBinder> getAllocator() { Parcel data, reply; data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor()); remote()->transact(GET_ALLOCATOR, data, &reply); return reply.readStrongBinder(); } }; }; IMPLEMENT_META_INTERFACE(SurfaceTexture, "android.gui.SurfaceTexture"); IMPLEMENT_META_INTERFACE(SurfaceTexture, "android.gui.SurfaceTexture"); Loading Loading @@ -195,6 +203,12 @@ status_t BnSurfaceTexture::onTransact( reply->writeInt32(result); reply->writeInt32(result); return NO_ERROR; return NO_ERROR; } break; } break; case GET_ALLOCATOR: { CHECK_INTERFACE(ISurfaceTexture, data, reply); sp<IBinder> result = getAllocator(); reply->writeStrongBinder(result); return NO_ERROR; } break; } } return BBinder::onTransact(code, data, reply, flags); return BBinder::onTransact(code, data, reply, flags); } } Loading
libs/gui/SurfaceTexture.cpp +5 −0 Original line number Original line Diff line number Diff line Loading @@ -304,6 +304,11 @@ void SurfaceTexture::setFrameAvailableListener( mFrameAvailableListener = l; mFrameAvailableListener = l; } } sp<IBinder> SurfaceTexture::getAllocator() { LOGV("SurfaceTexture::getAllocator"); return mGraphicBufferAlloc->asBinder(); } void SurfaceTexture::freeAllBuffers() { void SurfaceTexture::freeAllBuffers() { for (int i = 0; i < NUM_BUFFER_SLOTS; i++) { for (int i = 0; i < NUM_BUFFER_SLOTS; i++) { mSlots[i].mGraphicBuffer = 0; mSlots[i].mGraphicBuffer = 0; Loading