diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-05-20 01:28:55 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-05-20 01:28:55 +0000 |
commit | 5752f91ceb9b37578070e0226ba15727e14b6375 (patch) | |
tree | 1a2538450545b1da11507d7b33d587bba7c8476c | |
parent | 75412182ba726ec18d1d1809daa356ec6e95c895 (diff) | |
parent | 2a4e22ebcc9afeabdd953b5eb3f9b12e33433838 (diff) |
Snap for 10171451 from 2a4e22ebcc9afeabdd953b5eb3f9b12e33433838 to udc-release
Change-Id: Ibe24945550d0ce22edf982abcf08faa26d9da7f2
-rw-r--r-- | libhwc2.1/ExynosHWCDebug.h | 8 | ||||
-rw-r--r-- | libhwc2.1/libdevice/ExynosDisplay.cpp | 15 | ||||
-rw-r--r-- | libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.cpp | 49 |
3 files changed, 45 insertions, 27 deletions
diff --git a/libhwc2.1/ExynosHWCDebug.h b/libhwc2.1/ExynosHWCDebug.h index 37d96fd..8bc6092 100644 --- a/libhwc2.1/ExynosHWCDebug.h +++ b/libhwc2.1/ExynosHWCDebug.h @@ -166,4 +166,12 @@ public: value); \ } +#define DISPLAY_LOGD_AND_ATRACE_NAME(debugFlag, fmt, ...) \ + if (hwcCheckDebugMessages(debugFlag) || CC_UNLIKELY(ATRACE_ENABLED())) { \ + String8 log; \ + log.appendFormat((fmt), ##__VA_ARGS__); \ + DISPLAY_LOGD(debugFlag, "%s", log.string()); \ + if (CC_UNLIKELY(ATRACE_ENABLED())) ATRACE_NAME(log.string()); \ + } + #endif diff --git a/libhwc2.1/libdevice/ExynosDisplay.cpp b/libhwc2.1/libdevice/ExynosDisplay.cpp index fe927ae..c6b7433 100644 --- a/libhwc2.1/libdevice/ExynosDisplay.cpp +++ b/libhwc2.1/libdevice/ExynosDisplay.cpp @@ -1173,6 +1173,7 @@ int32_t ExynosDisplay::destroyLayer(hwc2_layer_t outLayer) { } mDisplayInterface->destroyLayer(layer); + layer->resetAssignedResource(); delete layer; @@ -4077,12 +4078,12 @@ int32_t ExynosDisplay::setActiveConfigWithConstraints(hwc2_config_t config, { DISPLAY_ATRACE_CALL(); Mutex::Autolock lock(mDisplayMutex); + const nsecs_t current = systemTime(SYSTEM_TIME_MONOTONIC); + const nsecs_t diffMs = ns2ms(vsyncPeriodChangeConstraints->desiredTimeNanos - current); + DISPLAY_LOGD(eDebugDisplayConfig, "config(%d->%d), seamless(%d), diff(%" PRId64 ")", + mActiveConfig, config, vsyncPeriodChangeConstraints->seamlessRequired, diffMs); - DISPLAY_LOGD(eDebugDisplayConfig, - "config(%d), seamless(%d), " - "desiredTime(%" PRId64 ")", - config, vsyncPeriodChangeConstraints->seamlessRequired, - vsyncPeriodChangeConstraints->desiredTimeNanos); + if (CC_UNLIKELY(ATRACE_ENABLED())) ATRACE_NAME(("diff:" + std::to_string(diffMs)).c_str()); if (isBadConfig(config)) return HWC2_ERROR_BAD_CONFIG; @@ -4134,6 +4135,7 @@ int32_t ExynosDisplay::setActiveConfigWithConstraints(hwc2_config_t config, mConfigRequestState = hwc_request_state_t::SET_CONFIG_STATE_PENDING; mVsyncPeriodChangeConstraints = *vsyncPeriodChangeConstraints; mDesiredConfig = config; + DISPLAY_ATRACE_INT("Pending ActiveConfig", mDesiredConfig); calculateTimeline(config, vsyncPeriodChangeConstraints, outTimeline); @@ -4346,6 +4348,7 @@ int32_t ExynosDisplay::doDisplayConfigInternal(hwc2_config_t config) { int32_t ExynosDisplay::doDisplayConfigPostProcess(ExynosDevice *dev) { + ATRACE_CALL(); uint64_t current = systemTime(SYSTEM_TIME_MONOTONIC); int64_t actualChangeTime = 0; @@ -4361,10 +4364,12 @@ int32_t ExynosDisplay::doDisplayConfigPostProcess(ExynosDevice *dev) DISPLAY_LOGD(eDebugDisplayConfig, "Request setActiveConfig"); needSetActiveConfig = true; DISPLAY_ATRACE_INT("Pending ActiveConfig", 0); + DISPLAY_ATRACE_INT64("TimeToChangeConfig", 0); } else { DISPLAY_LOGD(eDebugDisplayConfig, "setActiveConfig still pending (mDesiredConfig %d)", mDesiredConfig); DISPLAY_ATRACE_INT("Pending ActiveConfig", mDesiredConfig); + DISPLAY_ATRACE_INT64("TimeToChangeConfig", ns2ms(actualChangeTime - current)); } if (needSetActiveConfig) { diff --git a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.cpp b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.cpp index c5ead2c..20dfea0 100644 --- a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.cpp +++ b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.cpp @@ -547,6 +547,8 @@ bool ExynosPrimaryDisplay::isConfigSettingEnabled() { } void ExynosPrimaryDisplay::enableConfigSetting(bool en) { + DISPLAY_ATRACE_INT("ConfigSettingDisabled", !en); + if (!en) { mConfigSettingDisabled = true; mConfigSettingDisabledTimestamp = systemTime(SYSTEM_TIME_MONOTONIC); @@ -769,6 +771,7 @@ void ExynosPrimaryDisplay::setLHBMRefreshRateThrottle(const uint32_t delayMs) { if (delayMs) { // make new throttle take effect mLastRefreshRateAppliedNanos = systemTime(SYSTEM_TIME_MONOTONIC); + DISPLAY_ATRACE_INT64("LastRefreshRateAppliedMs", ns2ms(mLastRefreshRateAppliedNanos)); } setRefreshRateThrottleNanos(std::chrono::duration_cast<std::chrono::nanoseconds>( @@ -976,6 +979,7 @@ int ExynosPrimaryDisplay::setMinIdleRefreshRate(const int fps) { int ExynosPrimaryDisplay::setRefreshRateThrottleNanos(const int64_t delayNanos, const VrrThrottleRequester requester) { + ATRACE_CALL(); ALOGI("%s() requester(%u) set delay to %" PRId64 "ns", __func__, toUnderlying(requester), delayNanos); if (delayNanos < 0) { @@ -993,12 +997,12 @@ int ExynosPrimaryDisplay::setRefreshRateThrottleNanos(const int64_t delayNanos, } } + DISPLAY_ATRACE_INT64("RefreshRateDelay", ns2ms(maxDelayNanos)); if (mRefreshRateDelayNanos == maxDelayNanos) { return NO_ERROR; } mRefreshRateDelayNanos = maxDelayNanos; - return setDisplayIdleDelayNanos(mRefreshRateDelayNanos, DispIdleTimerRequester::VRR_THROTTLE); } @@ -1023,6 +1027,7 @@ void ExynosPrimaryDisplay::dump(String8 &result) { void ExynosPrimaryDisplay::calculateTimeline( hwc2_config_t config, hwc_vsync_period_change_constraints_t *vsyncPeriodChangeConstraints, hwc_vsync_period_change_timeline_t *outTimeline) { + ATRACE_CALL(); int64_t desiredUpdateTime = vsyncPeriodChangeConstraints->desiredTimeNanos; const int64_t origDesiredUpdateTime = desiredUpdateTime; const int64_t threshold = mRefreshRateDelayNanos; @@ -1050,31 +1055,30 @@ void ExynosPrimaryDisplay::calculateTimeline( getConfigAppliedTime(mVsyncPeriodChangeConstraints.desiredTimeNanos, actualChangeTime, outTimeline->newVsyncAppliedTimeNanos, outTimeline->refreshTimeNanos); - if (isDelayed) { - DISPLAY_LOGD(eDebugDisplayConfig, - "requested config : %d(%d)->%d(%d) is delayed! " - "delta %" PRId64 ", delay %" PRId64 ", threshold %" PRId64 ", " - "desired %" PRId64 "->%" PRId64 ", newVsyncAppliedTimeNanos : %" PRId64 - ", refreshTimeNanos:%" PRId64, - mActiveConfig, mDisplayConfigs[mActiveConfig].vsyncPeriod, config, - mDisplayConfigs[config].vsyncPeriod, lastUpdateDelta, - threshold - lastUpdateDelta, threshold, origDesiredUpdateTime, - mVsyncPeriodChangeConstraints.desiredTimeNanos, - outTimeline->newVsyncAppliedTimeNanos, outTimeline->refreshTimeNanos); - } else { - DISPLAY_LOGD(eDebugDisplayConfig, - "requested config : %d(%d)->%d(%d), " - "lastUpdateDelta %" PRId64 ", threshold %" PRId64 ", " - "desired %" PRId64 ", newVsyncAppliedTimeNanos : %" PRId64 "", - mActiveConfig, mDisplayConfigs[mActiveConfig].vsyncPeriod, config, - mDisplayConfigs[config].vsyncPeriod, lastUpdateDelta, threshold, - mVsyncPeriodChangeConstraints.desiredTimeNanos, - outTimeline->newVsyncAppliedTimeNanos); - } + const nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); + DISPLAY_LOGD_AND_ATRACE_NAME(eDebugDisplayConfig, + "requested config : %d(%d)->%d(%d), isDelay:%d," + " delta %" PRId64 ", delay %" PRId64 ", threshold %" PRId64 ", " + "now:%" PRId64 ", desired %" PRId64 "->%" PRId64 + ", newVsyncAppliedTimeNanos : %" PRId64 + ", refreshTimeNanos:%" PRId64 + ", mLastRefreshRateAppliedNanos:%" PRId64, + mActiveConfig, mDisplayConfigs[mActiveConfig].vsyncPeriod, config, + mDisplayConfigs[config].vsyncPeriod, isDelayed, + ns2ms(lastUpdateDelta), ns2ms(threshold - lastUpdateDelta), + ns2ms(threshold), ns2ms(now), ns2ms(origDesiredUpdateTime), + ns2ms(mVsyncPeriodChangeConstraints.desiredTimeNanos), + ns2ms(outTimeline->newVsyncAppliedTimeNanos), + ns2ms(outTimeline->refreshTimeNanos), + ns2ms(mLastRefreshRateAppliedNanos)); + + const int64_t diffMs = ns2ms(outTimeline->refreshTimeNanos - now); + DISPLAY_ATRACE_INT64("TimeToChangeConfig", diffMs); } void ExynosPrimaryDisplay::updateAppliedActiveConfig(const hwc2_config_t newConfig, const int64_t ts) { + ATRACE_CALL(); if (mAppliedActiveConfig == 0 || getDisplayVsyncPeriodFromConfig(mAppliedActiveConfig) != getDisplayVsyncPeriodFromConfig(newConfig)) { @@ -1083,6 +1087,7 @@ void ExynosPrimaryDisplay::updateAppliedActiveConfig(const hwc2_config_t newConf " -> %" PRIu64 ")", __func__, mAppliedActiveConfig, newConfig, mLastRefreshRateAppliedNanos, ts); mLastRefreshRateAppliedNanos = ts; + DISPLAY_ATRACE_INT64("LastRefreshRateAppliedMs", ns2ms(mLastRefreshRateAppliedNanos)); } mAppliedActiveConfig = newConfig; |