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

Commit da730c85 authored by Dominik Laskowski's avatar Dominik Laskowski Committed by Automerger Merge Worker
Browse files

SF: Clean up FakeDisplayDeviceInjector TODO am: 2b1037b4

parents 704f9fea 2b1037b4
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -32,7 +32,6 @@
#include <scheduler/Seamlessness.h>
#include <scheduler/Seamlessness.h>


#include "DisplayHardware/DisplayMode.h"
#include "DisplayHardware/DisplayMode.h"
#include "DisplayHardware/HWComposer.h"
#include "Scheduler/OneShotTimer.h"
#include "Scheduler/OneShotTimer.h"
#include "Scheduler/StrongTyping.h"
#include "Scheduler/StrongTyping.h"
#include "ThreadContext.h"
#include "ThreadContext.h"
@@ -297,6 +296,8 @@ public:
    RefreshRateSelector(const RefreshRateSelector&) = delete;
    RefreshRateSelector(const RefreshRateSelector&) = delete;
    RefreshRateSelector& operator=(const RefreshRateSelector&) = delete;
    RefreshRateSelector& operator=(const RefreshRateSelector&) = delete;


    const DisplayModes& displayModes() const { return mDisplayModes; }

    // Returns whether switching modes (refresh rate or resolution) is possible.
    // Returns whether switching modes (refresh rate or resolution) is possible.
    // TODO(b/158780872): Consider HAL support, and skip frame rate detection if the modes only
    // TODO(b/158780872): Consider HAL support, and skip frame rate detection if the modes only
    //  differ in resolution. Once Config::FrameRateOverride::Enabled becomes the default,
    //  differ in resolution. Once Config::FrameRateOverride::Enabled becomes the default,
+1 −1
Original line number Original line Diff line number Diff line
@@ -50,7 +50,7 @@ public:
        mFlinger.configureAndCommit();
        mFlinger.configureAndCommit();


        mDisplay = PrimaryDisplayVariant::makeFakeExistingDisplayInjector(this)
        mDisplay = PrimaryDisplayVariant::makeFakeExistingDisplayInjector(this)
                           .setDisplayModes(kModes, kModeId60, std::move(selectorPtr))
                           .setRefreshRateSelector(std::move(selectorPtr))
                           .inject();
                           .inject();


        // isVsyncPeriodSwitchSupported should return true, otherwise the SF's HWC proxy
        // isVsyncPeriodSwitchSupported should return true, otherwise the SF's HWC proxy
+8 −8
Original line number Original line Diff line number Diff line
@@ -801,16 +801,16 @@ public:
            return mFlinger.mutableDisplays().get(mDisplayToken)->get();
            return mFlinger.mutableDisplays().get(mDisplayToken)->get();
        }
        }


        // If `selectorPtr` is nullptr, the injector creates RefreshRateSelector from the `modes`.
        auto& setDisplayModes(DisplayModes modes, DisplayModeId activeModeId) {
        // Otherwise, it uses `selectorPtr`, which the caller must create using the same `modes`.
        //
        // TODO(b/182939859): Once `modes` can be retrieved from RefreshRateSelector, remove
        // the `selectorPtr` parameter in favor of an alternative setRefreshRateSelector API.
        auto& setDisplayModes(
                DisplayModes modes, DisplayModeId activeModeId,
                std::shared_ptr<scheduler::RefreshRateSelector> selectorPtr = nullptr) {
            mDisplayModes = std::move(modes);
            mDisplayModes = std::move(modes);
            mCreationArgs.activeModeId = activeModeId;
            mCreationArgs.activeModeId = activeModeId;
            mCreationArgs.refreshRateSelector = nullptr;
            return *this;
        }

        auto& setRefreshRateSelector(RefreshRateSelectorPtr selectorPtr) {
            mDisplayModes = selectorPtr->displayModes();
            mCreationArgs.activeModeId = selectorPtr->getActiveMode().modePtr->getId();
            mCreationArgs.refreshRateSelector = std::move(selectorPtr);
            mCreationArgs.refreshRateSelector = std::move(selectorPtr);
            return *this;
            return *this;
        }
        }