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
diff --git a/services/surfaceflinger/Client.cpp b/services/surfaceflinger/Client.cpp
index 2a025b8..415bdca 100644
--- a/services/surfaceflinger/Client.cpp
+++ b/services/surfaceflinger/Client.cpp
@@ -173,5 +173,15 @@
return NO_ERROR;
}
+status_t Client::getTransformToDisplayInverse(const sp<IBinder>& handle,
+ bool* outTransformToDisplayInverse) const {
+ sp<Layer> 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 b6d7381..12db505 100644
--- a/services/surfaceflinger/Client.h
+++ b/services/surfaceflinger/Client.h
@@ -63,6 +63,8 @@
virtual status_t clearLayerFrameStats(const sp<IBinder>& handle) const;
virtual status_t getLayerFrameStats(const sp<IBinder>& handle, FrameStats* outStats) const;
+ virtual status_t getTransformToDisplayInverse(
+ const sp<IBinder>& 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 3f70144..f67e66e 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -2207,6 +2207,10 @@
return history;
}
+bool Layer::getTransformToDisplayInverse() const {
+ return mSurfaceFlingerConsumer->getTransformToDisplayInverse();
+}
+
// ---------------------------------------------------------------------------
Layer::LayerCleaner::LayerCleaner(const sp<SurfaceFlinger>& flinger,
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 3ea38f0..a51c804 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -418,6 +418,8 @@
return mFlinger->getFrameTimestamps(*this, frameNumber, outTimestamps);
}
+ bool getTransformToDisplayInverse() const;
+
protected:
// constant
sp<SurfaceFlinger> mFlinger;
diff --git a/services/surfaceflinger/SurfaceFlingerConsumer.cpp b/services/surfaceflinger/SurfaceFlingerConsumer.cpp
index ba0a527..e0e4c61 100644
--- a/services/surfaceflinger/SurfaceFlingerConsumer.cpp
+++ b/services/surfaceflinger/SurfaceFlingerConsumer.cpp
@@ -129,6 +129,7 @@
}
bool SurfaceFlingerConsumer::getTransformToDisplayInverse() const {
+ Mutex::Autolock lock(mMutex);
return mTransformToDisplayInverse;
}
diff --git a/services/surfaceflinger/SurfaceFlingerConsumer.h b/services/surfaceflinger/SurfaceFlingerConsumer.h
index 3762659..4271039 100644
--- a/services/surfaceflinger/SurfaceFlingerConsumer.h
+++ b/services/surfaceflinger/SurfaceFlingerConsumer.h
@@ -66,8 +66,9 @@
// 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