sf: Remove 50ms delay when external animation is disabled
1. Delay display projection transaction by 50ms when disable external
animation feature is enabled.
2. Read the property sys.disable_ext_animation only during bootup to
avoid unneccessary read for every draw cycle.
Change-Id: I9d57b6745ce794f8d942bb41086da060a2985395
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 4085a3a..fc8b125 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -188,6 +188,9 @@
if(mGpuTileRenderEnable)
ALOGV("DirtyRect optimization enabled for FULL GPU Composition");
mUnionDirtyRect.clear();
+
+ property_get("sys.disable_ext_animation", value, "0");
+ mDisableExtAnimation = atoi(value) ? true : false;
#endif
ALOGI_IF(mDebugRegion, "showupdates enabled");
@@ -1137,9 +1140,9 @@
#ifdef QCOM_BSP
bool freezeSurfacePresent = false;
const size_t layerCount = layers.size();
- char value[PROPERTY_VALUE_MAX];
- property_get("sys.disable_ext_animation", value, "0");
- if(atoi(value) && (id != HWC_DISPLAY_PRIMARY)) {
+ // Look for ScreenShotSurface in external layer list, only when
+ // disable external rotation animation feature is enabled
+ if(mDisableExtAnimation && (id != HWC_DISPLAY_PRIMARY)) {
for (size_t i = 0 ; i < layerCount ; ++i) {
static int screenShotLen = strlen("ScreenshotSurface");
const sp<Layer>& layer(layers[i]);
@@ -2316,18 +2319,22 @@
ATRACE_CALL();
size_t count = displays.size();
#ifdef QCOM_BSP
- for (size_t i=0 ; i<count ; i++) {
- const DisplayState& s(displays[i]);
- if(s.token != mBuiltinDisplays[DisplayDevice::DISPLAY_PRIMARY]) {
- const uint32_t what = s.what;
- // Invalidate and Delay the binder thread by 50 ms on
- // eDisplayProjectionChanged to trigger a draw cycle so that
- // it can fix one incorrect frame on the External, when we disable
- // external animation
- if (what & DisplayState::eDisplayProjectionChanged) {
- invalidateHwcGeometry();
- repaintEverything();
- usleep(50000);
+ // Delay the display projection transaction by 50ms only when the disable
+ // external rotation animation feature is enabled
+ if(mDisableExtAnimation) {
+ for (size_t i=0 ; i<count ; i++) {
+ const DisplayState& s(displays[i]);
+ if(s.token != mBuiltinDisplays[DisplayDevice::DISPLAY_PRIMARY]) {
+ const uint32_t what = s.what;
+ // Invalidate and Delay the binder thread by 50 ms on
+ // eDisplayProjectionChanged to trigger a draw cycle so that
+ // it can fix one incorrect frame on the External, when we
+ // disable external animation
+ if (what & DisplayState::eDisplayProjectionChanged) {
+ invalidateHwcGeometry();
+ repaintEverything();
+ usleep(50000);
+ }
}
}
}