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

Commit f3e81d2f authored by Ady Abraham's avatar Ady Abraham
Browse files

SF: add PhysicalDisplayId to DisplayMode

A DisplayMode should include the PhysicalDisplayId it
belongs to we could use that to know which display the
mode belogs to.

Change-Id: I781cf30c5ccf886f061a45073b369b4f04cc9140
Bug: 187539899
Test: SF unit tests
Test: refresh rate switching is working on device with
more than one display

Change-Id: I9c73b43384cbe934f7584695e5fe5c53ab402bfb
Merged-In: I9c73b43384cbe934f7584695e5fe5c53ab402bfb
parent 6b7ad65e
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@

#include <android-base/stringprintf.h>
#include <android/configuration.h>
#include <ui/DisplayId.h>
#include <ui/DisplayMode.h>
#include <ui/Size.h>
#include <utils/Timers.h>
@@ -54,6 +55,11 @@ public:
            return *this;
        }

        Builder& setPhysicalDisplayId(PhysicalDisplayId id) {
            mDisplayMode->mPhysicalDisplayId = id;
            return *this;
        }

        Builder& setWidth(int32_t width) {
            mDisplayMode->mWidth = width;
            return *this;
@@ -112,6 +118,7 @@ public:

    DisplayModeId getId() const { return mId; }
    hal::HWConfigId getHwcId() const { return mHwcId; }
    PhysicalDisplayId getPhysicalDisplayId() const { return mPhysicalDisplayId; }

    int32_t getWidth() const { return mWidth; }
    int32_t getHeight() const { return mHeight; }
@@ -136,6 +143,7 @@ private:

    hal::HWConfigId mHwcId;
    DisplayModeId mId;
    PhysicalDisplayId mPhysicalDisplayId;

    int32_t mWidth = -1;
    int32_t mHeight = -1;
+1 −0
Original line number Diff line number Diff line
@@ -2531,6 +2531,7 @@ void SurfaceFlinger::loadDisplayModes(PhysicalDisplayId displayId, DisplayModes&
    for (const auto& hwcMode : hwcModes) {
        newModes.push_back(DisplayMode::Builder(hwcMode.hwcId)
                                   .setId(DisplayModeId{nextModeId++})
                                   .setPhysicalDisplayId(displayId)
                                   .setWidth(hwcMode.width)
                                   .setHeight(hwcMode.height)
                                   .setVsyncPeriod(hwcMode.vsyncPeriod)
+14 −14
Original line number Diff line number Diff line
@@ -115,17 +115,17 @@ protected:
                << "Frame rate is " << frameRate;
    }

    std::shared_ptr<RefreshRateConfigs> mConfigs =
            std::make_shared<RefreshRateConfigs>(DisplayModes{DisplayMode::Builder(0)
    std::shared_ptr<RefreshRateConfigs> mConfigs = std::make_shared<
            RefreshRateConfigs>(DisplayModes{DisplayMode::Builder(0)
                                                     .setId(DisplayModeId(0))
                                                                      .setVsyncPeriod(int32_t(
                                                                              LO_FPS_PERIOD))
                                                     .setPhysicalDisplayId(PhysicalDisplayId(0))
                                                     .setVsyncPeriod(int32_t(LO_FPS_PERIOD))
                                                     .setGroup(0)
                                                     .build(),
                                             DisplayMode::Builder(1)
                                                     .setId(DisplayModeId(1))
                                                                      .setVsyncPeriod(int32_t(
                                                                              HI_FPS_PERIOD))
                                                     .setPhysicalDisplayId(PhysicalDisplayId(0))
                                                     .setVsyncPeriod(int32_t(HI_FPS_PERIOD))
                                                     .setGroup(0)
                                                     .build()},
                                DisplayModeId(0));
+1 −0
Original line number Diff line number Diff line
@@ -181,6 +181,7 @@ DisplayModePtr RefreshRateConfigsTest::createDisplayMode(DisplayModeId modeId, i
                                                         int64_t vsyncPeriod, ui::Size resolution) {
    return DisplayMode::Builder(hal::HWConfigId(modeId.value()))
            .setId(modeId)
            .setPhysicalDisplayId(PhysicalDisplayId(0))
            .setVsyncPeriod(int32_t(vsyncPeriod))
            .setGroup(group)
            .setHeight(resolution.height)
+1 −0
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ DisplayModePtr RefreshRateStatsTest::createDisplayMode(DisplayModeId modeId, int
                                                       int64_t vsyncPeriod) {
    return DisplayMode::Builder(static_cast<hal::HWConfigId>(modeId.value()))
            .setId(modeId)
            .setPhysicalDisplayId(PhysicalDisplayId(0))
            .setVsyncPeriod(static_cast<int32_t>(vsyncPeriod))
            .setGroup(group)
            .build();
Loading