libgui: Add a BufferItem overload to IGBC::acquire

Adds an overload of IGraphicBufferConsumer::acquireBuffer which takes
an android::BufferItem instead of an IGBC::BufferItem.

Change-Id: I9c3bc8037fa9438d4d9080b8afb694219ef2f71f
This commit is contained in:
Dan Stoza 2015-03-11 16:38:47 -07:00
parent 8757c016c8
commit de7100ab23
4 changed files with 36 additions and 0 deletions

View File

@ -48,6 +48,8 @@ public:
// is CLOCK_MONOTONIC.
virtual status_t acquireBuffer(BufferItem* outBuffer,
nsecs_t expectedPresent);
virtual status_t acquireBuffer(android::BufferItem* outBuffer,
nsecs_t expectedPresent);
// See IGraphicBufferConsumer::detachBuffer
virtual status_t detachBuffer(int slot);

View File

@ -34,6 +34,7 @@
namespace android {
// ----------------------------------------------------------------------------
class BufferItem;
class Fence;
class GraphicBuffer;
class IConsumerListener;
@ -147,6 +148,7 @@ public:
// Return of a negative value means an error has occurred:
// * INVALID_OPERATION - too many buffers have been acquired
virtual status_t acquireBuffer(BufferItem* buffer, nsecs_t presentWhen) = 0;
virtual status_t acquireBuffer(android::BufferItem* buffer, nsecs_t presentWhen) = 0;
// detachBuffer attempts to remove all ownership of the buffer in the given
// slot from the buffer queue. If this call succeeds, the slot will be

View File

@ -176,6 +176,22 @@ status_t BufferQueueConsumer::acquireBuffer(BufferItem* outBuffer,
return NO_ERROR;
}
status_t BufferQueueConsumer::acquireBuffer(android::BufferItem* outBuffer,
nsecs_t expectedPresent) {
if (outBuffer == nullptr) {
return BAD_VALUE;
}
android::BufferItem item;
status_t result = acquireBuffer(&item, expectedPresent);
if (result != NO_ERROR) {
return result;
}
*outBuffer = item;
return NO_ERROR;
}
status_t BufferQueueConsumer::detachBuffer(int slot) {
ATRACE_CALL();
ATRACE_BUFFER_INDEX(slot);

View File

@ -23,6 +23,7 @@
#include <binder/Parcel.h>
#include <binder/IInterface.h>
#include <gui/BufferItem.h>
#include <gui/IConsumerListener.h>
#include <gui/IGraphicBufferConsumer.h>
@ -237,6 +238,21 @@ public:
return reply.readInt32();
}
virtual status_t acquireBuffer(android::BufferItem* buffer,
nsecs_t presentWhen) {
if (buffer == nullptr) {
return BAD_VALUE;
}
BufferItem item;
status_t result = acquireBuffer(&item, presentWhen);
if (result != NO_ERROR) {
return result;
}
*buffer = item;
return NO_ERROR;
}
virtual status_t detachBuffer(int slot) {
Parcel data, reply;
data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor());