Skip to content

Commit de2cdcf

Browse files
author
Dominik Laskowski
committed
SF: Remove connected_display flag
Bug: 380251940 Flag: EXEMPT removing connected_display Test: presubmit Change-Id: I870d8f13fe8012f07a47dace756c5d4b2261ebd3
1 parent f863ba4 commit de2cdcf

9 files changed

Lines changed: 10 additions & 35 deletions

File tree

services/surfaceflinger/Display/DisplayModeController.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@ auto DisplayModeController::setDesiredMode(PhysicalDisplayId displayId,
9797
const bool force = desiredModeOpt->force;
9898
desiredModeOpt = std::move(desiredMode);
9999
desiredModeOpt->emitEvent |= emitEvent;
100-
if (FlagManager::getInstance().connected_display()) {
101-
desiredModeOpt->force |= force;
102-
}
100+
desiredModeOpt->force |= force;
103101
return DesiredModeAction::None;
104102
}
105103

@@ -191,7 +189,7 @@ auto DisplayModeController::initiateModeChange(
191189
// cleared until the next `SF::initiateDisplayModeChanges`. However, the desired mode has been
192190
// consumed at this point, so clear the `force` flag to prevent an endless loop of
193191
// `initiateModeChange`.
194-
if (FlagManager::getInstance().connected_display()) {
192+
{
195193
std::scoped_lock lock(displayPtr->desiredModeLock);
196194
if (displayPtr->desiredModeOpt) {
197195
displayPtr->desiredModeOpt->force = false;

services/surfaceflinger/DisplayHardware/HWC2.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -439,11 +439,8 @@ Error Display::setActiveConfigWithConstraints(hal::HWConfigId configId,
439439
// FIXME (b/319505580): At least the first config set on an external display must be
440440
// `setActiveConfig`, so skip over the block that calls `setActiveConfigWithConstraints`
441441
// for simplicity.
442-
const bool connected_display = FlagManager::getInstance().connected_display();
443-
444442
if (isVsyncPeriodSwitchSupported() &&
445-
(!connected_display ||
446-
getConnectionType().value_opt() != ui::DisplayConnectionType::External)) {
443+
getConnectionType().value_opt() != ui::DisplayConnectionType::External) {
447444
Hwc2::IComposerClient::VsyncPeriodChangeConstraints hwc2Constraints;
448445
hwc2Constraints.desiredTimeNanos = constraints.desiredTimeNanos;
449446
hwc2Constraints.seamlessRequired = constraints.seamlessRequired;

services/surfaceflinger/Scheduler/Scheduler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ std::shared_ptr<VsyncSchedule> Scheduler::promotePacesetterDisplayLocked(
986986
if (const auto pacesetterOpt = pacesetterDisplayLocked()) {
987987
const Display& pacesetter = *pacesetterOpt;
988988

989-
if (!FlagManager::getInstance().connected_display() || params.toggleIdleTimer) {
989+
if (params.toggleIdleTimer) {
990990
pacesetter.selectorPtr->setIdleTimerCallbacks(
991991
{.platform = {.onReset = [this] { idleTimerCallback(TimerState::Reset); },
992992
.onExpired = [this] { idleTimerCallback(TimerState::Expired); }},
@@ -1018,7 +1018,7 @@ void Scheduler::applyNewVsyncSchedule(std::shared_ptr<VsyncSchedule> vsyncSchedu
10181018
}
10191019

10201020
void Scheduler::demotePacesetterDisplay(PromotionParams params) {
1021-
if (!FlagManager::getInstance().connected_display() || params.toggleIdleTimer) {
1021+
if (params.toggleIdleTimer) {
10221022
// No need to lock for reads on kMainThreadContext.
10231023
if (const auto pacesetterPtr =
10241024
FTL_FAKE_GUARD(mDisplayLock, pacesetterSelectorPtrLocked())) {

services/surfaceflinger/Scheduler/Scheduler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ class Scheduler : public IEventThreadCallback, android::impl::MessageQueue {
386386
// a deadlock where the main thread joins with the timer thread as the timer thread waits to
387387
// lock a mutex held by the main thread.
388388
struct PromotionParams {
389-
// Whether to stop and start the idle timer. Ignored unless connected_display flag is set.
389+
// Whether to stop and start the idle timer.
390390
bool toggleIdleTimer;
391391
};
392392

services/surfaceflinger/SurfaceFlinger.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2286,8 +2286,7 @@ void SurfaceFlinger::scheduleSample() {
22862286

22872287
void SurfaceFlinger::onComposerHalVsync(hal::HWDisplayId hwcDisplayId, int64_t timestamp,
22882288
std::optional<hal::VsyncPeriodNanos> vsyncPeriod) {
2289-
if (FlagManager::getInstance().connected_display() && timestamp < 0 &&
2290-
vsyncPeriod.has_value()) {
2289+
if (timestamp < 0 && vsyncPeriod.has_value()) {
22912290
if (mIsHdcpViaNegVsync && vsyncPeriod.value() == ~1) {
22922291
const int32_t value = static_cast<int32_t>(-timestamp);
22932292
// one byte is good enough to encode android.hardware.drm.HdcpLevel
@@ -3552,9 +3551,8 @@ std::pair<DisplayModes, DisplayModePtr> SurfaceFlinger::loadDisplayModes(
35523551
std::vector<HWComposer::HWCDisplayMode> hwcModes;
35533552
std::optional<hal::HWConfigId> activeModeHwcIdOpt;
35543553

3555-
const bool isExternalDisplay = FlagManager::getInstance().connected_display() &&
3556-
getHwComposer().getDisplayConnectionType(displayId) ==
3557-
ui::DisplayConnectionType::External;
3554+
const bool isExternalDisplay = getHwComposer().getDisplayConnectionType(displayId) ==
3555+
ui::DisplayConnectionType::External;
35583556

35593557
int attempt = 0;
35603558
constexpr int kMaxAttempts = 3;
@@ -4049,8 +4047,7 @@ void SurfaceFlinger::processDisplayAdded(const wp<IBinder>& displayToken,
40494047
// For an external display, loadDisplayModes already attempted to select the same mode
40504048
// as DM, but SF still needs to be updated to match.
40514049
// TODO (b/318534874): Let DM decide the initial mode.
4052-
if (const auto& physical = state.physical;
4053-
mScheduler && physical && FlagManager::getInstance().connected_display()) {
4050+
if (const auto& physical = state.physical; mScheduler && physical) {
40544051
const bool isInternalDisplay = mPhysicalDisplays.get(physical->id)
40554052
.transform(&PhysicalDisplay::isInternal)
40564053
.value_or(false);
@@ -8359,10 +8356,6 @@ status_t SurfaceFlinger::getStalledTransactionInfo(
83598356

83608357
void SurfaceFlinger::updateHdcpLevels(hal::HWDisplayId hwcDisplayId, int32_t connectedLevel,
83618358
int32_t maxLevel) {
8362-
if (!FlagManager::getInstance().connected_display()) {
8363-
return;
8364-
}
8365-
83668359
Mutex::Autolock lock(mStateLock);
83678360

83688361
const auto idOpt = getHwComposer().toPhysicalDisplayId(hwcDisplayId);

services/surfaceflinger/common/FlagManager.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ void FlagManager::dump(std::string& result) const {
138138
DUMP_ACONFIG_FLAG(begone_bright_hlg);
139139
DUMP_ACONFIG_FLAG(cache_when_source_crop_layer_only_moved);
140140
DUMP_ACONFIG_FLAG(commit_not_composited);
141-
DUMP_ACONFIG_FLAG(connected_display);
142141
DUMP_ACONFIG_FLAG(connected_display_hdr);
143142
DUMP_ACONFIG_FLAG(correct_dpi_with_display_size);
144143
DUMP_ACONFIG_FLAG(deprecate_frame_tracker);
@@ -251,7 +250,6 @@ FLAG_MANAGER_LEGACY_SERVER_FLAG(use_skia_tracing, PROPERTY_SKIA_ATRACE_ENABLED,
251250
/// Trunk stable readonly flags ///
252251
FLAG_MANAGER_ACONFIG_FLAG(adpf_fmq_sf, "")
253252
FLAG_MANAGER_ACONFIG_FLAG(arr_setframerate_gte_enum, "debug.sf.arr_setframerate_gte_enum")
254-
FLAG_MANAGER_ACONFIG_FLAG(connected_display, "")
255253
FLAG_MANAGER_ACONFIG_FLAG(enable_small_area_detection, "")
256254
FLAG_MANAGER_ACONFIG_FLAG(stable_edid_ids, "debug.sf.stable_edid_ids")
257255
FLAG_MANAGER_ACONFIG_FLAG(frame_rate_category_mrr, "debug.sf.frame_rate_category_mrr")

services/surfaceflinger/common/include/common/FlagManager.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ class FlagManager {
7373
bool begone_bright_hlg() const;
7474
bool cache_when_source_crop_layer_only_moved() const;
7575
bool commit_not_composited() const;
76-
bool connected_display() const;
7776
bool connected_display_hdr() const;
7877
bool correct_dpi_with_display_size() const;
7978
bool deprecate_frame_tracker() const;

services/surfaceflinger/tests/unittests/SurfaceFlinger_DisplayModeSwitching.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,6 @@ TEST_F(DisplayModeSwitchingTest, changeResolutionWithoutRefreshRequired) {
361361
}
362362

363363
TEST_F(DisplayModeSwitchingTest, innerXorOuterDisplay) {
364-
SET_FLAG_FOR_TEST(flags::connected_display, true);
365-
366364
const auto [innerDisplay, outerDisplay] = injectOuterDisplay();
367365

368366
EXPECT_TRUE(innerDisplay->isPoweredOn());
@@ -427,8 +425,6 @@ TEST_F(DisplayModeSwitchingTest, innerXorOuterDisplay) {
427425
}
428426

429427
TEST_F(DisplayModeSwitchingTest, innerAndOuterDisplay) {
430-
SET_FLAG_FOR_TEST(flags::connected_display, true);
431-
432428
const auto [innerDisplay, outerDisplay] = injectOuterDisplay();
433429

434430
EXPECT_TRUE(innerDisplay->isPoweredOn());
@@ -497,8 +493,6 @@ TEST_F(DisplayModeSwitchingTest, powerOffDuringModeSet) {
497493
}
498494

499495
TEST_F(DisplayModeSwitchingTest, powerOffDuringConcurrentModeSet) {
500-
SET_FLAG_FOR_TEST(flags::connected_display, true);
501-
502496
const auto [innerDisplay, outerDisplay] = injectOuterDisplay();
503497

504498
EXPECT_TRUE(innerDisplay->isPoweredOn());

services/surfaceflinger/tests/unittests/SurfaceFlinger_HotplugTest.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,6 @@ TEST_F(HotplugTest, ignoresDuplicateDisconnection) {
224224
}
225225

226226
TEST_F(HotplugTest, rejectsHotplugIfFailedToLoadDisplayModes) {
227-
SET_FLAG_FOR_TEST(flags::connected_display, true);
228-
229227
// Inject a primary display.
230228
PrimaryDisplayVariant::injectHwcDisplay(this);
231229

@@ -263,8 +261,6 @@ TEST_F(HotplugTest, rejectsHotplugIfFailedToLoadDisplayModes) {
263261
}
264262

265263
TEST_F(HotplugTest, rejectsHotplugOnActivePortsDuplicate) {
266-
SET_FLAG_FOR_TEST(flags::connected_display, true);
267-
268264
// Inject a primary display.
269265
PrimaryDisplayVariant::injectHwcDisplay(this);
270266

0 commit comments

Comments
 (0)