libgui: Remove IGBC::BufferItem
Removes IGraphicBufferConsumer::BufferItem. Depends on the
following changes:
I187b3a7d05196b6289596afac8fb9a9d4aebff76
I0ddd38df37500cfd6b21d1e768ed14e39c5cd9fc
Change-Id: I3edf0db8fba656fd78e18a5a7f1137f0fb6b237d
(cherry picked from commit 1c87e474d8
)
This commit is contained in:
parent
46072d5834
commit
955c897482
@ -20,10 +20,10 @@
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
|
||||
#include <gui/IGraphicBufferConsumer.h>
|
||||
|
||||
#include <ui/Rect.h>
|
||||
|
||||
#include <system/graphics.h>
|
||||
|
||||
#include <utils/Flattenable.h>
|
||||
#include <utils/StrongPointer.h>
|
||||
|
||||
@ -44,9 +44,7 @@ class BufferItem : public Flattenable<BufferItem> {
|
||||
// The default value of mBuf, used to indicate this doesn't correspond to a slot.
|
||||
enum { INVALID_BUFFER_SLOT = -1 };
|
||||
BufferItem();
|
||||
BufferItem(const IGraphicBufferConsumer::BufferItem& item);
|
||||
~BufferItem();
|
||||
operator IGraphicBufferConsumer::BufferItem() const;
|
||||
|
||||
static const char* scalingModeName(uint32_t scalingMode);
|
||||
|
||||
|
@ -42,8 +42,6 @@ class BufferItemConsumer: public ConsumerBase
|
||||
public:
|
||||
typedef ConsumerBase::FrameAvailableListener FrameAvailableListener;
|
||||
|
||||
typedef BufferQueue::BufferItem BufferItem;
|
||||
|
||||
enum { DEFAULT_MAX_BUFFERS = -1 };
|
||||
enum { INVALID_BUFFER_SLOT = BufferQueue::INVALID_BUFFER_SLOT };
|
||||
enum { NO_BUFFER_AVAILABLE = BufferQueue::NO_BUFFER_AVAILABLE };
|
||||
@ -76,9 +74,7 @@ class BufferItemConsumer: public ConsumerBase
|
||||
//
|
||||
// If waitForFence is true, and the acquired BufferItem has a valid fence object,
|
||||
// acquireBuffer will wait on the fence with no timeout before returning.
|
||||
status_t acquireBuffer(BufferQueue::BufferItem *item, nsecs_t presentWhen,
|
||||
bool waitForFence = true);
|
||||
status_t acquireBuffer(android::BufferItem* item, nsecs_t presentWhen,
|
||||
status_t acquireBuffer(BufferItem* item, nsecs_t presentWhen,
|
||||
bool waitForFence = true);
|
||||
|
||||
// Returns an acquired buffer to the queue, allowing it to be reused. Since
|
||||
|
@ -17,6 +17,7 @@
|
||||
#ifndef ANDROID_GUI_BUFFERQUEUE_H
|
||||
#define ANDROID_GUI_BUFFERQUEUE_H
|
||||
|
||||
#include <gui/BufferItem.h>
|
||||
#include <gui/BufferQueueDefs.h>
|
||||
#include <gui/IGraphicBufferConsumer.h>
|
||||
#include <gui/IGraphicBufferProducer.h>
|
||||
@ -34,7 +35,7 @@ public:
|
||||
// Attempts at runtime to increase the number of buffers past this will fail.
|
||||
enum { NUM_BUFFER_SLOTS = BufferQueueDefs::NUM_BUFFER_SLOTS };
|
||||
// Used as a placeholder slot# when the value isn't pointing to an existing buffer.
|
||||
enum { INVALID_BUFFER_SLOT = IGraphicBufferConsumer::BufferItem::INVALID_BUFFER_SLOT };
|
||||
enum { INVALID_BUFFER_SLOT = BufferItem::INVALID_BUFFER_SLOT };
|
||||
// Alias to <IGraphicBufferConsumer.h> -- please scope from there in future code!
|
||||
enum {
|
||||
NO_BUFFER_AVAILABLE = IGraphicBufferConsumer::NO_BUFFER_AVAILABLE,
|
||||
@ -47,7 +48,6 @@ public:
|
||||
|
||||
// for backward source compatibility
|
||||
typedef ::android::ConsumerListener ConsumerListener;
|
||||
typedef IGraphicBufferConsumer::BufferItem BufferItem;
|
||||
|
||||
// ProxyConsumerListener is a ConsumerListener implementation that keeps a weak
|
||||
// reference to the actual consumer object. It forwards all calls to that
|
||||
@ -62,7 +62,7 @@ public:
|
||||
public:
|
||||
ProxyConsumerListener(const wp<ConsumerListener>& consumerListener);
|
||||
virtual ~ProxyConsumerListener();
|
||||
virtual void onFrameAvailable(const android::BufferItem& item);
|
||||
virtual void onFrameAvailable(const BufferItem& item);
|
||||
virtual void onBuffersReleased();
|
||||
virtual void onSidebandStreamChanged();
|
||||
private:
|
||||
|
@ -48,8 +48,6 @@ 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);
|
||||
|
@ -17,6 +17,7 @@
|
||||
#ifndef ANDROID_GUI_BUFFERQUEUECORE_H
|
||||
#define ANDROID_GUI_BUFFERQUEUECORE_H
|
||||
|
||||
#include <gui/BufferItem.h>
|
||||
#include <gui/BufferQueueDefs.h>
|
||||
#include <gui/BufferSlot.h>
|
||||
|
||||
@ -45,7 +46,6 @@
|
||||
|
||||
namespace android {
|
||||
|
||||
class BufferItem;
|
||||
class IConsumerListener;
|
||||
class IGraphicBufferAlloc;
|
||||
class IProducerListener;
|
||||
@ -58,7 +58,7 @@ class BufferQueueCore : public virtual RefBase {
|
||||
public:
|
||||
// Used as a placeholder slot number when the value isn't pointing to an
|
||||
// existing buffer.
|
||||
enum { INVALID_BUFFER_SLOT = -1 }; // TODO: Extract from IGBC::BufferItem
|
||||
enum { INVALID_BUFFER_SLOT = BufferItem::INVALID_BUFFER_SLOT };
|
||||
|
||||
// We reserve two slots in order to guarantee that the producer and
|
||||
// consumer can run asynchronously.
|
||||
|
@ -154,7 +154,6 @@ protected:
|
||||
// to a slot. If it is overridden the derived class's implementation must
|
||||
// call ConsumerBase::acquireBufferLocked.
|
||||
virtual status_t acquireBufferLocked(BufferItem *item, nsecs_t presentWhen);
|
||||
virtual status_t acquireBufferLocked(BufferQueue::BufferItem *item, nsecs_t presentWhen);
|
||||
|
||||
// releaseBufferLocked relinquishes control over a buffer, returning that
|
||||
// control to the BufferQueue.
|
||||
|
@ -242,7 +242,6 @@ protected:
|
||||
// acquireBufferLocked overrides the ConsumerBase method to update the
|
||||
// mEglSlots array in addition to the ConsumerBase behavior.
|
||||
virtual status_t acquireBufferLocked(BufferItem *item, nsecs_t presentWhen);
|
||||
virtual status_t acquireBufferLocked(IGraphicBufferConsumer::BufferItem *item, nsecs_t presentWhen);
|
||||
|
||||
// releaseBufferLocked overrides the ConsumerBase method to update the
|
||||
// mEglSlots array in addition to the ConsumerBase.
|
||||
@ -260,7 +259,7 @@ protected:
|
||||
// This releases the buffer in the slot referenced by mCurrentTexture,
|
||||
// then updates state to refer to the BufferItem, which must be a
|
||||
// newly-acquired buffer.
|
||||
status_t updateAndReleaseLocked(const BufferQueue::BufferItem& item);
|
||||
status_t updateAndReleaseLocked(const BufferItem& item);
|
||||
|
||||
// Binds mTexName and the current buffer to mTexTarget. Uses
|
||||
// mCurrentTexture if it's set, mCurrentTextureImage if not. If the
|
||||
|
@ -43,75 +43,6 @@ class NativeHandle;
|
||||
class IGraphicBufferConsumer : public IInterface {
|
||||
|
||||
public:
|
||||
|
||||
// public facing structure for BufferSlot
|
||||
class BufferItem : public Flattenable<BufferItem> {
|
||||
friend class Flattenable<BufferItem>;
|
||||
size_t getPodSize() const;
|
||||
size_t getFlattenedSize() const;
|
||||
size_t getFdCount() const;
|
||||
status_t flatten(void*& buffer, size_t& size, int*& fds, size_t& count) const;
|
||||
status_t unflatten(void const*& buffer, size_t& size, int const*& fds, size_t& count);
|
||||
|
||||
public:
|
||||
// The default value of mBuf, used to indicate this doesn't correspond to a slot.
|
||||
enum { INVALID_BUFFER_SLOT = -1 };
|
||||
BufferItem();
|
||||
|
||||
// mGraphicBuffer points to the buffer allocated for this slot, or is NULL
|
||||
// if the buffer in this slot has been acquired in the past (see
|
||||
// BufferSlot.mAcquireCalled).
|
||||
sp<GraphicBuffer> mGraphicBuffer;
|
||||
|
||||
// mFence is a fence that will signal when the buffer is idle.
|
||||
sp<Fence> mFence;
|
||||
|
||||
// mCrop is the current crop rectangle for this buffer slot.
|
||||
Rect mCrop;
|
||||
|
||||
// mTransform is the current transform flags for this buffer slot.
|
||||
// refer to NATIVE_WINDOW_TRANSFORM_* in <window.h>
|
||||
uint32_t mTransform;
|
||||
|
||||
// mScalingMode is the current scaling mode for this buffer slot.
|
||||
// refer to NATIVE_WINDOW_SCALING_* in <window.h>
|
||||
uint32_t mScalingMode;
|
||||
|
||||
// mTimestamp is the current timestamp for this buffer slot. This gets
|
||||
// to set by queueBuffer each time this slot is queued. This value
|
||||
// is guaranteed to be monotonically increasing for each newly
|
||||
// acquired buffer.
|
||||
int64_t mTimestamp;
|
||||
|
||||
// mIsAutoTimestamp indicates whether mTimestamp was generated
|
||||
// automatically when the buffer was queued.
|
||||
bool mIsAutoTimestamp;
|
||||
|
||||
// mDataSpace is the current dataSpace for this buffer slot. This gets
|
||||
// set by queueBuffer each time this slot is queued.
|
||||
android_dataspace mDataSpace;
|
||||
|
||||
// mFrameNumber is the number of the queued frame for this slot.
|
||||
uint64_t mFrameNumber;
|
||||
|
||||
// mBuf is the slot index of this buffer (default INVALID_BUFFER_SLOT).
|
||||
int mBuf;
|
||||
|
||||
// mIsDroppable whether this buffer was queued with the
|
||||
// property that it can be replaced by a new buffer for the purpose of
|
||||
// making sure dequeueBuffer() won't block.
|
||||
// i.e.: was the BufferQueue in "mDequeueBufferCannotBlock" when this buffer
|
||||
// was queued.
|
||||
bool mIsDroppable;
|
||||
|
||||
// Indicates whether this buffer has been seen by a consumer yet
|
||||
bool mAcquireCalled;
|
||||
|
||||
// Indicates this buffer must be transformed by the inverse transform of the screen
|
||||
// it is displayed onto. This is applied after mTransform.
|
||||
bool mTransformToDisplayInverse;
|
||||
};
|
||||
|
||||
enum {
|
||||
// Returned by releaseBuffer, after which the consumer must
|
||||
// free any references to the just-released buffer that it might have.
|
||||
@ -148,7 +79,6 @@ 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
|
||||
|
@ -37,41 +37,8 @@ BufferItem::BufferItem() :
|
||||
mCrop.makeInvalid();
|
||||
}
|
||||
|
||||
BufferItem::BufferItem(const IGraphicBufferConsumer::BufferItem& item) :
|
||||
mGraphicBuffer(item.mGraphicBuffer),
|
||||
mFence(item.mFence),
|
||||
mCrop(item.mCrop),
|
||||
mTransform(item.mTransform),
|
||||
mScalingMode(item.mScalingMode),
|
||||
mTimestamp(item.mTimestamp),
|
||||
mIsAutoTimestamp(item.mIsAutoTimestamp),
|
||||
mDataSpace(item.mDataSpace),
|
||||
mFrameNumber(item.mFrameNumber),
|
||||
mSlot(item.mBuf),
|
||||
mIsDroppable(item.mIsDroppable),
|
||||
mAcquireCalled(item.mAcquireCalled),
|
||||
mTransformToDisplayInverse(item.mTransformToDisplayInverse) {}
|
||||
|
||||
BufferItem::~BufferItem() {}
|
||||
|
||||
BufferItem::operator IGraphicBufferConsumer::BufferItem() const {
|
||||
IGraphicBufferConsumer::BufferItem bufferItem;
|
||||
bufferItem.mGraphicBuffer = mGraphicBuffer;
|
||||
bufferItem.mFence = mFence;
|
||||
bufferItem.mCrop = mCrop;
|
||||
bufferItem.mTransform = mTransform;
|
||||
bufferItem.mScalingMode = mScalingMode;
|
||||
bufferItem.mTimestamp = mTimestamp;
|
||||
bufferItem.mIsAutoTimestamp = mIsAutoTimestamp;
|
||||
bufferItem.mDataSpace = mDataSpace;
|
||||
bufferItem.mFrameNumber = mFrameNumber;
|
||||
bufferItem.mBuf = mSlot;
|
||||
bufferItem.mIsDroppable = mIsDroppable;
|
||||
bufferItem.mAcquireCalled = mAcquireCalled;
|
||||
bufferItem.mTransformToDisplayInverse = mTransformToDisplayInverse;
|
||||
return bufferItem;
|
||||
}
|
||||
|
||||
size_t BufferItem::getPodSize() const {
|
||||
size_t c = sizeof(mCrop) +
|
||||
sizeof(mTransform) +
|
||||
|
@ -53,7 +53,7 @@ void BufferItemConsumer::setName(const String8& name) {
|
||||
mConsumer->setConsumerName(name);
|
||||
}
|
||||
|
||||
status_t BufferItemConsumer::acquireBuffer(BufferQueue::BufferItem *item,
|
||||
status_t BufferItemConsumer::acquireBuffer(BufferItem *item,
|
||||
nsecs_t presentWhen, bool waitForFence) {
|
||||
status_t err;
|
||||
|
||||
@ -83,17 +83,6 @@ status_t BufferItemConsumer::acquireBuffer(BufferQueue::BufferItem *item,
|
||||
return OK;
|
||||
}
|
||||
|
||||
status_t BufferItemConsumer::acquireBuffer(android::BufferItem* outItem,
|
||||
nsecs_t presentWhen, bool waitForFence) {
|
||||
BufferQueue::BufferItem item;
|
||||
status_t result = acquireBuffer(&item, presentWhen, waitForFence);
|
||||
if (result != NO_ERROR) {
|
||||
return result;
|
||||
}
|
||||
*outItem = item;
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
status_t BufferItemConsumer::releaseBuffer(const BufferItem &item,
|
||||
const sp<Fence>& releaseFence) {
|
||||
status_t err;
|
||||
|
@ -32,7 +32,7 @@ BufferQueue::ProxyConsumerListener::ProxyConsumerListener(
|
||||
BufferQueue::ProxyConsumerListener::~ProxyConsumerListener() {}
|
||||
|
||||
void BufferQueue::ProxyConsumerListener::onFrameAvailable(
|
||||
const android::BufferItem& item) {
|
||||
const BufferItem& item) {
|
||||
sp<ConsumerListener> listener(mConsumerListener.promote());
|
||||
if (listener != NULL) {
|
||||
listener->onFrameAvailable(item);
|
||||
|
@ -176,22 +176,6 @@ 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;
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -200,17 +200,6 @@ status_t ConsumerBase::acquireBufferLocked(BufferItem *item,
|
||||
return OK;
|
||||
}
|
||||
|
||||
status_t ConsumerBase::acquireBufferLocked(BufferQueue::BufferItem *outItem,
|
||||
nsecs_t presentWhen) {
|
||||
BufferItem item;
|
||||
status_t result = acquireBufferLocked(&item, presentWhen);
|
||||
if (result != NO_ERROR) {
|
||||
return result;
|
||||
}
|
||||
*outItem = item;
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
status_t ConsumerBase::addReleaseFence(int slot,
|
||||
const sp<GraphicBuffer> graphicBuffer, const sp<Fence>& fence) {
|
||||
Mutex::Autolock lock(mMutex);
|
||||
|
@ -361,17 +361,6 @@ status_t GLConsumer::acquireBufferLocked(BufferItem *item,
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
status_t GLConsumer::acquireBufferLocked(BufferQueue::BufferItem *outItem,
|
||||
nsecs_t presentWhen) {
|
||||
BufferItem item;
|
||||
status_t result = acquireBufferLocked(&item, presentWhen);
|
||||
if (result != NO_ERROR) {
|
||||
return result;
|
||||
}
|
||||
*outItem = item;
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
status_t GLConsumer::releaseBufferLocked(int buf,
|
||||
sp<GraphicBuffer> graphicBuffer,
|
||||
EGLDisplay display, EGLSyncKHR eglFence) {
|
||||
@ -385,7 +374,7 @@ status_t GLConsumer::releaseBufferLocked(int buf,
|
||||
return err;
|
||||
}
|
||||
|
||||
status_t GLConsumer::updateAndReleaseLocked(const BufferQueue::BufferItem& item)
|
||||
status_t GLConsumer::updateAndReleaseLocked(const BufferItem& item)
|
||||
{
|
||||
status_t err = NO_ERROR;
|
||||
|
||||
|
@ -33,163 +33,6 @@
|
||||
#include <system/window.h>
|
||||
|
||||
namespace android {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
IGraphicBufferConsumer::BufferItem::BufferItem() :
|
||||
mTransform(0),
|
||||
mScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE),
|
||||
mTimestamp(0),
|
||||
mIsAutoTimestamp(false),
|
||||
mDataSpace(HAL_DATASPACE_UNKNOWN),
|
||||
mFrameNumber(0),
|
||||
mBuf(INVALID_BUFFER_SLOT),
|
||||
mIsDroppable(false),
|
||||
mAcquireCalled(false),
|
||||
mTransformToDisplayInverse(false) {
|
||||
mCrop.makeInvalid();
|
||||
}
|
||||
|
||||
size_t IGraphicBufferConsumer::BufferItem::getPodSize() const {
|
||||
size_t c = sizeof(mCrop) +
|
||||
sizeof(mTransform) +
|
||||
sizeof(mScalingMode) +
|
||||
sizeof(mTimestamp) +
|
||||
sizeof(mIsAutoTimestamp) +
|
||||
sizeof(mDataSpace) +
|
||||
sizeof(mFrameNumber) +
|
||||
sizeof(mBuf) +
|
||||
sizeof(mIsDroppable) +
|
||||
sizeof(mAcquireCalled) +
|
||||
sizeof(mTransformToDisplayInverse);
|
||||
return c;
|
||||
}
|
||||
|
||||
size_t IGraphicBufferConsumer::BufferItem::getFlattenedSize() const {
|
||||
size_t c = 0;
|
||||
if (mGraphicBuffer != 0) {
|
||||
c += mGraphicBuffer->getFlattenedSize();
|
||||
c = FlattenableUtils::align<4>(c);
|
||||
}
|
||||
if (mFence != 0) {
|
||||
c += mFence->getFlattenedSize();
|
||||
c = FlattenableUtils::align<4>(c);
|
||||
}
|
||||
return sizeof(int32_t) + c + getPodSize();
|
||||
}
|
||||
|
||||
size_t IGraphicBufferConsumer::BufferItem::getFdCount() const {
|
||||
size_t c = 0;
|
||||
if (mGraphicBuffer != 0) {
|
||||
c += mGraphicBuffer->getFdCount();
|
||||
}
|
||||
if (mFence != 0) {
|
||||
c += mFence->getFdCount();
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
static void writeBoolAsInt(void*& buffer, size_t& size, bool b) {
|
||||
FlattenableUtils::write(buffer, size, static_cast<int32_t>(b));
|
||||
}
|
||||
|
||||
static bool readBoolFromInt(void const*& buffer, size_t& size) {
|
||||
int32_t i;
|
||||
FlattenableUtils::read(buffer, size, i);
|
||||
return static_cast<bool>(i);
|
||||
}
|
||||
|
||||
status_t IGraphicBufferConsumer::BufferItem::flatten(
|
||||
void*& buffer, size_t& size, int*& fds, size_t& count) const {
|
||||
|
||||
// make sure we have enough space
|
||||
if (size < BufferItem::getFlattenedSize()) {
|
||||
return NO_MEMORY;
|
||||
}
|
||||
|
||||
// content flags are stored first
|
||||
uint32_t& flags = *static_cast<uint32_t*>(buffer);
|
||||
|
||||
// advance the pointer
|
||||
FlattenableUtils::advance(buffer, size, sizeof(uint32_t));
|
||||
|
||||
flags = 0;
|
||||
if (mGraphicBuffer != 0) {
|
||||
status_t err = mGraphicBuffer->flatten(buffer, size, fds, count);
|
||||
if (err) return err;
|
||||
size -= FlattenableUtils::align<4>(buffer);
|
||||
flags |= 1;
|
||||
}
|
||||
if (mFence != 0) {
|
||||
status_t err = mFence->flatten(buffer, size, fds, count);
|
||||
if (err) return err;
|
||||
size -= FlattenableUtils::align<4>(buffer);
|
||||
flags |= 2;
|
||||
}
|
||||
|
||||
// check we have enough space (in case flattening the fence/graphicbuffer lied to us)
|
||||
if (size < getPodSize()) {
|
||||
return NO_MEMORY;
|
||||
}
|
||||
|
||||
FlattenableUtils::write(buffer, size, mCrop);
|
||||
FlattenableUtils::write(buffer, size, mTransform);
|
||||
FlattenableUtils::write(buffer, size, mScalingMode);
|
||||
FlattenableUtils::write(buffer, size, mTimestamp);
|
||||
writeBoolAsInt(buffer, size, mIsAutoTimestamp);
|
||||
FlattenableUtils::write(buffer, size, mDataSpace);
|
||||
FlattenableUtils::write(buffer, size, mFrameNumber);
|
||||
FlattenableUtils::write(buffer, size, mBuf);
|
||||
writeBoolAsInt(buffer, size, mIsDroppable);
|
||||
writeBoolAsInt(buffer, size, mAcquireCalled);
|
||||
writeBoolAsInt(buffer, size, mTransformToDisplayInverse);
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
status_t IGraphicBufferConsumer::BufferItem::unflatten(
|
||||
void const*& buffer, size_t& size, int const*& fds, size_t& count) {
|
||||
|
||||
if (size < sizeof(uint32_t))
|
||||
return NO_MEMORY;
|
||||
|
||||
uint32_t flags = 0;
|
||||
FlattenableUtils::read(buffer, size, flags);
|
||||
|
||||
if (flags & 1) {
|
||||
mGraphicBuffer = new GraphicBuffer();
|
||||
status_t err = mGraphicBuffer->unflatten(buffer, size, fds, count);
|
||||
if (err) return err;
|
||||
size -= FlattenableUtils::align<4>(buffer);
|
||||
}
|
||||
|
||||
if (flags & 2) {
|
||||
mFence = new Fence();
|
||||
status_t err = mFence->unflatten(buffer, size, fds, count);
|
||||
if (err) return err;
|
||||
size -= FlattenableUtils::align<4>(buffer);
|
||||
}
|
||||
|
||||
// check we have enough space
|
||||
if (size < getPodSize()) {
|
||||
return NO_MEMORY;
|
||||
}
|
||||
|
||||
FlattenableUtils::read(buffer, size, mCrop);
|
||||
FlattenableUtils::read(buffer, size, mTransform);
|
||||
FlattenableUtils::read(buffer, size, mScalingMode);
|
||||
FlattenableUtils::read(buffer, size, mTimestamp);
|
||||
mIsAutoTimestamp = readBoolFromInt(buffer, size);
|
||||
FlattenableUtils::read(buffer, size, mDataSpace);
|
||||
FlattenableUtils::read(buffer, size, mFrameNumber);
|
||||
FlattenableUtils::read(buffer, size, mBuf);
|
||||
mIsDroppable = readBoolFromInt(buffer, size);
|
||||
mAcquireCalled = readBoolFromInt(buffer, size);
|
||||
mTransformToDisplayInverse = readBoolFromInt(buffer, size);
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
enum {
|
||||
ACQUIRE_BUFFER = IBinder::FIRST_CALL_TRANSACTION,
|
||||
@ -238,21 +81,6 @@ 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