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>>
}
-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;
}
// 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);
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));
}
}