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

Commit 23c4420b authored by Marin Shalamanov's avatar Marin Shalamanov
Browse files

SF: Rename HwcConfigIndexType to DisplayModeId

Bug: 159590486
Bug: 176148651
Test: atest libsurfaceflinger_unittest

Change-Id: Ie177b213bb7a8ab9f67a51d2b5cf27d8fd97b780
parent 2fc978ff
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ public:
    MOCK_CONST_METHOD1(isVsyncPeriodSwitchSupported, bool(PhysicalDisplayId));
    MOCK_CONST_METHOD1(getDisplayVsyncPeriod, nsecs_t(PhysicalDisplayId));
    MOCK_METHOD4(setActiveModeWithConstraints,
                 status_t(PhysicalDisplayId, HwcConfigIndexType,
                 status_t(PhysicalDisplayId, DisplayModeId,
                          const hal::VsyncPeriodChangeConstraints&,
                          hal::VsyncPeriodChangeTimeline*));
    MOCK_METHOD2(setAutoLowLatencyMode, status_t(PhysicalDisplayId, bool));
+5 −5
Original line number Diff line number Diff line
@@ -139,12 +139,12 @@ bool DisplayDevice::isPoweredOn() const {
    return mPowerMode != hal::PowerMode::OFF;
}

void DisplayDevice::setActiveConfig(HwcConfigIndexType mode) {
    mActiveConfig = mode;
void DisplayDevice::setActiveMode(DisplayModeId mode) {
    mActiveMode = mode;
}

HwcConfigIndexType DisplayDevice::getActiveConfig() const {
    return mActiveConfig;
DisplayModeId DisplayDevice::getActiveMode() const {
    return mActiveMode;
}

ui::Dataspace DisplayDevice::getCompositionDataSpace() const {
@@ -210,7 +210,7 @@ void DisplayDevice::dump(std::string& result) const {
    result.append("   ");
    StringAppendF(&result, "powerMode=%s (%d), ", to_string(mPowerMode).c_str(),
                  static_cast<int32_t>(mPowerMode));
    StringAppendF(&result, "activeConfig=%zu, ", mActiveConfig.value());
    StringAppendF(&result, "activeConfig=%zu, ", mActiveMode.value());
    StringAppendF(&result, "deviceProductInfo=");
    if (mDeviceProductInfo) {
        mDeviceProductInfo->dump(result);
+4 −4
Original line number Diff line number Diff line
@@ -39,9 +39,9 @@
#include <utils/Timers.h>

#include "DisplayHardware/DisplayIdentification.h"
#include "DisplayHardware/DisplayMode.h"
#include "DisplayHardware/Hal.h"
#include "DisplayHardware/PowerAdvisor.h"
#include "Scheduler/HwcStrongTypes.h"

namespace android {

@@ -159,8 +159,8 @@ public:
    /* ------------------------------------------------------------------------
     * Display active config management.
     */
    HwcConfigIndexType getActiveConfig() const;
    void setActiveConfig(HwcConfigIndexType mode);
    DisplayModeId getActiveMode() const;
    void setActiveMode(DisplayModeId mode);

    // release HWC resources (if any) for removable displays
    void disconnect();
@@ -189,7 +189,7 @@ private:

    hardware::graphics::composer::hal::PowerMode mPowerMode =
            hardware::graphics::composer::hal::PowerMode::OFF;
    HwcConfigIndexType mActiveConfig;
    DisplayModeId mActiveMode;

    // TODO(b/74619554): Remove special cases for primary display.
    const bool mIsPrimary;
+6 −4
Original line number Diff line number Diff line
@@ -17,11 +17,12 @@
#pragma once

#include "DisplayHardware/Hal.h"
#include "Scheduler/HwcStrongTypes.h"
#include "Scheduler/StrongTyping.h"

#include <android/configuration.h>
#include <utils/Timers.h>

#include <cstddef>
#include <memory>
#include <vector>

@@ -32,6 +33,7 @@ namespace hal = android::hardware::graphics::composer::hal;
class DisplayMode;
using DisplayModePtr = std::shared_ptr<const DisplayMode>;
using DisplayModes = std::vector<DisplayModePtr>;
using DisplayModeId = StrongTyping<size_t, struct DisplayModeIdTag, Compare, Hash>;

class DisplayMode {
public:
@@ -43,7 +45,7 @@ public:
            return std::const_pointer_cast<const DisplayMode>(std::move(mDisplayMode));
        }

        Builder& setId(HwcConfigIndexType id) {
        Builder& setId(DisplayModeId id) {
            mDisplayMode->mId = id;
            return *this;
        }
@@ -104,7 +106,7 @@ public:
        std::shared_ptr<DisplayMode> mDisplayMode;
    };

    HwcConfigIndexType getId() const { return mId; }
    DisplayModeId getId() const { return mId; }
    hal::HWConfigId getHwcId() const { return mHwcId; }

    int32_t getWidth() const { return mWidth; }
@@ -118,7 +120,7 @@ private:
    explicit DisplayMode(hal::HWConfigId id) : mHwcId(id) {}

    hal::HWConfigId mHwcId;
    HwcConfigIndexType mId;
    DisplayModeId mId;

    int32_t mWidth = -1;
    int32_t mHeight = -1;
+2 −2
Original line number Diff line number Diff line
@@ -318,7 +318,7 @@ void HWComposer::loadModes(DisplayData& displayData, hal::HWDisplayId hwcDisplay
    displayData.modes.clear();
    for (auto configId : configIds) {
        auto mode = DisplayMode::Builder(configId)
                            .setId(HwcConfigIndexType(displayData.modes.size()))
                            .setId(DisplayModeId(displayData.modes.size()))
                            .setWidth(getAttribute(hwcDisplayId, configId, hal::Attribute::WIDTH))
                            .setHeight(getAttribute(hwcDisplayId, configId, hal::Attribute::HEIGHT))
                            .setVsyncPeriod(getAttribute(hwcDisplayId, configId,
@@ -674,7 +674,7 @@ status_t HWComposer::setPowerMode(PhysicalDisplayId displayId, hal::PowerMode mo
}

status_t HWComposer::setActiveModeWithConstraints(
        PhysicalDisplayId displayId, HwcConfigIndexType modeId,
        PhysicalDisplayId displayId, DisplayModeId modeId,
        const hal::VsyncPeriodChangeConstraints& constraints,
        hal::VsyncPeriodChangeTimeline* outTimeline) {
    RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX);
Loading