SF: Avoid a few nullable sp<DisplayDevice> params
Bug: 255635821
Test: Build
Change-Id: I6c84b89d8b532eca581530931a8b876c37ca3189
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 257045d..a375233 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3304,7 +3304,7 @@
// TODO(b/175678251) Call a listener instead.
if (currentState.physical->hwcDisplayId == getHwComposer().getPrimaryHwcDisplayId()) {
- updateInternalDisplayVsyncLocked(display);
+ updateActiveDisplayVsyncLocked(*display);
}
}
return;
@@ -3332,15 +3332,15 @@
display->setDisplaySize(currentState.width, currentState.height);
if (display->getId() == mActiveDisplayId) {
- onActiveDisplaySizeChanged(display);
+ onActiveDisplaySizeChanged(*display);
}
}
}
}
-void SurfaceFlinger::updateInternalDisplayVsyncLocked(const sp<DisplayDevice>& activeDisplay) {
+void SurfaceFlinger::updateActiveDisplayVsyncLocked(const DisplayDevice& activeDisplay) {
mVsyncConfiguration->reset();
- const Fps refreshRate = activeDisplay->getActiveMode().fps;
+ const Fps refreshRate = activeDisplay.getActiveMode().fps;
updatePhaseConfiguration(refreshRate);
mRefreshRateStats->setRefreshRate(refreshRate);
}
@@ -4985,7 +4985,7 @@
static bool sPrimaryDisplay = true;
if (sPrimaryDisplay || activeDisplayChanged) {
- onActiveDisplayChangedLocked(activeDisplay, display);
+ onActiveDisplayChangedLocked(activeDisplay.get(), *display);
sPrimaryDisplay = false;
}
@@ -7267,35 +7267,35 @@
mRegionSamplingThread->onCompositionComplete(mScheduler->getScheduledFrameTime());
}
-void SurfaceFlinger::onActiveDisplaySizeChanged(const sp<const DisplayDevice>& activeDisplay) {
- mScheduler->onActiveDisplayAreaChanged(activeDisplay->getWidth() * activeDisplay->getHeight());
- getRenderEngine().onActiveDisplaySizeChanged(activeDisplay->getSize());
+void SurfaceFlinger::onActiveDisplaySizeChanged(const DisplayDevice& activeDisplay) {
+ mScheduler->onActiveDisplayAreaChanged(activeDisplay.getWidth() * activeDisplay.getHeight());
+ getRenderEngine().onActiveDisplaySizeChanged(activeDisplay.getSize());
}
-void SurfaceFlinger::onActiveDisplayChangedLocked(const sp<DisplayDevice>& inactiveDisplay,
- const sp<DisplayDevice>& activeDisplay) {
+void SurfaceFlinger::onActiveDisplayChangedLocked(const DisplayDevice* inactiveDisplayPtr,
+ const DisplayDevice& activeDisplay) {
ATRACE_CALL();
- if (inactiveDisplay) {
- inactiveDisplay->getCompositionDisplay()->setLayerCachingTexturePoolEnabled(false);
+ if (inactiveDisplayPtr) {
+ inactiveDisplayPtr->getCompositionDisplay()->setLayerCachingTexturePoolEnabled(false);
}
- mActiveDisplayId = activeDisplay->getPhysicalId();
- activeDisplay->getCompositionDisplay()->setLayerCachingTexturePoolEnabled(true);
+ mActiveDisplayId = activeDisplay.getPhysicalId();
+ activeDisplay.getCompositionDisplay()->setLayerCachingTexturePoolEnabled(true);
- updateInternalDisplayVsyncLocked(activeDisplay);
+ updateActiveDisplayVsyncLocked(activeDisplay);
mScheduler->setModeChangePending(false);
mScheduler->setLeaderDisplay(mActiveDisplayId);
onActiveDisplaySizeChanged(activeDisplay);
- mActiveDisplayTransformHint = activeDisplay->getTransformHint();
+ mActiveDisplayTransformHint = activeDisplay.getTransformHint();
// The policy of the new active/leader display may have changed while it was inactive. In that
// case, its preferred mode has not been propagated to HWC (via setDesiredActiveMode). In either
// case, the Scheduler's cachedModeChangedParams must be initialized to the newly active mode,
// and the kernel idle timer of the newly active display must be toggled.
constexpr bool kForce = true;
- applyRefreshRateSelectorPolicy(mActiveDisplayId, activeDisplay->refreshRateSelector(), kForce);
+ applyRefreshRateSelectorPolicy(mActiveDisplayId, activeDisplay.refreshRateSelector(), kForce);
}
status_t SurfaceFlinger::addWindowInfosListener(