summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorDan Stoza <stoza@google.com>2015-03-13 14:40:34 -0700
committerDan Stoza <stoza@google.com>2015-03-20 12:29:04 -0700
commit1c87e474d87d6d1380fb61d476d606b1a2fda1c1 (patch)
tree8b7b36614bcc7f9280531f73dbcacea8a1d96a16 /libs
parent701473cf9bb1d1da2a0f55d9732d3016e1f33d59 (diff)
downloadframeworks_native-1c87e474d87d6d1380fb61d476d606b1a2fda1c1.zip
frameworks_native-1c87e474d87d6d1380fb61d476d606b1a2fda1c1.tar.gz
frameworks_native-1c87e474d87d6d1380fb61d476d606b1a2fda1c1.tar.bz2
DO NOT MERGE libgui: Remove IGBC::BufferItem
Removes IGraphicBufferConsumer::BufferItem. Depends on the following changes: I187b3a7d05196b6289596afac8fb9a9d4aebff76 I0ddd38df37500cfd6b21d1e768ed14e39c5cd9fc Cherry-pick of Id1fa56d092188f2cb712768d5d2fc6a9027fb73c Change-Id: I3edf0db8fba656fd78e18a5a7f1137f0fb6b237d
Diffstat (limited to 'libs')
-rw-r--r--libs/gui/BufferItem.cpp33
-rw-r--r--libs/gui/BufferItemConsumer.cpp13
-rw-r--r--libs/gui/BufferQueue.cpp2
-rw-r--r--libs/gui/BufferQueueConsumer.cpp16
-rw-r--r--libs/gui/ConsumerBase.cpp11
-rw-r--r--libs/gui/GLConsumer.cpp13
-rw-r--r--libs/gui/IGraphicBufferConsumer.cpp172
7 files changed, 3 insertions, 257 deletions
diff --git a/libs/gui/BufferItem.cpp b/libs/gui/BufferItem.cpp
index 389d867..312fb3b 100644
--- a/libs/gui/BufferItem.cpp
+++ b/libs/gui/BufferItem.cpp
@@ -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) +
diff --git a/libs/gui/BufferItemConsumer.cpp b/libs/gui/BufferItemConsumer.cpp
index fb978dd..194121f 100644
--- a/libs/gui/BufferItemConsumer.cpp
+++ b/libs/gui/BufferItemConsumer.cpp
@@ -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;
diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp
index 61fd8c4..2fcbaf2 100644
--- a/libs/gui/BufferQueue.cpp
+++ b/libs/gui/BufferQueue.cpp
@@ -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);
diff --git a/libs/gui/BufferQueueConsumer.cpp b/libs/gui/BufferQueueConsumer.cpp
index 821a744..526c3b7 100644
--- a/libs/gui/BufferQueueConsumer.cpp
+++ b/libs/gui/BufferQueueConsumer.cpp
@@ -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);
diff --git a/libs/gui/ConsumerBase.cpp b/libs/gui/ConsumerBase.cpp
index c8b5d0c..b874e3a 100644
--- a/libs/gui/ConsumerBase.cpp
+++ b/libs/gui/ConsumerBase.cpp
@@ -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);
diff --git a/libs/gui/GLConsumer.cpp b/libs/gui/GLConsumer.cpp
index d256ae5..96c0841 100644
--- a/libs/gui/GLConsumer.cpp
+++ b/libs/gui/GLConsumer.cpp
@@ -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;
diff --git a/libs/gui/IGraphicBufferConsumer.cpp b/libs/gui/IGraphicBufferConsumer.cpp
index edf4408..3f23c2f 100644
--- a/libs/gui/IGraphicBufferConsumer.cpp
+++ b/libs/gui/IGraphicBufferConsumer.cpp
@@ -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());