From df0b7059646db0734f614e0dd651e0ac6ce82211 Mon Sep 17 00:00:00 2001 From: Fabien Sanglard Date: Wed, 30 Nov 2016 15:51:53 -0800 Subject: Rename variable disp to displayId for consistency Change-Id: I5c0dc977e637a76eba44f8a27dac416c98a961d8 --- .../surfaceflinger/DisplayHardware/HWComposer.cpp | 33 +++++++++++----------- .../surfaceflinger/DisplayHardware/HWComposer.h | 6 ++-- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp index 82a900c06d..46ddcc9475 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp +++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp @@ -309,22 +309,22 @@ std::shared_ptr 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> @@ -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(error)); } } diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h index 41671f62fd..f2d5800316 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.h +++ b/services/surfaceflinger/DisplayHardware/HWComposer.h @@ -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> -- cgit v1.2.3-59-g8ed1b