[SurfaceFlinger] Refine expensive rendering trigger.
Previously we turned on expensive rendering when color mode is DISPLAY_P3
because wide color gamut implies V0_SCRGB dataspace with FP16 pixel format,
which can't be handled by hardware composer and it's also very expensive in GPU
composition. Now that DISPLAY_P3 color mode doesn't have this implication, we
should move the code to only trigger it if we hit GPU composition in DISPLAY_P3
color mode.
BUG: 114226412
Test: Build, flash and boot.
Test: Verify by modifying WCG to scRGB and checking GPU frequency.
Change-Id: Ia3d3c14574e9ac628497d2f9733e6dd84a2ed01d
diff --git a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
index d61973e..79b5ca0 100644
--- a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
+++ b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
@@ -324,6 +324,7 @@
auto& mutableTexturePool() { return mFlinger->mTexturePool; }
auto& mutableTransactionFlags() { return mFlinger->mTransactionFlags; }
auto& mutableUseHwcVirtualDisplays() { return mFlinger->mUseHwcVirtualDisplays; }
+ auto& mutablePowerAdvisor() { return mFlinger->mPowerAdvisor; }
auto& mutableComposerSequenceId() { return mFlinger->getBE().mComposerSequenceId; }
auto& mutableHwcDisplayData() { return getHwComposer().mDisplayData; }
@@ -352,18 +353,11 @@
* Wrapper classes for Read-write access to private data to set up
* preconditions and assert post-conditions.
*/
- class FakePowerAdvisor : public Hwc2::PowerAdvisor {
- public:
- FakePowerAdvisor() = default;
- ~FakePowerAdvisor() override = default;
- void setExpensiveRenderingExpected(hwc2_display_t, bool) override {}
- };
-
struct HWC2Display : public HWC2::impl::Display {
- HWC2Display(Hwc2::Composer& composer, Hwc2::PowerAdvisor& advisor,
+ HWC2Display(Hwc2::Composer& composer,
const std::unordered_set<HWC2::Capability>& capabilities, hwc2_display_t id,
HWC2::DisplayType type)
- : HWC2::impl::Display(composer, advisor, capabilities, id, type) {}
+ : HWC2::impl::Display(composer, capabilities, id, type) {}
~HWC2Display() {
// Prevents a call to disable vsyncs.
mType = HWC2::DisplayType::Invalid;
@@ -427,14 +421,7 @@
return *this;
}
- auto& setPowerAdvisor(Hwc2::PowerAdvisor* powerAdvisor) {
- mPowerAdvisor = powerAdvisor;
- return *this;
- }
-
void inject(TestableSurfaceFlinger* flinger, Hwc2::Composer* composer) {
- static FakePowerAdvisor defaultPowerAdvisor;
- if (mPowerAdvisor == nullptr) mPowerAdvisor = &defaultPowerAdvisor;
static const std::unordered_set<HWC2::Capability> defaultCapabilities;
if (mCapabilities == nullptr) mCapabilities = &defaultCapabilities;
@@ -442,8 +429,8 @@
// not refer to an instance owned by FakeHwcDisplayInjector. This
// class has temporary lifetime, while the constructed HWC2::Display
// is much longer lived.
- auto display = std::make_unique<HWC2Display>(*composer, *mPowerAdvisor, *mCapabilities,
- mHwcDisplayId, mHwcDisplayType);
+ auto display = std::make_unique<HWC2Display>(*composer, *mCapabilities, mHwcDisplayId,
+ mHwcDisplayType);
auto config = HWC2::Display::Config::Builder(*display, mActiveConfig);
config.setWidth(mWidth);
@@ -478,7 +465,6 @@
int32_t mDpiY = DEFAULT_DPI;
int32_t mActiveConfig = DEFAULT_ACTIVE_CONFIG;
const std::unordered_set<HWC2::Capability>* mCapabilities = nullptr;
- Hwc2::PowerAdvisor* mPowerAdvisor = nullptr;
};
class FakeDisplayDeviceInjector {