summaryrefslogtreecommitdiffstats
path: root/libs/gui/IGraphicBufferProducer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/gui/IGraphicBufferProducer.cpp')
-rw-r--r--libs/gui/IGraphicBufferProducer.cpp72
1 files changed, 32 insertions, 40 deletions
diff --git a/libs/gui/IGraphicBufferProducer.cpp b/libs/gui/IGraphicBufferProducer.cpp
index 63d881e..bcdf368 100644
--- a/libs/gui/IGraphicBufferProducer.cpp
+++ b/libs/gui/IGraphicBufferProducer.cpp
@@ -56,8 +56,6 @@ public:
{
}
- virtual ~BpGraphicBufferProducer();
-
virtual status_t requestBuffer(int bufferIdx, sp<GraphicBuffer>* buf) {
Parcel data, reply;
data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor());
@@ -93,15 +91,14 @@ public:
}
virtual status_t dequeueBuffer(int *buf, sp<Fence>* fence, bool async,
- uint32_t width, uint32_t height, PixelFormat format,
- uint32_t usage) {
+ uint32_t w, uint32_t h, uint32_t format, uint32_t usage) {
Parcel data, reply;
data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor());
- data.writeInt32(static_cast<int32_t>(async));
- data.writeUint32(width);
- data.writeUint32(height);
- data.writeInt32(static_cast<int32_t>(format));
- data.writeUint32(usage);
+ data.writeInt32(async);
+ data.writeInt32(w);
+ data.writeInt32(h);
+ data.writeInt32(format);
+ data.writeInt32(usage);
status_t result = remote()->transact(DEQUEUE_BUFFER, data, &reply);
if (result != NO_ERROR) {
return result;
@@ -258,14 +255,14 @@ public:
}
virtual void allocateBuffers(bool async, uint32_t width, uint32_t height,
- PixelFormat format, uint32_t usage) {
+ uint32_t format, uint32_t usage) {
Parcel data, reply;
data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor());
data.writeInt32(static_cast<int32_t>(async));
- data.writeUint32(width);
- data.writeUint32(height);
+ data.writeInt32(static_cast<int32_t>(width));
+ data.writeInt32(static_cast<int32_t>(height));
data.writeInt32(static_cast<int32_t>(format));
- data.writeUint32(usage);
+ data.writeInt32(static_cast<int32_t>(usage));
status_t result = remote()->transact(ALLOCATE_BUFFERS, data, &reply);
if (result != NO_ERROR) {
ALOGE("allocateBuffers failed to transact: %d", result);
@@ -273,10 +270,6 @@ public:
}
};
-// Out-of-line virtual method definition to trigger vtable emission in this
-// translation unit (see clang warning -Wweak-vtables)
-BpGraphicBufferProducer::~BpGraphicBufferProducer() {}
-
IMPLEMENT_META_INTERFACE(GraphicBufferProducer, "android.gui.IGraphicBufferProducer");
// ----------------------------------------------------------------------
@@ -296,25 +289,24 @@ status_t BnGraphicBufferProducer::onTransact(
}
reply->writeInt32(result);
return NO_ERROR;
- }
+ } break;
case SET_BUFFER_COUNT: {
CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
int bufferCount = data.readInt32();
int result = setBufferCount(bufferCount);
reply->writeInt32(result);
return NO_ERROR;
- }
+ } break;
case DEQUEUE_BUFFER: {
CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
- bool async = static_cast<bool>(data.readInt32());
- uint32_t width = data.readUint32();
- uint32_t height = data.readUint32();
- PixelFormat format = static_cast<PixelFormat>(data.readInt32());
- uint32_t usage = data.readUint32();
+ bool async = data.readInt32();
+ uint32_t w = data.readInt32();
+ uint32_t h = data.readInt32();
+ uint32_t format = data.readInt32();
+ uint32_t usage = data.readInt32();
int buf;
sp<Fence> fence;
- int result = dequeueBuffer(&buf, &fence, async, width, height,
- format, usage);
+ int result = dequeueBuffer(&buf, &fence, async, w, h, format, usage);
reply->writeInt32(buf);
reply->writeInt32(fence != NULL);
if (fence != NULL) {
@@ -322,14 +314,14 @@ status_t BnGraphicBufferProducer::onTransact(
}
reply->writeInt32(result);
return NO_ERROR;
- }
+ } break;
case DETACH_BUFFER: {
CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
int slot = data.readInt32();
int result = detachBuffer(slot);
reply->writeInt32(result);
return NO_ERROR;
- }
+ } break;
case DETACH_NEXT_BUFFER: {
CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
sp<GraphicBuffer> buffer;
@@ -347,7 +339,7 @@ status_t BnGraphicBufferProducer::onTransact(
}
}
return NO_ERROR;
- }
+ } break;
case ATTACH_BUFFER: {
CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
sp<GraphicBuffer> buffer = new GraphicBuffer();
@@ -357,7 +349,7 @@ status_t BnGraphicBufferProducer::onTransact(
reply->writeInt32(slot);
reply->writeInt32(result);
return NO_ERROR;
- }
+ } break;
case QUEUE_BUFFER: {
CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
int buf = data.readInt32();
@@ -368,7 +360,7 @@ status_t BnGraphicBufferProducer::onTransact(
status_t result = queueBuffer(buf, input, output);
reply->writeInt32(result);
return NO_ERROR;
- }
+ } break;
case CANCEL_BUFFER: {
CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
int buf = data.readInt32();
@@ -376,7 +368,7 @@ status_t BnGraphicBufferProducer::onTransact(
data.read(*fence.get());
cancelBuffer(buf, fence);
return NO_ERROR;
- }
+ } break;
case QUERY: {
CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
int value;
@@ -385,7 +377,7 @@ status_t BnGraphicBufferProducer::onTransact(
reply->writeInt32(value);
reply->writeInt32(res);
return NO_ERROR;
- }
+ } break;
case CONNECT: {
CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
sp<IProducerListener> listener;
@@ -400,14 +392,14 @@ status_t BnGraphicBufferProducer::onTransact(
status_t res = connect(listener, api, producerControlledByApp, output);
reply->writeInt32(res);
return NO_ERROR;
- }
+ } break;
case DISCONNECT: {
CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
int api = data.readInt32();
status_t res = disconnect(api);
reply->writeInt32(res);
return NO_ERROR;
- }
+ } break;
case SET_SIDEBAND_STREAM: {
CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
sp<NativeHandle> stream;
@@ -417,14 +409,14 @@ status_t BnGraphicBufferProducer::onTransact(
status_t result = setSidebandStream(stream);
reply->writeInt32(result);
return NO_ERROR;
- }
+ } break;
case ALLOCATE_BUFFERS:
CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
bool async = static_cast<bool>(data.readInt32());
- uint32_t width = data.readUint32();
- uint32_t height = data.readUint32();
- PixelFormat format = static_cast<PixelFormat>(data.readInt32());
- uint32_t usage = data.readUint32();
+ uint32_t width = static_cast<uint32_t>(data.readInt32());
+ uint32_t height = static_cast<uint32_t>(data.readInt32());
+ uint32_t format = static_cast<uint32_t>(data.readInt32());
+ uint32_t usage = static_cast<uint32_t>(data.readInt32());
allocateBuffers(async, width, height, format, usage);
return NO_ERROR;
}