Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 657953d8 authored by Su Hong Koo's avatar Su Hong Koo
Browse files

SF: Wire up mock enableLayerCachingTexturePool

If the pacesetter_selection flag is disabled, the layer caching texture
pool for the front internal display is enabled/disabled through
SF::onNewFrontInternalDisplay().

However, when the pacesetter_selection flag is enabled, the pool is
enabled for the pacesetter display and triggered by Scheduler's call to
ISchedulerCallback::enableLayerCachingTexturePool(), which SF
implements.

However, in TestableSurfaceFlinger, the ISchedulerCallback
implementation that is passed into the Scheduler is a mock. So if a call
to enable layer pool is invoked here, one would need to set up the mock
behavior.

This CL sets up a mock behavior in
FoldableTest#layerCachingTexturePoolOnFrontInternal to just invoke the
implementation in SurfaceFlinger.

Flag: EXEMPT test fix
Bug: 389983418
Test: atest libsurfaceflinger_unittests with and without the flag
Change-Id: Ib3acb1d1b7ab52c3e87e141be74711987b4e3a09
parent 6db41fd6
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -219,7 +219,14 @@ TEST_P(FoldableTest, disableVsyncOnPowerOffPacesetter) {
    ASSERT_EQ(mFlinger.scheduler()->pacesetterDisplayId(), getOuterDisplayId());
}

TEST_F(FoldableTest, layerCachingTexturePoolOnFrontInternal) {
TEST_P(FoldableTest, layerCachingTexturePoolOnFrontInternal) {
    SET_FLAG_FOR_TEST(flags::pacesetter_selection, GetParam());

    ON_CALL(mFlinger.mockSchedulerCallback(), enableLayerCachingTexturePool)
            .WillByDefault([&](PhysicalDisplayId displayId, bool enable) {
                mFlinger.enableLayerCachingTexturePool(displayId, enable);
            });

    ASSERT_EQ(mFlinger.scheduler()->pacesetterDisplayId(), getInnerDisplayId());

    // In order for TexturePool to be enabled, layer caching needs to be enabled.
+4 −0
Original line number Diff line number Diff line
@@ -619,6 +619,10 @@ public:
        mFlinger->mNewLayers.emplace_back(std::move(layer));
    }

    void enableLayerCachingTexturePool(PhysicalDisplayId id, bool enable) {
        FTL_FAKE_GUARD(kMainThreadContext, mFlinger->enableLayerCachingTexturePool(id, enable));
    }

    /* ------------------------------------------------------------------------
     * Read-only access to private data to assert post-conditions.
     */