Skip to content

Commit

Permalink
Revert "GFX-3D: Hold the BufferReference of GraphicBuffer in BpGraphi…
Browse files Browse the repository at this point in the history
…cBufferAlloc"

This reverts commit 7a3802e.

Change-Id: Ie29d5404c23ca8610f5fa3e5916fe1a124956ba0
  • Loading branch information
hyperb1iss committed Apr 21, 2014
1 parent 7a3802e commit c50357a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 28 deletions.
3 changes: 0 additions & 3 deletions include/gui/IGraphicBufferAlloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ class IGraphicBufferAlloc : public IInterface
virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h,
PixelFormat format, uint32_t usage, status_t* error) = 0;
virtual void setGraphicBufferSize(int size) = 0;

virtual void acquireBufferReferenceSlot(int32_t slot) {}
virtual void releaseBufferReferenceSlot(int32_t slot) {}
};

// ----------------------------------------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions libs/gui/BufferQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ status_t BufferQueue::dequeueBuffer(int *outBuf, sp<Fence>* outFence, bool async

if (returnFlags & IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION) {
status_t error;
mGraphicBufferAlloc->acquireBufferReferenceSlot(*outBuf);
sp<GraphicBuffer> graphicBuffer(
mGraphicBufferAlloc->createGraphicBuffer(w, h, format, usage, &error));
if (graphicBuffer == 0) {
Expand Down Expand Up @@ -855,7 +854,6 @@ void BufferQueue::dump(String8& result, const char* prefix) const {
void BufferQueue::freeBufferLocked(int slot) {
ST_LOGV("freeBufferLocked: slot=%d", slot);
mSlots[slot].mGraphicBuffer = 0;
mGraphicBufferAlloc->releaseBufferReferenceSlot(slot);
if (mSlots[slot].mBufferState == BufferSlot::ACQUIRED) {
mSlots[slot].mNeedsCleanupOnRelease = true;
}
Expand Down
26 changes: 3 additions & 23 deletions libs/gui/IGraphicBufferAlloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

#include <ui/GraphicBuffer.h>

#include <gui/BufferQueue.h>
#include <gui/IGraphicBufferAlloc.h>

// ---------------------------------------------------------------------------
Expand All @@ -42,7 +41,6 @@ class BpGraphicBufferAlloc : public BpInterface<IGraphicBufferAlloc>
BpGraphicBufferAlloc(const sp<IBinder>& impl)
: BpInterface<IGraphicBufferAlloc>(impl)
{
mSlotIndex = -1;
}

virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h,
Expand All @@ -59,9 +57,9 @@ class BpGraphicBufferAlloc : public BpInterface<IGraphicBufferAlloc>
if (result == NO_ERROR) {
graphicBuffer = new GraphicBuffer();
result = reply.read(*graphicBuffer);
if (mSlotIndex != -1) {
mSlots[mSlotIndex].mBufRef = reply.readStrongBinder();
}
// reply.readStrongBinder();
// here we don't even have to read the BufferReference from
// the parcel, it'll die with the parcel.
}
*error = result;
return graphicBuffer;
Expand All @@ -74,24 +72,6 @@ class BpGraphicBufferAlloc : public BpInterface<IGraphicBufferAlloc>
data.writeInt32(size);
remote()->transact(SET_GRAPHIC_BUFFER_SIZE, data, &reply);
}

virtual void acquireBufferReferenceSlot(int32_t slot) {
mSlotIndex = slot;
}

virtual void releaseBufferReferenceSlot(int32_t slot) {
mSlots[slot].mBufRef = 0;
}

struct BufferReferenceSlot {
BufferReferenceSlot() : mBufRef(0) {}
sp<IBinder> mBufRef;
};

protected:
enum { NUM_BUFFER_SLOTS = BufferQueue::NUM_BUFFER_SLOTS };
BufferReferenceSlot mSlots[NUM_BUFFER_SLOTS];
int mSlotIndex;
};

IMPLEMENT_META_INTERFACE(GraphicBufferAlloc, "android.ui.IGraphicBufferAlloc");
Expand Down

0 comments on commit c50357a

Please sign in to comment.