OSDN Git Service

SurfaceTexture: remove getAllocator
authorJamie Gennis <jgennis@google.com>
Tue, 19 Jul 2011 21:32:36 +0000 (14:32 -0700)
committerJamie Gennis <jgennis@google.com>
Thu, 21 Jul 2011 21:32:56 +0000 (14:32 -0700)
This change removes the SurfaceTexture::getAllocator method, as it's no
longer needed.  Proper refcounting of the Gralloc buffers is now handled
by the IGraphicBufferAlloc binder marshalling code.

Change-Id: I5cffa6ebfc1bc5828fb7ce0e0a5b2f55cd8479da

include/gui/ISurfaceTexture.h
include/gui/SurfaceTextureClient.h
libs/gui/ISurfaceTexture.cpp
libs/gui/SurfaceTexture.cpp
libs/gui/SurfaceTextureClient.cpp

index bc630ae..405a25a 100644 (file)
@@ -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;
index 829d8ab..56f029f 100644 (file)
@@ -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
index be90e2e..c9c7397 100644 (file)
@@ -38,7 +38,6 @@ enum {
     CANCEL_BUFFER,
     SET_CROP,
     SET_TRANSFORM,
-    GET_ALLOCATOR,
     QUERY,
     SET_SYNCHRONOUS_MODE,
     CONNECT,
@@ -144,13 +143,6 @@ public:
         return result;
     }
 
-    virtual sp<IBinder> getAllocator() {
-        Parcel data, reply;
-        data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
-        remote()->transact(GET_ALLOCATOR, data, &reply);
-        return reply.readStrongBinder();
-    }
-
     virtual int query(int what, int* value) {
         Parcel data, reply;
         data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
@@ -270,12 +262,6 @@ status_t BnSurfaceTexture::onTransact(
             reply->writeInt32(result);
             return NO_ERROR;
         } break;
-        case GET_ALLOCATOR: {
-            CHECK_INTERFACE(ISurfaceTexture, data, reply);
-            sp<IBinder> result = getAllocator();
-            reply->writeStrongBinder(result);
-            return NO_ERROR;
-        } break;
         case QUERY: {
             CHECK_INTERFACE(ISurfaceTexture, data, reply);
             int value;
index 0f08570..54d963f 100644 (file)
@@ -786,11 +786,6 @@ void SurfaceTexture::setFrameAvailableListener(
     mFrameAvailableListener = listener;
 }
 
-sp<IBinder> SurfaceTexture::getAllocator() {
-    LOGV("SurfaceTexture::getAllocator");
-    return mGraphicBufferAlloc->asBinder();
-}
-
 void SurfaceTexture::freeAllBuffers() {
     for (int i = 0; i < NUM_BUFFER_SLOTS; i++) {
         mSlots[i].mGraphicBuffer = 0;
index 1dc6cd2..b4d76bb 100644 (file)
@@ -62,9 +62,6 @@ void SurfaceTextureClient::setISurfaceTexture(
         const sp<ISurfaceTexture>& surfaceTexture)
 {
     mSurfaceTexture = surfaceTexture;
-
-    // Get a reference to the allocator.
-    mAllocator = mSurfaceTexture->getAllocator();
 }
 
 sp<ISurfaceTexture> SurfaceTextureClient::getISurfaceTexture() const {