second take, hopefully this time it doesn't break one of the builds: "SurfaceFlinger will now allocate buffers based on the usage specified by the clients. This allows to allocate the right kind of buffer automatically, without having the user to specify anything."
diff --git a/libs/ui/ISurface.cpp b/libs/ui/ISurface.cpp
index 9fbae1e..b78e8b5 100644
--- a/libs/ui/ISurface.cpp
+++ b/libs/ui/ISurface.cpp
@@ -71,10 +71,11 @@
{
}
- virtual sp<SurfaceBuffer> getBuffer()
+ virtual sp<SurfaceBuffer> getBuffer(int usage)
{
Parcel data, reply;
data.writeInterfaceToken(ISurface::getInterfaceDescriptor());
+ data.writeInt32(usage);
remote()->transact(GET_BUFFER, data, &reply);
sp<SurfaceBuffer> buffer = new SurfaceBuffer(reply);
return buffer;
@@ -135,7 +136,8 @@
switch(code) {
case GET_BUFFER: {
CHECK_INTERFACE(ISurface, data, reply);
- sp<SurfaceBuffer> buffer(getBuffer());
+ int usage = data.readInt32();
+ sp<SurfaceBuffer> buffer(getBuffer(usage));
return SurfaceBuffer::writeToParcel(reply, buffer.get());
}
case REGISTER_BUFFERS: {