From 1acd6961737cc32627d8298999878c2674328b6b Mon Sep 17 00:00:00 2001 From: Valerie Hau Date: Mon, 28 Oct 2019 16:35:48 -0700 Subject: Pass back transformHint on Surface Creation Bug: 141939598 Test: build, boot, SurfaceFlinger_test, libgui_test, libsurfaceflinger_unittest Change-Id: I35a77ac1399ad4248cb1c2357afb869de4c15170 --- libs/gui/SurfaceControl.cpp | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) (limited to 'libs/gui/SurfaceControl.cpp') diff --git a/libs/gui/SurfaceControl.cpp b/libs/gui/SurfaceControl.cpp index 071314f082..6292388ac3 100644 --- a/libs/gui/SurfaceControl.cpp +++ b/libs/gui/SurfaceControl.cpp @@ -45,20 +45,21 @@ namespace android { // SurfaceControl // ============================================================================ -SurfaceControl::SurfaceControl( - const sp& client, - const sp& handle, - const sp& gbp, - bool owned) - : mClient(client), mHandle(handle), mGraphicBufferProducer(gbp), mOwned(owned) -{ -} +SurfaceControl::SurfaceControl(const sp& client, const sp& handle, + const sp& gbp, bool owned, + uint32_t transform) + : mClient(client), + mHandle(handle), + mGraphicBufferProducer(gbp), + mOwned(owned), + mTransformHint(transform) {} SurfaceControl::SurfaceControl(const sp& other) { mClient = other->mClient; mHandle = other->mHandle; mGraphicBufferProducer = other->mGraphicBufferProducer; mOwned = false; + mTransformHint = other->mTransformHint; } SurfaceControl::~SurfaceControl() @@ -171,11 +172,22 @@ sp SurfaceControl::getClient() const return mClient; } +uint32_t SurfaceControl::getTransformHint() const { + Mutex::Autolock _l(mLock); + return mTransformHint; +} + +void SurfaceControl::setTransformHint(uint32_t hint) { + Mutex::Autolock _l(mLock); + mTransformHint = hint; +} + void SurfaceControl::writeToParcel(Parcel* parcel) { parcel->writeStrongBinder(ISurfaceComposerClient::asBinder(mClient->getClient())); parcel->writeStrongBinder(mHandle); parcel->writeStrongBinder(IGraphicBufferProducer::asBinder(mGraphicBufferProducer)); + parcel->writeUint32(mTransformHint); } sp SurfaceControl::readFromParcel(const Parcel* parcel) { @@ -189,10 +201,12 @@ sp SurfaceControl::readFromParcel(const Parcel* parcel) { sp gbp; parcel->readNullableStrongBinder(&gbp); + uint32_t transformHint = parcel->readUint32(); // We aren't the original owner of the surface. return new SurfaceControl(new SurfaceComposerClient( - interface_cast(client)), - handle.get(), interface_cast(gbp), false /* owned */); + interface_cast(client)), + handle.get(), interface_cast(gbp), + false /* owned */, transformHint); } // ---------------------------------------------------------------------------- -- cgit v1.2.3-59-g8ed1b