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

Commit df0b7059 authored by Fabien Sanglard's avatar Fabien Sanglard
Browse files

Rename variable disp to displayId for consistency

Change-Id: I5c0dc977e637a76eba44f8a27dac416c98a961d8
parent 8487e531
Loading
Loading
Loading
Loading
+17 −16
Original line number Diff line number Diff line
@@ -309,22 +309,22 @@ std::shared_ptr<HWC2::Layer> HWComposer::createLayer(int32_t displayId) {
    return layer;
}

nsecs_t HWComposer::getRefreshTimestamp(int32_t disp) const {
nsecs_t HWComposer::getRefreshTimestamp(int32_t displayId) const {
    // this returns the last refresh timestamp.
    // if the last one is not available, we estimate it based on
    // the refresh period and whatever closest timestamp we have.
    Mutex::Autolock _l(mLock);
    nsecs_t now = systemTime(CLOCK_MONOTONIC);
    auto vsyncPeriod = getActiveConfig(disp)->getVsyncPeriod();
    return now - ((now - mLastHwVSync[disp]) % vsyncPeriod);
    auto vsyncPeriod = getActiveConfig(displayId)->getVsyncPeriod();
    return now - ((now - mLastHwVSync[displayId]) % vsyncPeriod);
}

bool HWComposer::isConnected(int32_t disp) const {
    if (!isValidDisplay(disp)) {
        ALOGE("isConnected: Attempted to access invalid display %d", disp);
bool HWComposer::isConnected(int32_t displayId) const {
    if (!isValidDisplay(displayId)) {
        ALOGE("isConnected: Attempted to access invalid display %d", displayId);
        return false;
    }
    return mDisplayData[disp].hwcDisplay->isConnected();
    return mDisplayData[displayId].hwcDisplay->isConnected();
}

std::vector<std::shared_ptr<const HWC2::Display::Config>>
@@ -408,14 +408,15 @@ status_t HWComposer::setActiveColorMode(int32_t displayId, android_color_mode_t
}


void HWComposer::setVsyncEnabled(int32_t disp, HWC2::Vsync enabled) {
    if (disp < 0 || disp >= HWC_DISPLAY_VIRTUAL) {
        ALOGD("setVsyncEnabled: Ignoring for virtual display %d", disp);
void HWComposer::setVsyncEnabled(int32_t displayId, HWC2::Vsync enabled) {
    if (displayId < 0 || displayId >= HWC_DISPLAY_VIRTUAL) {
        ALOGD("setVsyncEnabled: Ignoring for virtual display %d", displayId);
        return;
    }

    if (!isValidDisplay(disp)) {
        ALOGE("setVsyncEnabled: Attempted to access invalid display %d", disp);
    if (!isValidDisplay(displayId)) {
        ALOGE("setVsyncEnabled: Attempted to access invalid display %d",
               displayId);
        return;
    }

@@ -424,7 +425,7 @@ void HWComposer::setVsyncEnabled(int32_t disp, HWC2::Vsync enabled) {
    // that even if HWC blocks (which it shouldn't), it won't
    // affect other threads.
    Mutex::Autolock _l(mVsyncLock);
    auto& displayData = mDisplayData[disp];
    auto& displayData = mDisplayData[displayId];
    if (enabled != displayData.vsyncEnabled) {
        ATRACE_CALL();
        auto error = displayData.hwcDisplay->setVsyncEnabled(enabled);
@@ -432,12 +433,12 @@ void HWComposer::setVsyncEnabled(int32_t disp, HWC2::Vsync enabled) {
            displayData.vsyncEnabled = enabled;

            char tag[16];
            snprintf(tag, sizeof(tag), "HW_VSYNC_ON_%1u", disp);
            snprintf(tag, sizeof(tag), "HW_VSYNC_ON_%1u", displayId);
            ATRACE_INT(tag, enabled == HWC2::Vsync::Enable ? 1 : 0);
        } else {
            ALOGE("setVsyncEnabled: Failed to set vsync to %s on %d/%" PRIu64
                    ": %s (%d)", to_string(enabled).c_str(), disp,
                    mDisplayData[disp].hwcDisplay->getId(),
                    ": %s (%d)", to_string(enabled).c_str(), displayId,
                    mDisplayData[displayId].hwcDisplay->getId(),
                    to_string(error).c_str(), static_cast<int32_t>(error));
        }
    }
+3 −3
Original line number Diff line number Diff line
@@ -140,12 +140,12 @@ public:

    // Events handling ---------------------------------------------------------

    void setVsyncEnabled(int32_t disp, HWC2::Vsync enabled);
    void setVsyncEnabled(int32_t displayId, HWC2::Vsync enabled);

    // Query display parameters.  Pass in a display index (e.g.
    // HWC_DISPLAY_PRIMARY).
    nsecs_t getRefreshTimestamp(int32_t disp) const;
    bool isConnected(int32_t disp) const;
    nsecs_t getRefreshTimestamp(int32_t displayId) const;
    bool isConnected(int32_t displayId) const;

    // Non-const because it can update configMap inside of mDisplayData
    std::vector<std::shared_ptr<const HWC2::Display::Config>>