From 99e27f0bc236e38d88ff4f9912ede514a729b8eb Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Thu, 16 Jun 2016 15:18:02 -0700 Subject: Change setPositionAppliesWithResize to apply to all geometry. To support seamless rotation, change setPositionAppliesWithResize to also include the crop. As the transformation matrix is already frozen during resize, this enables the window manager to set the total geometry state before and after resize in a race free fashion. Bug: 28823590 Change-Id: I3f8f0e162b7ef4e9403c1220c7e4191b3ef30526 --- libs/gui/SurfaceControl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libs/gui/SurfaceControl.cpp') diff --git a/libs/gui/SurfaceControl.cpp b/libs/gui/SurfaceControl.cpp index 4671e505aa..223e1f4ba2 100644 --- a/libs/gui/SurfaceControl.cpp +++ b/libs/gui/SurfaceControl.cpp @@ -112,10 +112,10 @@ status_t SurfaceControl::setPosition(float x, float y) { if (err < 0) return err; return mClient->setPosition(mHandle, x, y); } -status_t SurfaceControl::setPositionAppliesWithResize() { +status_t SurfaceControl::setGeometryAppliesWithResize() { status_t err = validate(); if (err < 0) return err; - return mClient->setPositionAppliesWithResize(mHandle); + return mClient->setGeometryAppliesWithResize(mHandle); } status_t SurfaceControl::setSize(uint32_t w, uint32_t h) { status_t err = validate(); -- cgit v1.2.3-59-g8ed1b From 367c5684f4d417e5176bec12d67f4e2e42738fe0 Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Mon, 20 Jun 2016 11:55:28 -0700 Subject: SurfaceControl: Add getTransformToDisplayInverse For seamless rotation, the window manager needs access to this flag, as it will apply the inverse display transform itself to all other windows. Bug: 28823590 Change-Id: Ifeee1078a9cb4cd01c8052570c137c6228b2f13d --- include/gui/ISurfaceComposerClient.h | 3 ++ include/gui/SurfaceComposerClient.h | 3 ++ include/gui/SurfaceControl.h | 2 + libs/gui/ISurfaceComposerClient.cpp | 51 +++++++++++++++++++++- libs/gui/SurfaceComposerClient.cpp | 8 ++++ libs/gui/SurfaceControl.cpp | 7 +++ services/surfaceflinger/Client.cpp | 10 +++++ services/surfaceflinger/Client.h | 2 + services/surfaceflinger/Layer.cpp | 4 ++ services/surfaceflinger/Layer.h | 2 + services/surfaceflinger/SurfaceFlingerConsumer.cpp | 1 + services/surfaceflinger/SurfaceFlingerConsumer.h | 3 +- 12 files changed, 94 insertions(+), 2 deletions(-) (limited to 'libs/gui/SurfaceControl.cpp') diff --git a/include/gui/ISurfaceComposerClient.h b/include/gui/ISurfaceComposerClient.h index bb79bd02b8..c27a741632 100644 --- a/include/gui/ISurfaceComposerClient.h +++ b/include/gui/ISurfaceComposerClient.h @@ -77,6 +77,9 @@ public: * Requires ACCESS_SURFACE_FLINGER permission */ virtual status_t getLayerFrameStats(const sp& handle, FrameStats* outStats) const = 0; + + virtual status_t getTransformToDisplayInverse(const sp& handle, + bool* outTransformToDisplayInverse) const = 0; }; // ---------------------------------------------------------------------------- diff --git a/include/gui/SurfaceComposerClient.h b/include/gui/SurfaceComposerClient.h index 3d6051e8b6..95e8b70c61 100644 --- a/include/gui/SurfaceComposerClient.h +++ b/include/gui/SurfaceComposerClient.h @@ -147,6 +147,9 @@ public: status_t clearLayerFrameStats(const sp& token) const; status_t getLayerFrameStats(const sp& token, FrameStats* outStats) const; + status_t getTransformToDisplayInverse(const sp& token, + bool* outTransformToDisplayInverse) const; + static status_t clearAnimationFrameStats(); static status_t getAnimationFrameStats(FrameStats* outStats); diff --git a/include/gui/SurfaceControl.h b/include/gui/SurfaceControl.h index 043eb53646..5e731c3964 100644 --- a/include/gui/SurfaceControl.h +++ b/include/gui/SurfaceControl.h @@ -97,6 +97,8 @@ public: status_t clearLayerFrameStats() const; status_t getLayerFrameStats(FrameStats* outStats) const; + status_t getTransformToDisplayInverse(bool* outTransformToDisplayInverse) const; + private: // can't be copied SurfaceControl& operator = (SurfaceControl& rhs); diff --git a/libs/gui/ISurfaceComposerClient.cpp b/libs/gui/ISurfaceComposerClient.cpp index 2ecb9083ff..dd5b169dba 100644 --- a/libs/gui/ISurfaceComposerClient.cpp +++ b/libs/gui/ISurfaceComposerClient.cpp @@ -41,7 +41,8 @@ enum { CREATE_SURFACE = IBinder::FIRST_CALL_TRANSACTION, DESTROY_SURFACE, CLEAR_LAYER_FRAME_STATS, - GET_LAYER_FRAME_STATS + GET_LAYER_FRAME_STATS, + GET_TRANSFORM_TO_DISPLAY_INVERSE }; class BpSurfaceComposerClient : public BpInterface @@ -94,6 +95,35 @@ public: reply.read(*outStats); return reply.readInt32(); } + + virtual status_t getTransformToDisplayInverse(const sp& handle, + bool* outTransformToDisplayInverse) const { + Parcel data, reply; + status_t result = + data.writeInterfaceToken(ISurfaceComposerClient::getInterfaceDescriptor()); + if (result != NO_ERROR) { + return result; + } + result = data.writeStrongBinder(handle); + if (result != NO_ERROR) { + return result; + } + result = remote()->transact(GET_TRANSFORM_TO_DISPLAY_INVERSE, data, &reply); + if (result != NO_ERROR) { + return result; + } + int transformInverse; + result = reply.readInt32(&transformInverse); + if (result != NO_ERROR) { + return result; + } + *outTransformToDisplayInverse = transformInverse != 0 ? true : false; + status_t result2 = reply.readInt32(&result); + if (result2 != NO_ERROR) { + return result2; + } + return result; + } }; // Out-of-line virtual method definition to trigger vtable emission in this @@ -145,6 +175,25 @@ status_t BnSurfaceComposerClient::onTransact( reply->writeInt32(result); return NO_ERROR; } + case GET_TRANSFORM_TO_DISPLAY_INVERSE: { + CHECK_INTERFACE(ISurfaceComposerClient, data, reply); + sp handle; + status_t result = data.readStrongBinder(&handle); + if (result != NO_ERROR) { + return result; + } + bool transformInverse = false; + result = getTransformToDisplayInverse(handle, &transformInverse); + if (result != NO_ERROR) { + return result; + } + result = reply->writeInt32(transformInverse ? 1 : 0); + if (result != NO_ERROR) { + return result; + } + result = reply->writeInt32(NO_ERROR); + return result; + } default: return BBinder::onTransact(code, data, reply, flags); } diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 1620eb2b79..26b2209e6a 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -612,6 +612,14 @@ status_t SurfaceComposerClient::getLayerFrameStats(const sp& token, return mClient->getLayerFrameStats(token, outStats); } +status_t SurfaceComposerClient::getTransformToDisplayInverse(const sp& token, + bool* outTransformToDisplayInverse) const { + if (mStatus != NO_ERROR) { + return mStatus; + } + return mClient->getTransformToDisplayInverse(token, outTransformToDisplayInverse); +} + inline Composer& SurfaceComposerClient::getComposer() { return mComposer; } diff --git a/libs/gui/SurfaceControl.cpp b/libs/gui/SurfaceControl.cpp index 223e1f4ba2..33c1d906e6 100644 --- a/libs/gui/SurfaceControl.cpp +++ b/libs/gui/SurfaceControl.cpp @@ -190,6 +190,13 @@ status_t SurfaceControl::getLayerFrameStats(FrameStats* outStats) const { return client->getLayerFrameStats(mHandle, outStats); } +status_t SurfaceControl::getTransformToDisplayInverse(bool* outTransformToDisplayInverse) const { + status_t err = validate(); + if (err < 0) return err; + const sp& client(mClient); + return client->getTransformToDisplayInverse(mHandle, outTransformToDisplayInverse); +} + status_t SurfaceControl::validate() const { if (mHandle==0 || mClient==0) { diff --git a/services/surfaceflinger/Client.cpp b/services/surfaceflinger/Client.cpp index 2a025b8a93..415bdcae2e 100644 --- a/services/surfaceflinger/Client.cpp +++ b/services/surfaceflinger/Client.cpp @@ -173,5 +173,15 @@ status_t Client::getLayerFrameStats(const sp& handle, FrameStats* outSt return NO_ERROR; } +status_t Client::getTransformToDisplayInverse(const sp& handle, + bool* outTransformToDisplayInverse) const { + sp layer = getLayerUser(handle); + if (layer == NULL) { + return NAME_NOT_FOUND; + } + *outTransformToDisplayInverse = layer->getTransformToDisplayInverse(); + return NO_ERROR; +} + // --------------------------------------------------------------------------- }; // namespace android diff --git a/services/surfaceflinger/Client.h b/services/surfaceflinger/Client.h index b6d738125a..12db50568f 100644 --- a/services/surfaceflinger/Client.h +++ b/services/surfaceflinger/Client.h @@ -63,6 +63,8 @@ private: virtual status_t clearLayerFrameStats(const sp& handle) const; virtual status_t getLayerFrameStats(const sp& handle, FrameStats* outStats) const; + virtual status_t getTransformToDisplayInverse( + const sp& handle, bool* outTransformToDisplayInverse) const; virtual status_t onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags); diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 3f70144904..f67e66ecfb 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -2207,6 +2207,10 @@ std::vector Layer::getOccupancyHistory( return history; } +bool Layer::getTransformToDisplayInverse() const { + return mSurfaceFlingerConsumer->getTransformToDisplayInverse(); +} + // --------------------------------------------------------------------------- Layer::LayerCleaner::LayerCleaner(const sp& flinger, diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h index 3ea38f0179..a51c804b11 100644 --- a/services/surfaceflinger/Layer.h +++ b/services/surfaceflinger/Layer.h @@ -418,6 +418,8 @@ public: return mFlinger->getFrameTimestamps(*this, frameNumber, outTimestamps); } + bool getTransformToDisplayInverse() const; + protected: // constant sp mFlinger; diff --git a/services/surfaceflinger/SurfaceFlingerConsumer.cpp b/services/surfaceflinger/SurfaceFlingerConsumer.cpp index ba0a527ebc..e0e4c61e69 100644 --- a/services/surfaceflinger/SurfaceFlingerConsumer.cpp +++ b/services/surfaceflinger/SurfaceFlingerConsumer.cpp @@ -129,6 +129,7 @@ status_t SurfaceFlingerConsumer::acquireBufferLocked(BufferItem* item, } bool SurfaceFlingerConsumer::getTransformToDisplayInverse() const { + Mutex::Autolock lock(mMutex); return mTransformToDisplayInverse; } diff --git a/services/surfaceflinger/SurfaceFlingerConsumer.h b/services/surfaceflinger/SurfaceFlingerConsumer.h index 37626591a7..4271039d25 100644 --- a/services/surfaceflinger/SurfaceFlingerConsumer.h +++ b/services/surfaceflinger/SurfaceFlingerConsumer.h @@ -66,8 +66,9 @@ public: // See GLConsumer::bindTextureImageLocked(). status_t bindTextureImage(); - // must be called from SF main thread bool getTransformToDisplayInverse() const; + + // must be called from SF main thread const Region& getSurfaceDamage() const; // Sets the contents changed listener. This should be used instead of -- cgit v1.2.3-59-g8ed1b