summaryrefslogtreecommitdiffstats
path: root/libs/gui
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2013-07-31 20:09:53 -0700
committerMathias Agopian <mathias@google.com>2013-08-01 17:20:08 -0700
commita4e19521ac4563f2ff6517bcfd63d9b8d33a6d0b (patch)
tree2ea2866fb6b49eabdc207bb42715665df2c94799 /libs/gui
parentba93b3f8e403636b614a4a379f9421bc70dca84f (diff)
downloadframeworks_native-a4e19521ac4563f2ff6517bcfd63d9b8d33a6d0b.zip
frameworks_native-a4e19521ac4563f2ff6517bcfd63d9b8d33a6d0b.tar.gz
frameworks_native-a4e19521ac4563f2ff6517bcfd63d9b8d33a6d0b.tar.bz2
Binderize the consumer side of BufferQueue
While currently untested, this should allow to move the BuffereQueue in the consumer process and have everything work as usual. Bug: 9265647 Change-Id: I9ca8f099f7c65b9a27b7e7a3643b46d1b58eacfc
Diffstat (limited to 'libs/gui')
-rw-r--r--libs/gui/Android.mk2
-rw-r--r--libs/gui/BufferQueue.cpp15
-rw-r--r--libs/gui/ConsumerBase.cpp6
-rw-r--r--libs/gui/IConsumerListener.cpp77
-rw-r--r--libs/gui/IGraphicBufferConsumer.cpp459
-rw-r--r--libs/gui/tests/BufferQueue_test.cpp2
-rw-r--r--libs/gui/tests/SurfaceTexture_test.cpp2
7 files changed, 550 insertions, 13 deletions
diff --git a/libs/gui/Android.mk b/libs/gui/Android.mk
index f627e5d..c14c950 100644
--- a/libs/gui/Android.mk
+++ b/libs/gui/Android.mk
@@ -2,6 +2,8 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
+ IGraphicBufferConsumer.cpp \
+ IConsumerListener.cpp \
BitTube.cpp \
BufferItemConsumer.cpp \
BufferQueue.cpp \
diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp
index e20ac86..8524a8b 100644
--- a/libs/gui/BufferQueue.cpp
+++ b/libs/gui/BufferQueue.cpp
@@ -25,6 +25,7 @@
#include <EGL/eglext.h>
#include <gui/BufferQueue.h>
+#include <gui/IConsumerListener.h>
#include <gui/ISurfaceComposer.h>
#include <private/gui/ComposerService.h>
@@ -138,7 +139,7 @@ status_t BufferQueue::setTransformHint(uint32_t hint) {
status_t BufferQueue::setBufferCount(int bufferCount) {
ST_LOGV("setBufferCount: count=%d", bufferCount);
- sp<ConsumerListener> listener;
+ sp<IConsumerListener> listener;
{
Mutex::Autolock lock(mMutex);
@@ -492,7 +493,7 @@ status_t BufferQueue::queueBuffer(int buf,
return -EINVAL;
}
- sp<ConsumerListener> listener;
+ sp<IConsumerListener> listener;
{ // scope for the lock
Mutex::Autolock lock(mMutex);
@@ -675,7 +676,7 @@ status_t BufferQueue::disconnect(int api) {
ST_LOGV("disconnect: api=%d", api);
int err = NO_ERROR;
- sp<ConsumerListener> listener;
+ sp<IConsumerListener> listener;
{ // Scope for the lock
Mutex::Autolock lock(mMutex);
@@ -951,7 +952,7 @@ status_t BufferQueue::releaseBuffer(
return NO_ERROR;
}
-status_t BufferQueue::consumerConnect(const sp<ConsumerListener>& consumerListener,
+status_t BufferQueue::consumerConnect(const sp<IConsumerListener>& consumerListener,
bool controlledByApp) {
ST_LOGV("consumerConnect");
Mutex::Autolock lock(mMutex);
@@ -1127,20 +1128,20 @@ bool BufferQueue::stillTracking(const BufferItem *item) const {
}
BufferQueue::ProxyConsumerListener::ProxyConsumerListener(
- const wp<BufferQueue::ConsumerListener>& consumerListener):
+ const wp<ConsumerListener>& consumerListener):
mConsumerListener(consumerListener) {}
BufferQueue::ProxyConsumerListener::~ProxyConsumerListener() {}
void BufferQueue::ProxyConsumerListener::onFrameAvailable() {
- sp<BufferQueue::ConsumerListener> listener(mConsumerListener.promote());
+ sp<ConsumerListener> listener(mConsumerListener.promote());
if (listener != NULL) {
listener->onFrameAvailable();
}
}
void BufferQueue::ProxyConsumerListener::onBuffersReleased() {
- sp<BufferQueue::ConsumerListener> listener(mConsumerListener.promote());
+ sp<ConsumerListener> listener(mConsumerListener.promote());
if (listener != NULL) {
listener->onBuffersReleased();
}
diff --git a/libs/gui/ConsumerBase.cpp b/libs/gui/ConsumerBase.cpp
index cd94ce1..d748786 100644
--- a/libs/gui/ConsumerBase.cpp
+++ b/libs/gui/ConsumerBase.cpp
@@ -61,10 +61,8 @@ ConsumerBase::ConsumerBase(const sp<BufferQueue>& bufferQueue, bool controlledBy
// reference once the ctor ends, as that would cause the refcount of 'this'
// dropping to 0 at the end of the ctor. Since all we need is a wp<...>
// that's what we create.
- wp<BufferQueue::ConsumerListener> listener;
- sp<BufferQueue::ConsumerListener> proxy;
- listener = static_cast<BufferQueue::ConsumerListener*>(this);
- proxy = new BufferQueue::ProxyConsumerListener(listener);
+ wp<ConsumerListener> listener = static_cast<ConsumerListener*>(this);
+ sp<IConsumerListener> proxy = new BufferQueue::ProxyConsumerListener(listener);
status_t err = mBufferQueue->consumerConnect(proxy, controlledByApp);
if (err != NO_ERROR) {
diff --git a/libs/gui/IConsumerListener.cpp b/libs/gui/IConsumerListener.cpp
new file mode 100644
index 0000000..5304462
--- /dev/null
+++ b/libs/gui/IConsumerListener.cpp
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#include <binder/IInterface.h>
+#include <binder/Parcel.h>
+
+#include <gui/IConsumerListener.h>
+
+// ---------------------------------------------------------------------------
+namespace android {
+// ---------------------------------------------------------------------------
+
+enum {
+ ON_FRAME_AVAILABLE = IBinder::FIRST_CALL_TRANSACTION,
+ ON_BUFFER_RELEASED
+};
+
+class BpConsumerListener : public BpInterface<IConsumerListener>
+{
+public:
+ BpConsumerListener(const sp<IBinder>& impl)
+ : BpInterface<IConsumerListener>(impl) {
+ }
+
+ virtual void onFrameAvailable() {
+ Parcel data, reply;
+ data.writeInterfaceToken(IConsumerListener::getInterfaceDescriptor());
+ remote()->transact(ON_FRAME_AVAILABLE, data, &reply, IBinder::FLAG_ONEWAY);
+ }
+
+ virtual void onBuffersReleased() {
+ Parcel data, reply;
+ data.writeInterfaceToken(IConsumerListener::getInterfaceDescriptor());
+ remote()->transact(ON_BUFFER_RELEASED, data, &reply, IBinder::FLAG_ONEWAY);
+ }
+};
+
+IMPLEMENT_META_INTERFACE(ConsumerListener, "android.gui.IConsumerListener");
+
+// ----------------------------------------------------------------------
+
+status_t BnConsumerListener::onTransact(
+ uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
+{
+ switch(code) {
+ case ON_FRAME_AVAILABLE:
+ CHECK_INTERFACE(IConsumerListener, data, reply);
+ onFrameAvailable();
+ return NO_ERROR;
+ case ON_BUFFER_RELEASED:
+ CHECK_INTERFACE(IConsumerListener, data, reply);
+ onBuffersReleased();
+ return NO_ERROR;
+ }
+ return BBinder::onTransact(code, data, reply, flags);
+}
+
+
+// ---------------------------------------------------------------------------
+}; // namespace android
+// ---------------------------------------------------------------------------
diff --git a/libs/gui/IGraphicBufferConsumer.cpp b/libs/gui/IGraphicBufferConsumer.cpp
new file mode 100644
index 0000000..5263281
--- /dev/null
+++ b/libs/gui/IGraphicBufferConsumer.cpp
@@ -0,0 +1,459 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define EGL_EGLEXT_PROTOTYPES
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#include <utils/Errors.h>
+
+#include <binder/Parcel.h>
+#include <binder/IInterface.h>
+
+#include <gui/IConsumerListener.h>
+#include <gui/IGraphicBufferConsumer.h>
+
+#include <ui/GraphicBuffer.h>
+#include <ui/Fence.h>
+
+#include <system/window.h>
+
+namespace android {
+// ---------------------------------------------------------------------------
+
+IGraphicBufferConsumer::BufferItem::BufferItem() :
+ mTransform(0),
+ mScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE),
+ mTimestamp(0),
+ mFrameNumber(0),
+ mBuf(INVALID_BUFFER_SLOT),
+ mIsDroppable(false),
+ mAcquireCalled(false) {
+ mCrop.makeInvalid();
+}
+
+size_t IGraphicBufferConsumer::BufferItem::getPodSize() const {
+ size_t c = sizeof(mCrop) +
+ sizeof(mTransform) +
+ sizeof(mScalingMode) +
+ sizeof(mTimestamp) +
+ sizeof(mFrameNumber) +
+ sizeof(mBuf) +
+ sizeof(mIsDroppable) +
+ sizeof(mAcquireCalled);
+ return c;
+}
+
+size_t IGraphicBufferConsumer::BufferItem::getFlattenedSize() const {
+ size_t c = 0;
+ if (mGraphicBuffer != 0) {
+ c += mGraphicBuffer->getFlattenedSize();
+ FlattenableUtils::align<4>(c);
+ }
+ if (mFence != 0) {
+ c += mFence->getFlattenedSize();
+ 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;
+}
+
+status_t IGraphicBufferConsumer::BufferItem::flatten(
+ void*& buffer, size_t& size, int*& fds, size_t& count) const {
+
+ // make sure we have enough space
+ if (count < 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);
+ FlattenableUtils::write(buffer, size, mFrameNumber);
+ FlattenableUtils::write(buffer, size, mBuf);
+ FlattenableUtils::write(buffer, size, mIsDroppable);
+ FlattenableUtils::write(buffer, size, mAcquireCalled);
+
+ 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);
+ FlattenableUtils::read(buffer, size, mFrameNumber);
+ FlattenableUtils::read(buffer, size, mBuf);
+ FlattenableUtils::read(buffer, size, mIsDroppable);
+ FlattenableUtils::read(buffer, size, mAcquireCalled);
+
+ return NO_ERROR;
+}
+
+// ---------------------------------------------------------------------------
+
+enum {
+ ACQUIRE_BUFFER = IBinder::FIRST_CALL_TRANSACTION,
+ RELEASE_BUFFER,
+ CONSUMER_CONNECT,
+ CONSUMER_DISCONNECT,
+ GET_RELEASED_BUFFERS,
+ SET_DEFAULT_BUFFER_SIZE,
+ SET_DEFAULT_MAX_BUFFER_COUNT,
+ DISABLE_ASYNC_BUFFER,
+ SET_MAX_ACQUIRED_BUFFER_COUNT,
+ SET_CONSUMER_NAME,
+ SET_DEFAULT_BUFFER_FORMAT,
+ SET_CONSUMER_USAGE_BITS,
+ SET_TRANSFORM_HINT
+};
+
+
+class BpGraphicBufferConsumer : public BpInterface<IGraphicBufferConsumer>
+{
+public:
+ BpGraphicBufferConsumer(const sp<IBinder>& impl)
+ : BpInterface<IGraphicBufferConsumer>(impl)
+ {
+ }
+
+ virtual status_t acquireBuffer(BufferItem *buffer, nsecs_t presentWhen) {
+ Parcel data, reply;
+ data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor());
+ data.writeInt64(presentWhen);
+ status_t result = remote()->transact(ACQUIRE_BUFFER, data, &reply);
+ if (result != NO_ERROR) {
+ return result;
+ }
+ result = reply.read(*buffer);
+ if (result != NO_ERROR) {
+ return result;
+ }
+ return reply.readInt32();
+ }
+
+ virtual status_t releaseBuffer(int buf, uint64_t frameNumber,
+ EGLDisplay display, EGLSyncKHR fence,
+ const sp<Fence>& releaseFence) {
+ Parcel data, reply;
+ data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor());
+ data.writeInt32(buf);
+ data.writeInt64(frameNumber);
+ data.write(*releaseFence);
+ status_t result = remote()->transact(RELEASE_BUFFER, data, &reply);
+ if (result != NO_ERROR) {
+ return result;
+ }
+ return reply.readInt32();
+ }
+
+ virtual status_t consumerConnect(const sp<IConsumerListener>& consumer, bool controlledByApp) {
+ Parcel data, reply;
+ data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor());
+ data.writeStrongBinder(consumer->asBinder());
+ data.writeInt32(controlledByApp);
+ status_t result = remote()->transact(CONSUMER_CONNECT, data, &reply);
+ if (result != NO_ERROR) {
+ return result;
+ }
+ return reply.readInt32();
+ }
+
+ virtual status_t consumerDisconnect() {
+ Parcel data, reply;
+ data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor());
+ status_t result = remote()->transact(CONSUMER_DISCONNECT, data, &reply);
+ if (result != NO_ERROR) {
+ return result;
+ }
+ return reply.readInt32();
+ }
+
+ virtual status_t getReleasedBuffers(uint32_t* slotMask) {
+ Parcel data, reply;
+ data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor());
+ status_t result = remote()->transact(GET_RELEASED_BUFFERS, data, &reply);
+ if (result != NO_ERROR) {
+ return result;
+ }
+ *slotMask = reply.readInt32();
+ return reply.readInt32();
+ }
+
+ virtual status_t setDefaultBufferSize(uint32_t w, uint32_t h) {
+ Parcel data, reply;
+ data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor());
+ data.writeInt32(w);
+ data.writeInt32(h);
+ status_t result = remote()->transact(SET_DEFAULT_BUFFER_SIZE, data, &reply);
+ if (result != NO_ERROR) {
+ return result;
+ }
+ return reply.readInt32();
+ }
+
+ virtual status_t setDefaultMaxBufferCount(int bufferCount) {
+ Parcel data, reply;
+ data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor());
+ data.writeInt32(bufferCount);
+ status_t result = remote()->transact(SET_DEFAULT_MAX_BUFFER_COUNT, data, &reply);
+ if (result != NO_ERROR) {
+ return result;
+ }
+ return reply.readInt32();
+ }
+
+ virtual status_t disableAsyncBuffer() {
+ Parcel data, reply;
+ data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor());
+ status_t result = remote()->transact(DISABLE_ASYNC_BUFFER, data, &reply);
+ if (result != NO_ERROR) {
+ return result;
+ }
+ return reply.readInt32();
+ }
+
+ virtual status_t setMaxAcquiredBufferCount(int maxAcquiredBuffers) {
+ Parcel data, reply;
+ data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor());
+ data.writeInt32(maxAcquiredBuffers);
+ status_t result = remote()->transact(SET_MAX_ACQUIRED_BUFFER_COUNT, data, &reply);
+ if (result != NO_ERROR) {
+ return result;
+ }
+ return reply.readInt32();
+ }
+
+ virtual void setConsumerName(const String8& name) {
+ Parcel data, reply;
+ data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor());
+ data.writeString8(name);
+ remote()->transact(SET_CONSUMER_NAME, data, &reply);
+ }
+
+ virtual status_t setDefaultBufferFormat(uint32_t defaultFormat) {
+ Parcel data, reply;
+ data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor());
+ data.writeInt32(defaultFormat);
+ status_t result = remote()->transact(SET_DEFAULT_BUFFER_FORMAT, data, &reply);
+ if (result != NO_ERROR) {
+ return result;
+ }
+ return reply.readInt32();
+ }
+
+ virtual status_t setConsumerUsageBits(uint32_t usage) {
+ Parcel data, reply;
+ data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor());
+ data.writeInt32(usage);
+ status_t result = remote()->transact(SET_CONSUMER_USAGE_BITS, data, &reply);
+ if (result != NO_ERROR) {
+ return result;
+ }
+ return reply.readInt32();
+ }
+
+ virtual status_t setTransformHint(uint32_t hint) {
+ Parcel data, reply;
+ data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor());
+ data.writeInt32(hint);
+ status_t result = remote()->transact(SET_TRANSFORM_HINT, data, &reply);
+ if (result != NO_ERROR) {
+ return result;
+ }
+ return reply.readInt32();
+ }
+};
+
+IMPLEMENT_META_INTERFACE(GraphicBufferConsumer, "android.gui.IGraphicBufferConsumer");
+
+// ----------------------------------------------------------------------
+
+status_t BnGraphicBufferConsumer::onTransact(
+ uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
+{
+ switch(code) {
+ case ACQUIRE_BUFFER: {
+ CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
+ BufferItem item;
+ int64_t presentWhen = data.readInt64();
+ status_t result = acquireBuffer(&item, presentWhen);
+ status_t err = reply->write(item);
+ if (err) return err;
+ reply->writeInt32(result);
+ return NO_ERROR;
+ } break;
+ case RELEASE_BUFFER: {
+ CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
+ int buf = data.readInt32();
+ uint64_t frameNumber = data.readInt64();
+ sp<Fence> releaseFence = new Fence();
+ status_t err = data.read(*releaseFence);
+ if (err) return err;
+ status_t result = releaseBuffer(buf, frameNumber,
+ EGL_NO_DISPLAY, EGL_NO_SYNC_KHR, releaseFence);
+ reply->writeInt32(result);
+ return NO_ERROR;
+ } break;
+ case CONSUMER_CONNECT: {
+ CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
+ sp<IConsumerListener> consumer = IConsumerListener::asInterface( data.readStrongBinder() );
+ bool controlledByApp = data.readInt32();
+ status_t result = consumerConnect(consumer, controlledByApp);
+ reply->writeInt32(result);
+ return NO_ERROR;
+ } break;
+ case CONSUMER_DISCONNECT: {
+ CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
+ status_t result = consumerDisconnect();
+ reply->writeInt32(result);
+ return NO_ERROR;
+ } break;
+ case GET_RELEASED_BUFFERS: {
+ CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
+ uint32_t slotMask;
+ status_t result = getReleasedBuffers(&slotMask);
+ reply->writeInt32(slotMask);
+ reply->writeInt32(result);
+ return NO_ERROR;
+ } break;
+ case SET_DEFAULT_BUFFER_SIZE: {
+ CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
+ uint32_t w = data.readInt32();
+ uint32_t h = data.readInt32();
+ status_t result = setDefaultBufferSize(w, h);
+ reply->writeInt32(result);
+ return NO_ERROR;
+ } break;
+ case SET_DEFAULT_MAX_BUFFER_COUNT: {
+ CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
+ uint32_t bufferCount = data.readInt32();
+ status_t result = setDefaultMaxBufferCount(bufferCount);
+ reply->writeInt32(result);
+ return NO_ERROR;
+ } break;
+ case DISABLE_ASYNC_BUFFER: {
+ CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
+ status_t result = disableAsyncBuffer();
+ reply->writeInt32(result);
+ return NO_ERROR;
+ } break;
+ case SET_MAX_ACQUIRED_BUFFER_COUNT: {
+ CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
+ uint32_t maxAcquiredBuffers = data.readInt32();
+ status_t result = setMaxAcquiredBufferCount(maxAcquiredBuffers);
+ reply->writeInt32(result);
+ return NO_ERROR;
+ } break;
+ case SET_CONSUMER_NAME: {
+ CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
+ setConsumerName( data.readString8() );
+ return NO_ERROR;
+ } break;
+ case SET_DEFAULT_BUFFER_FORMAT: {
+ CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
+ uint32_t defaultFormat = data.readInt32();
+ status_t result = setDefaultBufferFormat(defaultFormat);
+ reply->writeInt32(result);
+ return NO_ERROR;
+ } break;
+ case SET_CONSUMER_USAGE_BITS: {
+ CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
+ uint32_t usage = data.readInt32();
+ status_t result = setConsumerUsageBits(usage);
+ reply->writeInt32(result);
+ return NO_ERROR;
+ } break;
+ case SET_TRANSFORM_HINT: {
+ CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
+ uint32_t hint = data.readInt32();
+ status_t result = setTransformHint(hint);
+ reply->writeInt32(result);
+ return NO_ERROR;
+ } break;
+ }
+ return BBinder::onTransact(code, data, reply, flags);
+}
+
+}; // namespace android
diff --git a/libs/gui/tests/BufferQueue_test.cpp b/libs/gui/tests/BufferQueue_test.cpp
index b691fc1..da98c8d 100644
--- a/libs/gui/tests/BufferQueue_test.cpp
+++ b/libs/gui/tests/BufferQueue_test.cpp
@@ -55,7 +55,7 @@ protected:
sp<BufferQueue> mBQ;
};
-struct DummyConsumer : public BufferQueue::ConsumerListener {
+struct DummyConsumer : public BnConsumerListener {
virtual void onFrameAvailable() {}
virtual void onBuffersReleased() {}
};
diff --git a/libs/gui/tests/SurfaceTexture_test.cpp b/libs/gui/tests/SurfaceTexture_test.cpp
index e6d87db..ae223c6 100644
--- a/libs/gui/tests/SurfaceTexture_test.cpp
+++ b/libs/gui/tests/SurfaceTexture_test.cpp
@@ -628,7 +628,7 @@ protected:
// no way to forward the events. This DisconnectWaiter will not let the
// disconnect finish until finishDisconnect() is called. It will
// also block until a disconnect is called
- class DisconnectWaiter : public BufferQueue::ConsumerListener {
+ class DisconnectWaiter : public BnConsumerListener {
public:
DisconnectWaiter () :
mWaitForDisconnect(false),