Merge "libgui: Add a BufferItem overload to IGBC::acquire"
This commit is contained in:
commit
b08004f869
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user