SF: Bring back support for disabling backpressure propagation
[Pulkit077]: Adapt to A14 QPR1
[SamarV-121]: Adapt to A14 QPR3
Taken from CLO (QSSI 13). Some Qualcomm devices can still
benefit from disabling backpressure propagation by setting:
debug.sf.disable_backpressure=1
Change-Id: I669a6059a2a971aa79603e74153fa93729f703dc
Signed-off-by: Pulkit077 <pulkitagarwal2k1@gmail.com>
diff --git a/services/surfaceflinger/Scheduler/include/scheduler/Features.h b/services/surfaceflinger/Scheduler/include/scheduler/Features.h
index 52485fb..6a3d7d0 100644
--- a/services/surfaceflinger/Scheduler/include/scheduler/Features.h
+++ b/services/surfaceflinger/Scheduler/include/scheduler/Features.h
@@ -30,6 +30,7 @@
kBackpressureGpuComposition = 1 << 4,
kSmallDirtyContentDetection = 1 << 5,
kExpectedPresentTime = 1 << 6,
+ kPropagateBackpressure = 1 << 7,
};
using FeatureFlags = ftl::Flags<Feature>;
diff --git a/services/surfaceflinger/Scheduler/include/scheduler/FrameTargeter.h b/services/surfaceflinger/Scheduler/include/scheduler/FrameTargeter.h
index a5bb6c2..bf1236d 100644
--- a/services/surfaceflinger/Scheduler/include/scheduler/FrameTargeter.h
+++ b/services/surfaceflinger/Scheduler/include/scheduler/FrameTargeter.h
@@ -115,7 +115,8 @@
FrameTargeter(PhysicalDisplayId displayId, FeatureFlags flags)
: FrameTarget(to_string(displayId)),
mBackpressureGpuComposition(flags.test(Feature::kBackpressureGpuComposition)),
- mSupportsExpectedPresentTime(flags.test(Feature::kExpectedPresentTime)) {}
+ mSupportsExpectedPresentTime(flags.test(Feature::kExpectedPresentTime)),
+ mPropagateBackpressure(flags.test(Feature::kPropagateBackpressure)) {}
const FrameTarget& target() const { return *this; }
@@ -151,6 +152,7 @@
const bool mBackpressureGpuComposition;
const bool mSupportsExpectedPresentTime;
+ const bool mPropagateBackpressure;
TimePoint mScheduledPresentTime;
CompositionCoverageFlags mCompositionCoverage;
diff --git a/services/surfaceflinger/Scheduler/src/FrameTargeter.cpp b/services/surfaceflinger/Scheduler/src/FrameTargeter.cpp
index 68c277d..ec33c3d 100644
--- a/services/surfaceflinger/Scheduler/src/FrameTargeter.cpp
+++ b/services/surfaceflinger/Scheduler/src/FrameTargeter.cpp
@@ -97,7 +97,7 @@
//
// TODO(b/280667110): The grace period should depend on `sfWorkDuration` and `vsyncPeriod` being
// approximately equal, not whether backpressure propagation is enabled.
- const int graceTimeForPresentFenceMs = static_cast<int>(
+ const int graceTimeForPresentFenceMs = mPropagateBackpressure && static_cast<int>(
mBackpressureGpuComposition || !mCompositionCoverage.test(CompositionCoverage::Gpu));
// Pending frames may trigger backpressure propagation.
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index cf5f55d..0fef42e 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -478,6 +478,10 @@
mDebugFlashDelay = base::GetUintProperty("debug.sf.showupdates"s, 0u);
+ property_get("debug.sf.disable_backpressure", value, "0");
+ mPropagateBackpressure = !atoi(value);
+ ALOGI_IF(!mPropagateBackpressure, "Disabling backpressure propagation");
+
mBackpressureGpuComposition = base::GetBoolProperty("debug.sf.enable_gl_backpressure"s, true);
ALOGI_IF(mBackpressureGpuComposition, "Enabling backpressure for GPU composition");
@@ -2548,7 +2552,7 @@
}
if (pacesetterFrameTarget.isFramePending()) {
- if (mBackpressureGpuComposition || pacesetterFrameTarget.didMissHwcFrame()) {
+ if (mPropagateBackpressure && (mBackpressureGpuComposition || pacesetterFrameTarget.didMissHwcFrame())) {
if (FlagManager::getInstance().vrr_config()) {
mScheduler->getVsyncSchedule()->getTracker().onFrameMissed(
pacesetterFrameTarget.expectedPresentTime());
@@ -4366,6 +4370,9 @@
if (mBackpressureGpuComposition) {
features |= Feature::kBackpressureGpuComposition;
}
+ if (mPropagateBackpressure) {
+ features |= Feature::kPropagateBackpressure;
+ }
if (getHwComposer().getComposer()->isSupported(
Hwc2::Composer::OptionalFeature::ExpectedPresentTime)) {
features |= Feature::kExpectedPresentTime;
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 678be54..d2cf9aa 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -1297,6 +1297,7 @@
std::atomic_bool mForceFullDamage = false;
bool mLayerCachingEnabled = false;
+ bool mPropagateBackpressure = true;
bool mBackpressureGpuComposition = false;
LayerTracing mLayerTracing;