Add additional flag for FMQ SF
This flag helps decouple the SF FMQ rollout from the rest of the FMQ
rollout
Bug: 284324521
Bug: 315894228
Flag: com.android.graphics.surfaceflinger.flags.adpf_fmq_sf
Flag: android.os.adpf_use_fmq_channel_fixed
Test: atest PowerAdvisorTest
Change-Id: I101fb3861fb7c03c5d070c065acf1069bf90ccc6
diff --git a/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp b/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp
index 334c104..c914ec3 100644
--- a/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp
+++ b/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp
@@ -240,7 +240,8 @@
&mSessionConfig);
if (ret.isOk()) {
mHintSession = ret.value();
- if (FlagManager::getInstance().adpf_use_fmq_channel_fixed()) {
+ if (FlagManager::getInstance().adpf_use_fmq_channel_fixed() &&
+ FlagManager::getInstance().adpf_fmq_sf()) {
setUpFmq();
}
}
diff --git a/services/surfaceflinger/common/FlagManager.cpp b/services/surfaceflinger/common/FlagManager.cpp
index 12d6138..ea108c7 100644
--- a/services/surfaceflinger/common/FlagManager.cpp
+++ b/services/surfaceflinger/common/FlagManager.cpp
@@ -116,6 +116,7 @@
DUMP_SERVER_FLAG(adpf_use_fmq_channel);
/// Trunk stable readonly flags ///
+ DUMP_READ_ONLY_FLAG(adpf_fmq_sf);
DUMP_READ_ONLY_FLAG(connected_display);
DUMP_READ_ONLY_FLAG(enable_small_area_detection);
DUMP_READ_ONLY_FLAG(frame_rate_category_mrr);
@@ -222,6 +223,7 @@
"SkiaTracingFeature__use_skia_tracing")
/// Trunk stable readonly flags ///
+FLAG_MANAGER_READ_ONLY_FLAG(adpf_fmq_sf, "")
FLAG_MANAGER_READ_ONLY_FLAG(connected_display, "")
FLAG_MANAGER_READ_ONLY_FLAG(enable_small_area_detection, "")
FLAG_MANAGER_READ_ONLY_FLAG(frame_rate_category_mrr, "debug.sf.frame_rate_category_mrr")
diff --git a/services/surfaceflinger/common/include/common/FlagManager.h b/services/surfaceflinger/common/include/common/FlagManager.h
index a1be194..419b085 100644
--- a/services/surfaceflinger/common/include/common/FlagManager.h
+++ b/services/surfaceflinger/common/include/common/FlagManager.h
@@ -54,6 +54,7 @@
bool adpf_use_fmq_channel_fixed() const;
/// Trunk stable readonly flags ///
+ bool adpf_fmq_sf() const;
bool connected_display() const;
bool frame_rate_category_mrr() const;
bool enable_small_area_detection() const;
diff --git a/services/surfaceflinger/surfaceflinger_flags_new.aconfig b/services/surfaceflinger/surfaceflinger_flags_new.aconfig
index e40be51..d724dfc 100644
--- a/services/surfaceflinger/surfaceflinger_flags_new.aconfig
+++ b/services/surfaceflinger/surfaceflinger_flags_new.aconfig
@@ -4,6 +4,14 @@
container: "system"
flag {
+ name: "adpf_fmq_sf"
+ namespace: "game"
+ description: "Guards use of the ADPF FMQ system specifically for SurfaceFlinger"
+ bug: "315894228"
+ is_fixed_read_only: true
+} # adpf_fmq_sf
+
+flag {
name: "adpf_gpu_sf"
namespace: "game"
description: "Guards use of the sending ADPF GPU duration hint and load hints from SurfaceFlinger to Power HAL"
diff --git a/services/surfaceflinger/tests/unittests/PowerAdvisorTest.cpp b/services/surfaceflinger/tests/unittests/PowerAdvisorTest.cpp
index c879280..8375bb9 100644
--- a/services/surfaceflinger/tests/unittests/PowerAdvisorTest.cpp
+++ b/services/surfaceflinger/tests/unittests/PowerAdvisorTest.cpp
@@ -85,6 +85,7 @@
int64_t mSessionId = 123;
SET_FLAG_FOR_TEST(android::os::adpf_use_fmq_channel, true);
SET_FLAG_FOR_TEST(android::os::adpf_use_fmq_channel_fixed, false);
+ SET_FLAG_FOR_TEST(com::android::graphics::surfaceflinger::flags::adpf_fmq_sf, false);
};
bool PowerAdvisorTest::sessionExists() {
@@ -184,6 +185,7 @@
SET_FLAG_FOR_TEST(com::android::graphics::surfaceflinger::flags::adpf_gpu_sf,
config.adpfGpuFlagOn);
SET_FLAG_FOR_TEST(android::os::adpf_use_fmq_channel_fixed, config.usesFmq);
+ SET_FLAG_FOR_TEST(com::android::graphics::surfaceflinger::flags::adpf_fmq_sf, config.usesFmq);
mPowerAdvisor->onBootFinished();
bool expectsFmqSuccess = config.usesSharedFmqFlag && !config.fmqFull;
if (config.usesFmq) {
@@ -789,6 +791,7 @@
TEST_F(PowerAdvisorTest, fmq_sendHint) {
SET_FLAG_FOR_TEST(android::os::adpf_use_fmq_channel_fixed, true);
+ SET_FLAG_FOR_TEST(com::android::graphics::surfaceflinger::flags::adpf_fmq_sf, true);
mPowerAdvisor->onBootFinished();
SetUpFmq(true, false);
auto startTime = uptimeNanos();
@@ -807,6 +810,7 @@
TEST_F(PowerAdvisorTest, fmq_sendHint_noSharedFlag) {
SET_FLAG_FOR_TEST(android::os::adpf_use_fmq_channel_fixed, true);
+ SET_FLAG_FOR_TEST(com::android::graphics::surfaceflinger::flags::adpf_fmq_sf, true);
mPowerAdvisor->onBootFinished();
SetUpFmq(false, false);
SessionHint hint;
@@ -821,6 +825,7 @@
TEST_F(PowerAdvisorTest, fmq_sendHint_queueFull) {
SET_FLAG_FOR_TEST(android::os::adpf_use_fmq_channel_fixed, true);
+ SET_FLAG_FOR_TEST(com::android::graphics::surfaceflinger::flags::adpf_fmq_sf, true);
mPowerAdvisor->onBootFinished();
SetUpFmq(true, true);
ASSERT_EQ(mBackendFmq->availableToRead(), 2uL);