summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <android-build-prod@system.gserviceaccount.com>2021-11-23 21:54:43 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2021-11-23 21:54:43 +0000
commitf1f87d6a4f222fe0166f3420e7dfa61f012859a2 (patch)
treec78bddb514bc892f2e93e2bf01b61ced21c1c754
parentb376ebd6624f31ae89145f2cdb3bc6c70ad41415 (diff)
parent1370fcacf0204c7db6b7d6113758f6b94054f53b (diff)
Merge "SF: Flag rotation animation early" into s-keystone-qcom-dev
-rw-r--r--services/surfaceflinger/Layer.cpp11
-rw-r--r--services/surfaceflinger/Layer.h1
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp39
3 files changed, 45 insertions, 6 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index ce8cd5286e..b7d174fab9 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -701,10 +701,15 @@ bool Layer::isSecureCamera() const {
}
bool Layer::isScreenshot() const {
- return ((getName().find("ScreenshotSurface") != std::string::npos) ||
- (getName().find("RotationLayer") != std::string::npos) ||
- (getName().find("BackColorSurface") != std::string::npos));
+ return (isScreenshotName(getName()));
}
+
+bool Layer::isScreenshotName(std::string layer_name) {
+ return ((layer_name.find("ScreenshotSurface") != std::string::npos) ||
+ (layer_name.find("RotationLayer") != std::string::npos) ||
+ (layer_name.find("BackColorSurface") != std::string::npos));
+}
+
// ----------------------------------------------------------------------------
// transaction
// ----------------------------------------------------------------------------
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 652b1a6f11..1e89f997a5 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -672,6 +672,7 @@ public:
bool isSecureCamera() const;
bool isSecureDisplay() const;
bool isScreenshot() const;
+ static bool isScreenshotName(std::string layer_name);
/*
* isHiddenByPolicy - true if this layer has been forced invisible.
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index e565dec919..47ae4dec6e 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2905,13 +2905,17 @@ void SurfaceFlinger::setDisplayAnimating() {
if (!IsDisplayExternalOrVirtual(displayDevice)) {
continue;
}
- uint32_t hwcDisplayId;
- getHwcDisplayId(displayDevice, &hwcDisplayId);
+ uint32_t hwcDisplayId = 0;
+ if (!getHwcDisplayId(displayDevice, &hwcDisplayId)) {
+ ALOGW("Rot-anim failed to get HWC DisplayID for display '%s'.",
+ displayDevice->getDebugName().c_str());
+ continue;
+ }
if (mDisplayConfigIntf && (hasScreenshot != mHasScreenshot)) {
mDisplayConfigIntf->SetDisplayAnimating(hwcDisplayId, hasScreenshot);
- mHasScreenshot = hasScreenshot;
}
}
+ mHasScreenshot = hasScreenshot;
#endif
}
@@ -5402,6 +5406,35 @@ status_t SurfaceFlinger::createLayer(const String8& name, const sp<Client>& clie
"Expected only one of parentLayer or parentHandle to be non-null. "
"Programmer error?");
+#ifdef QTI_DISPLAY_CONFIG_ENABLED
+ // Flag rotation animation as early as possible.
+ if (Layer::isScreenshotName(std::string(name))) {
+ // Rotation animation present.
+ bool signal_refresh = true;
+ Mutex::Autolock lock(mStateLock); // Needed for mDisplays and signalRefresh().
+ for (const auto& [token, displayDevice] : mDisplays) {
+ if (!IsDisplayExternalOrVirtual(displayDevice)) {
+ continue;
+ }
+ uint32_t hwcDisplayId = 0;
+ if (mDisplayConfigIntf && (true != mHasScreenshot)) {
+ if (!getHwcDisplayId(displayDevice, &hwcDisplayId)) {
+ ALOGW("Rot-anim failed to get HWC DisplayID for display '%s'.",
+ displayDevice->getDebugName().c_str());
+ continue;
+ }
+ mDisplayConfigIntf->SetDisplayAnimating(hwcDisplayId, true);
+ if (signal_refresh) {
+ // Request composition cycle once.
+ signalRefresh();
+ }
+ signal_refresh = false;
+ }
+ }
+ mHasScreenshot = true;
+ }
+#endif
+
status_t result = NO_ERROR;
sp<Layer> layer;