diff options
author | 2009-08-10 21:59:56 -0700 | |
---|---|---|
committer | 2009-08-11 16:12:56 -0700 | |
commit | 8b76a0ac6fbf07254629ed1ea86af014d5abe050 (patch) | |
tree | e492e09655269fff3ca14b6a62f9b07f2d484038 /libs/ui/ISurface.cpp | |
parent | c5ea43920919eeaec4ec0686de9fa3d034d82337 (diff) |
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.
This change makes SurfaceHolder.setType(GPU) obsolete (it's now ignored).
Added an API to android_native_window_t to allow extending the functionality without ever breaking binary compatibility. This is used to implement the new set_usage() API. This API needs to be called by software renderers because the default is to use usage flags suitable for h/w.
Diffstat (limited to 'libs/ui/ISurface.cpp')
-rw-r--r-- | libs/ui/ISurface.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libs/ui/ISurface.cpp b/libs/ui/ISurface.cpp index 9fbae1ebafe1..b78e8b5ab5a1 100644 --- a/libs/ui/ISurface.cpp +++ b/libs/ui/ISurface.cpp @@ -71,10 +71,11 @@ public: { } - 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 @@ status_t BnSurface::onTransact( 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: { |