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

Commit 263aff55 authored by Marin Shalamanov's avatar Marin Shalamanov Committed by Android (Google) Code Review
Browse files

Merge "SF: Rename HwcConfigIndexType to DisplayModeId"

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


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


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


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


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


namespace android {
namespace android {


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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