summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/DisplayDevice.cpp
diff options
context:
space:
mode:
author Lloyd Pique <lpique@google.com> 2023-05-24 15:12:15 -0700
committer Lloyd Pique <lpique@google.com> 2023-06-22 17:19:28 -0700
commit8117c1a78d49c3e02f2ece22b994ace03c200153 (patch)
tree40f61d89dc36420096c9b1d68bc551fc199e7ee0 /services/surfaceflinger/DisplayDevice.cpp
parentd7ce14f5379c9e884b4262bf1fcf9f4eebecf938 (diff)
SF: Introduce struct surfaceflinger::Config
This pulls out all the individual configuration constants read by SurfaceFlinger in its constructor, and moves them to a new surfaceflinger::Config structure which is passed to the constructor. All the initialization is the functionally the same, a few values turned out to not be used, so were removed (mMaxGraphicBufferProducerListSize, mGraphicBufferProducerListSizeLogThreshold). Otherwise all properties read for the new structure consistently use android-base/properties.h to read them. To keep the argument count down, the SurfaceFlinger factory argument to the constructor was moved to be stored in the new Config structure. As a result of the change, SurfaceFlinger now only has one constructor. The tests were using the other constructor (passing SurfaceFlinger::skipInitiailization) to skip over the property reads to help ensure a hermetic configuration of SurfaceFlinger. The tests can now instead create create a minimally configured Config structure, and pass that the structure. The other changes were then to switch over to using the values in the Config structure, both internally to SurfaceFlinger, as well as in other files including Layer.cpp and DisplayDevice.cpp. In some cases, those changes required altering the arguments to the function being called to obtain the values, since originally some of the values where static member data in SurfaceFlinger. There were similar changes required for the tests and the fuzzers, to switch over, including how some tests mutated the configuration values so that they overall coverage was the same. No new tests/fuzzing was added, though it should now be easier to extend coverage. Test: atest libsurfaceflinger_unittest Bug: None Change-Id: I8dc3c2317a92b256e58ec45190e24463032c2f8e
Diffstat (limited to 'services/surfaceflinger/DisplayDevice.cpp')
-rw-r--r--services/surfaceflinger/DisplayDevice.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp
index f6ca9e2856..2789fa6bf2 100644
--- a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -78,18 +78,19 @@ DisplayDevice::DisplayDevice(DisplayDeviceCreationArgs& args)
.setDisplayHeight(ANativeWindow_getHeight(args.nativeWindow.get()))
.setNativeWindow(std::move(args.nativeWindow))
.setDisplaySurface(std::move(args.displaySurface))
- .setMaxTextureCacheSize(
- static_cast<size_t>(SurfaceFlinger::maxFrameBufferAcquiredBuffers))
+ .setMaxTextureCacheSize(static_cast<size_t>(
+ mFlinger->getConfig().maxFrameBufferAcquiredBuffers))
.build());
- if (!mFlinger->mDisableClientCompositionCache &&
- SurfaceFlinger::maxFrameBufferAcquiredBuffers > 0) {
+ if (!mFlinger->getConfig().disableClientCompositionCache &&
+ mFlinger->getConfig().maxFrameBufferAcquiredBuffers > 0) {
mCompositionDisplay->createClientCompositionCache(
- static_cast<uint32_t>(SurfaceFlinger::maxFrameBufferAcquiredBuffers));
+ static_cast<uint32_t>(mFlinger->getConfig().maxFrameBufferAcquiredBuffers));
}
- mCompositionDisplay->setPredictCompositionStrategy(mFlinger->mPredictCompositionStrategy);
- mCompositionDisplay->setTreat170mAsSrgb(mFlinger->mTreat170mAsSrgb);
+ mCompositionDisplay->setPredictCompositionStrategy(
+ mFlinger->getConfig().predictCompositionStrategy);
+ mCompositionDisplay->setTreat170mAsSrgb(mFlinger->getConfig().treat170mAsSrgb);
mCompositionDisplay->createDisplayColorProfile(
compositionengine::DisplayColorProfileCreationArgsBuilder()
.setHasWideColorGamut(args.hasWideColorGamut)
@@ -411,23 +412,22 @@ HdrCapabilities DisplayDevice::getHdrCapabilities() const {
capabilities.getDesiredMinLuminance());
}
-void DisplayDevice::enableRefreshRateOverlay(bool enable, bool setByHwc, bool showSpinner,
- bool showRenderRate, bool showInMiddle) {
+void DisplayDevice::enableRefreshRateOverlay(bool enable, bool setByHwc) {
if (!enable) {
mRefreshRateOverlay.reset();
return;
}
ftl::Flags<RefreshRateOverlay::Features> features;
- if (showSpinner) {
+ if (mFlinger->getConfig().refreshRateOverlay.showSpinner) {
features |= RefreshRateOverlay::Features::Spinner;
}
- if (showRenderRate) {
+ if (mFlinger->getConfig().refreshRateOverlay.showRenderRate) {
features |= RefreshRateOverlay::Features::RenderRate;
}
- if (showInMiddle) {
+ if (mFlinger->getConfig().refreshRateOverlay.showInMiddle) {
features |= RefreshRateOverlay::Features::ShowInMiddle;
}