diff options
Diffstat (limited to 'libs/gui/ISurfaceComposerClient.cpp')
-rw-r--r-- | libs/gui/ISurfaceComposerClient.cpp | 56 |
1 files changed, 19 insertions, 37 deletions
diff --git a/libs/gui/ISurfaceComposerClient.cpp b/libs/gui/ISurfaceComposerClient.cpp index 8f7bc05..1adc134 100644 --- a/libs/gui/ISurfaceComposerClient.cpp +++ b/libs/gui/ISurfaceComposerClient.cpp @@ -29,7 +29,7 @@ #include <ui/Point.h> #include <ui/Rect.h> -#include <gui/ISurface.h> +#include <gui/IGraphicBufferProducer.h> #include <gui/ISurfaceComposerClient.h> #include <private/gui/LayerState.h> @@ -46,17 +46,13 @@ class BpSurfaceComposerClient : public BpInterface<ISurfaceComposerClient> { public: BpSurfaceComposerClient(const sp<IBinder>& impl) - : BpInterface<ISurfaceComposerClient>(impl) - { + : BpInterface<ISurfaceComposerClient>(impl) { } - virtual sp<ISurface> createSurface( surface_data_t* params, - const String8& name, - uint32_t w, - uint32_t h, - PixelFormat format, - uint32_t flags) - { + virtual status_t createSurface(const String8& name, uint32_t w, + uint32_t h, PixelFormat format, uint32_t flags, + sp<IBinder>* handle, + sp<IGraphicBufferProducer>* gbp) { Parcel data, reply; data.writeInterfaceToken(ISurfaceComposerClient::getInterfaceDescriptor()); data.writeString8(name); @@ -65,15 +61,15 @@ public: data.writeInt32(format); data.writeInt32(flags); remote()->transact(CREATE_SURFACE, data, &reply); - params->readFromParcel(reply); - return interface_cast<ISurface>(reply.readStrongBinder()); + *handle = reply.readStrongBinder(); + *gbp = interface_cast<IGraphicBufferProducer>(reply.readStrongBinder()); + return reply.readInt32(); } - virtual status_t destroySurface(SurfaceID sid) - { + virtual status_t destroySurface(const sp<IBinder>& handle) { Parcel data, reply; data.writeInterfaceToken(ISurfaceComposerClient::getInterfaceDescriptor()); - data.writeInt32(sid); + data.writeStrongBinder(handle); remote()->transact(DESTROY_SURFACE, data, &reply); return reply.readInt32(); } @@ -89,21 +85,23 @@ status_t BnSurfaceComposerClient::onTransact( switch(code) { case CREATE_SURFACE: { CHECK_INTERFACE(ISurfaceComposerClient, data, reply); - surface_data_t params; String8 name = data.readString8(); uint32_t w = data.readInt32(); uint32_t h = data.readInt32(); PixelFormat format = data.readInt32(); uint32_t flags = data.readInt32(); - sp<ISurface> s = createSurface(¶ms, name, w, h, - format, flags); - params.writeToParcel(reply); - reply->writeStrongBinder(s->asBinder()); + sp<IBinder> handle; + sp<IGraphicBufferProducer> gbp; + status_t result = createSurface(name, w, h, format, flags, + &handle, &gbp); + reply->writeStrongBinder(handle); + reply->writeStrongBinder(gbp->asBinder()); + reply->writeInt32(result); return NO_ERROR; } break; case DESTROY_SURFACE: { CHECK_INTERFACE(ISurfaceComposerClient, data, reply); - reply->writeInt32( destroySurface( data.readInt32() ) ); + reply->writeInt32( destroySurface( data.readStrongBinder() ) ); return NO_ERROR; } break; default: @@ -111,20 +109,4 @@ status_t BnSurfaceComposerClient::onTransact( } } -// ---------------------------------------------------------------------- - -status_t ISurfaceComposerClient::surface_data_t::readFromParcel(const Parcel& parcel) -{ - token = parcel.readInt32(); - identity = parcel.readInt32(); - return NO_ERROR; -} - -status_t ISurfaceComposerClient::surface_data_t::writeToParcel(Parcel* parcel) const -{ - parcel->writeInt32(token); - parcel->writeInt32(identity); - return NO_ERROR; -} - }; // namespace android |