Kevin DuBois | b2501ba | 2019-11-12 14:20:29 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Kevin DuBois | 5988f48 | 2020-01-17 09:03:32 -0800 | [diff] [blame] | 17 | #define ATRACE_TAG ATRACE_TAG_GRAPHICS |
Kevin DuBois | c94ca83 | 2019-11-26 12:56:24 -0800 | [diff] [blame] | 18 | #undef LOG_TAG |
| 19 | #define LOG_TAG "VSyncReactor" |
Kevin DuBois | f91e923 | 2019-11-21 10:51:23 -0800 | [diff] [blame] | 20 | //#define LOG_NDEBUG 0 |
Kevin DuBois | b2501ba | 2019-11-12 14:20:29 -0800 | [diff] [blame] | 21 | #include "VSyncReactor.h" |
Ady Abraham | 13bc0be | 2020-02-27 16:48:20 -0800 | [diff] [blame] | 22 | #include <cutils/properties.h> |
Kevin DuBois | f91e923 | 2019-11-21 10:51:23 -0800 | [diff] [blame] | 23 | #include <log/log.h> |
Kevin DuBois | 5988f48 | 2020-01-17 09:03:32 -0800 | [diff] [blame] | 24 | #include <utils/Trace.h> |
Ady Abraham | 13bc0be | 2020-02-27 16:48:20 -0800 | [diff] [blame] | 25 | #include "../TracedOrdinal.h" |
Kevin DuBois | 2fd3cea | 2019-11-14 08:52:45 -0800 | [diff] [blame] | 26 | #include "TimeKeeper.h" |
Kevin DuBois | b2501ba | 2019-11-12 14:20:29 -0800 | [diff] [blame] | 27 | #include "VSyncDispatch.h" |
| 28 | #include "VSyncTracker.h" |
| 29 | |
| 30 | namespace android::scheduler { |
Ady Abraham | 5e7371c | 2020-03-24 14:47:24 -0700 | [diff] [blame] | 31 | using base::StringAppendF; |
Kevin DuBois | b2501ba | 2019-11-12 14:20:29 -0800 | [diff] [blame] | 32 | |
Kevin DuBois | 2fd3cea | 2019-11-14 08:52:45 -0800 | [diff] [blame] | 33 | Clock::~Clock() = default; |
Kevin DuBois | 0028738 | 2019-11-19 15:11:55 -0800 | [diff] [blame] | 34 | nsecs_t SystemClock::now() const { |
| 35 | return systemTime(SYSTEM_TIME_MONOTONIC); |
| 36 | } |
Kevin DuBois | 2fd3cea | 2019-11-14 08:52:45 -0800 | [diff] [blame] | 37 | |
Ady Abraham | 13bc0be | 2020-02-27 16:48:20 -0800 | [diff] [blame] | 38 | class PredictedVsyncTracer { |
| 39 | public: |
| 40 | PredictedVsyncTracer(VSyncDispatch& dispatch) |
Ady Abraham | 9c53ee7 | 2020-07-22 21:16:18 -0700 | [diff] [blame^] | 41 | : mRegistration(dispatch, std::bind(&PredictedVsyncTracer::callback, this), |
Ady Abraham | 13bc0be | 2020-02-27 16:48:20 -0800 | [diff] [blame] | 42 | "PredictedVsyncTracer") { |
Ady Abraham | 9c53ee7 | 2020-07-22 21:16:18 -0700 | [diff] [blame^] | 43 | scheduleRegistration(); |
Ady Abraham | 13bc0be | 2020-02-27 16:48:20 -0800 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | private: |
| 47 | TracedOrdinal<bool> mParity = {"VSYNC-predicted", 0}; |
| 48 | VSyncCallbackRegistration mRegistration; |
| 49 | |
Ady Abraham | 9c53ee7 | 2020-07-22 21:16:18 -0700 | [diff] [blame^] | 50 | void scheduleRegistration() { mRegistration.schedule({0, 0, 0}); } |
| 51 | |
| 52 | void callback() { |
Ady Abraham | 13bc0be | 2020-02-27 16:48:20 -0800 | [diff] [blame] | 53 | mParity = !mParity; |
Ady Abraham | 9c53ee7 | 2020-07-22 21:16:18 -0700 | [diff] [blame^] | 54 | scheduleRegistration(); |
Ady Abraham | 13bc0be | 2020-02-27 16:48:20 -0800 | [diff] [blame] | 55 | } |
| 56 | }; |
| 57 | |
Ady Abraham | 5a85855 | 2020-03-31 17:54:56 -0700 | [diff] [blame] | 58 | VSyncReactor::VSyncReactor(std::unique_ptr<Clock> clock, VSyncDispatch& dispatch, |
| 59 | VSyncTracker& tracker, size_t pendingFenceLimit, |
Dan Stoza | 027d365 | 2020-05-26 17:26:34 -0700 | [diff] [blame] | 60 | bool supportKernelIdleTimer) |
Kevin DuBois | 2fd3cea | 2019-11-14 08:52:45 -0800 | [diff] [blame] | 61 | : mClock(std::move(clock)), |
Ady Abraham | 5a85855 | 2020-03-31 17:54:56 -0700 | [diff] [blame] | 62 | mTracker(tracker), |
| 63 | mDispatch(dispatch), |
Ady Abraham | 13bc0be | 2020-02-27 16:48:20 -0800 | [diff] [blame] | 64 | mPendingLimit(pendingFenceLimit), |
| 65 | mPredictedVsyncTracer(property_get_bool("debug.sf.show_predicted_vsync", false) |
Ady Abraham | 5a85855 | 2020-03-31 17:54:56 -0700 | [diff] [blame] | 66 | ? std::make_unique<PredictedVsyncTracer>(mDispatch) |
Dan Stoza | 027d365 | 2020-05-26 17:26:34 -0700 | [diff] [blame] | 67 | : nullptr), |
| 68 | mSupportKernelIdleTimer(supportKernelIdleTimer) {} |
Kevin DuBois | b2501ba | 2019-11-12 14:20:29 -0800 | [diff] [blame] | 69 | |
Kevin DuBois | f91e923 | 2019-11-21 10:51:23 -0800 | [diff] [blame] | 70 | VSyncReactor::~VSyncReactor() = default; |
| 71 | |
Kevin DuBois | b2501ba | 2019-11-12 14:20:29 -0800 | [diff] [blame] | 72 | bool VSyncReactor::addPresentFence(const std::shared_ptr<FenceTime>& fence) { |
| 73 | if (!fence) { |
| 74 | return false; |
| 75 | } |
| 76 | |
| 77 | nsecs_t const signalTime = fence->getCachedSignalTime(); |
| 78 | if (signalTime == Fence::SIGNAL_TIME_INVALID) { |
| 79 | return true; |
| 80 | } |
| 81 | |
Ady Abraham | 9c53ee7 | 2020-07-22 21:16:18 -0700 | [diff] [blame^] | 82 | std::lock_guard lock(mMutex); |
Kevin DuBois | 02d5ed9 | 2020-01-27 11:05:46 -0800 | [diff] [blame] | 83 | if (mExternalIgnoreFences || mInternalIgnoreFences) { |
Kevin DuBois | b2501ba | 2019-11-12 14:20:29 -0800 | [diff] [blame] | 84 | return true; |
| 85 | } |
| 86 | |
Kevin DuBois | 02d5ed9 | 2020-01-27 11:05:46 -0800 | [diff] [blame] | 87 | bool timestampAccepted = true; |
Kevin DuBois | b2501ba | 2019-11-12 14:20:29 -0800 | [diff] [blame] | 88 | for (auto it = mUnfiredFences.begin(); it != mUnfiredFences.end();) { |
| 89 | auto const time = (*it)->getCachedSignalTime(); |
| 90 | if (time == Fence::SIGNAL_TIME_PENDING) { |
| 91 | it++; |
| 92 | } else if (time == Fence::SIGNAL_TIME_INVALID) { |
| 93 | it = mUnfiredFences.erase(it); |
| 94 | } else { |
Ady Abraham | 5a85855 | 2020-03-31 17:54:56 -0700 | [diff] [blame] | 95 | timestampAccepted &= mTracker.addVsyncTimestamp(time); |
Kevin DuBois | 02d5ed9 | 2020-01-27 11:05:46 -0800 | [diff] [blame] | 96 | |
Kevin DuBois | b2501ba | 2019-11-12 14:20:29 -0800 | [diff] [blame] | 97 | it = mUnfiredFences.erase(it); |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | if (signalTime == Fence::SIGNAL_TIME_PENDING) { |
| 102 | if (mPendingLimit == mUnfiredFences.size()) { |
| 103 | mUnfiredFences.erase(mUnfiredFences.begin()); |
| 104 | } |
| 105 | mUnfiredFences.push_back(fence); |
| 106 | } else { |
Ady Abraham | 5a85855 | 2020-03-31 17:54:56 -0700 | [diff] [blame] | 107 | timestampAccepted &= mTracker.addVsyncTimestamp(signalTime); |
Kevin DuBois | 02d5ed9 | 2020-01-27 11:05:46 -0800 | [diff] [blame] | 108 | } |
| 109 | |
| 110 | if (!timestampAccepted) { |
| 111 | mMoreSamplesNeeded = true; |
| 112 | setIgnorePresentFencesInternal(true); |
| 113 | mPeriodConfirmationInProgress = true; |
Kevin DuBois | b2501ba | 2019-11-12 14:20:29 -0800 | [diff] [blame] | 114 | } |
| 115 | |
Kevin DuBois | f77025c | 2019-12-18 16:13:24 -0800 | [diff] [blame] | 116 | return mMoreSamplesNeeded; |
Kevin DuBois | b2501ba | 2019-11-12 14:20:29 -0800 | [diff] [blame] | 117 | } |
| 118 | |
| 119 | void VSyncReactor::setIgnorePresentFences(bool ignoration) { |
Ady Abraham | 9c53ee7 | 2020-07-22 21:16:18 -0700 | [diff] [blame^] | 120 | std::lock_guard lock(mMutex); |
Kevin DuBois | 02d5ed9 | 2020-01-27 11:05:46 -0800 | [diff] [blame] | 121 | mExternalIgnoreFences = ignoration; |
| 122 | updateIgnorePresentFencesInternal(); |
| 123 | } |
| 124 | |
| 125 | void VSyncReactor::setIgnorePresentFencesInternal(bool ignoration) { |
| 126 | mInternalIgnoreFences = ignoration; |
| 127 | updateIgnorePresentFencesInternal(); |
| 128 | } |
| 129 | |
| 130 | void VSyncReactor::updateIgnorePresentFencesInternal() { |
| 131 | if (mExternalIgnoreFences || mInternalIgnoreFences) { |
Kevin DuBois | b2501ba | 2019-11-12 14:20:29 -0800 | [diff] [blame] | 132 | mUnfiredFences.clear(); |
| 133 | } |
| 134 | } |
| 135 | |
Ady Abraham | 0ed31c9 | 2020-04-16 11:48:45 -0700 | [diff] [blame] | 136 | nsecs_t VSyncReactor::computeNextRefresh(int periodOffset, nsecs_t now) const { |
Ady Abraham | 5a85855 | 2020-03-31 17:54:56 -0700 | [diff] [blame] | 137 | auto const currentPeriod = periodOffset ? mTracker.currentPeriod() : 0; |
| 138 | return mTracker.nextAnticipatedVSyncTimeFrom(now + periodOffset * currentPeriod); |
Kevin DuBois | 2fd3cea | 2019-11-14 08:52:45 -0800 | [diff] [blame] | 139 | } |
| 140 | |
Ady Abraham | 0ed31c9 | 2020-04-16 11:48:45 -0700 | [diff] [blame] | 141 | nsecs_t VSyncReactor::expectedPresentTime(nsecs_t now) { |
Ady Abraham | 5a85855 | 2020-03-31 17:54:56 -0700 | [diff] [blame] | 142 | return mTracker.nextAnticipatedVSyncTimeFrom(now); |
Kevin DuBois | 2fd3cea | 2019-11-14 08:52:45 -0800 | [diff] [blame] | 143 | } |
| 144 | |
Kevin DuBois | c4cdd37 | 2020-01-09 14:12:02 -0800 | [diff] [blame] | 145 | void VSyncReactor::startPeriodTransition(nsecs_t newPeriod) { |
Kevin DuBois | b818bfa | 2020-07-10 14:29:36 -0700 | [diff] [blame] | 146 | ATRACE_CALL(); |
Kevin DuBois | 02d5ed9 | 2020-01-27 11:05:46 -0800 | [diff] [blame] | 147 | mPeriodConfirmationInProgress = true; |
Kevin DuBois | c4cdd37 | 2020-01-09 14:12:02 -0800 | [diff] [blame] | 148 | mPeriodTransitioningTo = newPeriod; |
| 149 | mMoreSamplesNeeded = true; |
Kevin DuBois | 02d5ed9 | 2020-01-27 11:05:46 -0800 | [diff] [blame] | 150 | setIgnorePresentFencesInternal(true); |
Kevin DuBois | c4cdd37 | 2020-01-09 14:12:02 -0800 | [diff] [blame] | 151 | } |
| 152 | |
| 153 | void VSyncReactor::endPeriodTransition() { |
Kevin DuBois | b818bfa | 2020-07-10 14:29:36 -0700 | [diff] [blame] | 154 | ATRACE_CALL(); |
Kevin DuBois | 02d5ed9 | 2020-01-27 11:05:46 -0800 | [diff] [blame] | 155 | mPeriodTransitioningTo.reset(); |
| 156 | mPeriodConfirmationInProgress = false; |
| 157 | mLastHwVsync.reset(); |
Kevin DuBois | c4cdd37 | 2020-01-09 14:12:02 -0800 | [diff] [blame] | 158 | } |
| 159 | |
Kevin DuBois | ee2ad9f | 2019-11-21 11:10:57 -0800 | [diff] [blame] | 160 | void VSyncReactor::setPeriod(nsecs_t period) { |
Kevin DuBois | 5988f48 | 2020-01-17 09:03:32 -0800 | [diff] [blame] | 161 | ATRACE_INT64("VSR-setPeriod", period); |
Kevin DuBois | f77025c | 2019-12-18 16:13:24 -0800 | [diff] [blame] | 162 | std::lock_guard lk(mMutex); |
| 163 | mLastHwVsync.reset(); |
Dan Stoza | 027d365 | 2020-05-26 17:26:34 -0700 | [diff] [blame] | 164 | |
| 165 | if (!mSupportKernelIdleTimer && period == getPeriod()) { |
Kevin DuBois | c4cdd37 | 2020-01-09 14:12:02 -0800 | [diff] [blame] | 166 | endPeriodTransition(); |
Kevin DuBois | b818bfa | 2020-07-10 14:29:36 -0700 | [diff] [blame] | 167 | setIgnorePresentFencesInternal(false); |
| 168 | mMoreSamplesNeeded = false; |
Kevin DuBois | c4cdd37 | 2020-01-09 14:12:02 -0800 | [diff] [blame] | 169 | } else { |
| 170 | startPeriodTransition(period); |
| 171 | } |
Kevin DuBois | ee2ad9f | 2019-11-21 11:10:57 -0800 | [diff] [blame] | 172 | } |
| 173 | |
| 174 | nsecs_t VSyncReactor::getPeriod() { |
Ady Abraham | 5a85855 | 2020-03-31 17:54:56 -0700 | [diff] [blame] | 175 | return mTracker.currentPeriod(); |
Kevin DuBois | ee2ad9f | 2019-11-21 11:10:57 -0800 | [diff] [blame] | 176 | } |
| 177 | |
Kevin DuBois | c3e9e8e | 2020-01-07 09:06:52 -0800 | [diff] [blame] | 178 | void VSyncReactor::beginResync() { |
Ady Abraham | 5a85855 | 2020-03-31 17:54:56 -0700 | [diff] [blame] | 179 | mTracker.resetModel(); |
Kevin DuBois | c3e9e8e | 2020-01-07 09:06:52 -0800 | [diff] [blame] | 180 | } |
Kevin DuBois | a9fdab7 | 2019-11-14 09:44:14 -0800 | [diff] [blame] | 181 | |
Ady Abraham | 5dee2f1 | 2020-02-05 17:49:47 -0800 | [diff] [blame] | 182 | bool VSyncReactor::periodConfirmed(nsecs_t vsync_timestamp, std::optional<nsecs_t> HwcVsyncPeriod) { |
| 183 | if (!mPeriodConfirmationInProgress) { |
Kevin DuBois | f77025c | 2019-12-18 16:13:24 -0800 | [diff] [blame] | 184 | return false; |
| 185 | } |
Kevin DuBois | 02d5ed9 | 2020-01-27 11:05:46 -0800 | [diff] [blame] | 186 | |
Ady Abraham | 5dee2f1 | 2020-02-05 17:49:47 -0800 | [diff] [blame] | 187 | if (!mLastHwVsync && !HwcVsyncPeriod) { |
| 188 | return false; |
| 189 | } |
| 190 | |
Dan Stoza | 09bf763 | 2020-06-10 14:28:50 -0700 | [diff] [blame] | 191 | const bool periodIsChanging = |
| 192 | mPeriodTransitioningTo && (*mPeriodTransitioningTo != getPeriod()); |
| 193 | if (mSupportKernelIdleTimer && !periodIsChanging) { |
Dan Stoza | 027d365 | 2020-05-26 17:26:34 -0700 | [diff] [blame] | 194 | // Clear out the Composer-provided period and use the allowance logic below |
| 195 | HwcVsyncPeriod = {}; |
| 196 | } |
| 197 | |
Ady Abraham | 5dee2f1 | 2020-02-05 17:49:47 -0800 | [diff] [blame] | 198 | auto const period = mPeriodTransitioningTo ? *mPeriodTransitioningTo : getPeriod(); |
Kevin DuBois | 02d5ed9 | 2020-01-27 11:05:46 -0800 | [diff] [blame] | 199 | static constexpr int allowancePercent = 10; |
| 200 | static constexpr std::ratio<allowancePercent, 100> allowancePercentRatio; |
| 201 | auto const allowance = period * allowancePercentRatio.num / allowancePercentRatio.den; |
Ady Abraham | 5dee2f1 | 2020-02-05 17:49:47 -0800 | [diff] [blame] | 202 | if (HwcVsyncPeriod) { |
| 203 | return std::abs(*HwcVsyncPeriod - period) < allowance; |
| 204 | } |
| 205 | |
Kevin DuBois | f77025c | 2019-12-18 16:13:24 -0800 | [diff] [blame] | 206 | auto const distance = vsync_timestamp - *mLastHwVsync; |
Kevin DuBois | 02d5ed9 | 2020-01-27 11:05:46 -0800 | [diff] [blame] | 207 | return std::abs(distance - period) < allowance; |
Kevin DuBois | f77025c | 2019-12-18 16:13:24 -0800 | [diff] [blame] | 208 | } |
| 209 | |
Ady Abraham | 5dee2f1 | 2020-02-05 17:49:47 -0800 | [diff] [blame] | 210 | bool VSyncReactor::addResyncSample(nsecs_t timestamp, std::optional<nsecs_t> hwcVsyncPeriod, |
| 211 | bool* periodFlushed) { |
Kevin DuBois | a9fdab7 | 2019-11-14 09:44:14 -0800 | [diff] [blame] | 212 | assert(periodFlushed); |
Kevin DuBois | f77025c | 2019-12-18 16:13:24 -0800 | [diff] [blame] | 213 | |
Ady Abraham | 9c53ee7 | 2020-07-22 21:16:18 -0700 | [diff] [blame^] | 214 | std::lock_guard lock(mMutex); |
Ady Abraham | 5dee2f1 | 2020-02-05 17:49:47 -0800 | [diff] [blame] | 215 | if (periodConfirmed(timestamp, hwcVsyncPeriod)) { |
Kevin DuBois | b818bfa | 2020-07-10 14:29:36 -0700 | [diff] [blame] | 216 | ATRACE_NAME("VSR: period confirmed"); |
Kevin DuBois | 02d5ed9 | 2020-01-27 11:05:46 -0800 | [diff] [blame] | 217 | if (mPeriodTransitioningTo) { |
Ady Abraham | 5a85855 | 2020-03-31 17:54:56 -0700 | [diff] [blame] | 218 | mTracker.setPeriod(*mPeriodTransitioningTo); |
Kevin DuBois | 02d5ed9 | 2020-01-27 11:05:46 -0800 | [diff] [blame] | 219 | *periodFlushed = true; |
Kevin DuBois | f77025c | 2019-12-18 16:13:24 -0800 | [diff] [blame] | 220 | } |
Kevin DuBois | b818bfa | 2020-07-10 14:29:36 -0700 | [diff] [blame] | 221 | |
| 222 | if (mLastHwVsync) { |
Ady Abraham | 5a85855 | 2020-03-31 17:54:56 -0700 | [diff] [blame] | 223 | mTracker.addVsyncTimestamp(*mLastHwVsync); |
Kevin DuBois | b818bfa | 2020-07-10 14:29:36 -0700 | [diff] [blame] | 224 | } |
Ady Abraham | 5a85855 | 2020-03-31 17:54:56 -0700 | [diff] [blame] | 225 | mTracker.addVsyncTimestamp(timestamp); |
Kevin DuBois | b818bfa | 2020-07-10 14:29:36 -0700 | [diff] [blame] | 226 | |
Kevin DuBois | c4cdd37 | 2020-01-09 14:12:02 -0800 | [diff] [blame] | 227 | endPeriodTransition(); |
Ady Abraham | 5a85855 | 2020-03-31 17:54:56 -0700 | [diff] [blame] | 228 | mMoreSamplesNeeded = mTracker.needsMoreSamples(); |
Kevin DuBois | 02d5ed9 | 2020-01-27 11:05:46 -0800 | [diff] [blame] | 229 | } else if (mPeriodConfirmationInProgress) { |
Kevin DuBois | b818bfa | 2020-07-10 14:29:36 -0700 | [diff] [blame] | 230 | ATRACE_NAME("VSR: still confirming period"); |
Kevin DuBois | f77025c | 2019-12-18 16:13:24 -0800 | [diff] [blame] | 231 | mLastHwVsync = timestamp; |
| 232 | mMoreSamplesNeeded = true; |
| 233 | *periodFlushed = false; |
| 234 | } else { |
Kevin DuBois | b818bfa | 2020-07-10 14:29:36 -0700 | [diff] [blame] | 235 | ATRACE_NAME("VSR: adding sample"); |
Kevin DuBois | f77025c | 2019-12-18 16:13:24 -0800 | [diff] [blame] | 236 | *periodFlushed = false; |
Ady Abraham | 5a85855 | 2020-03-31 17:54:56 -0700 | [diff] [blame] | 237 | mTracker.addVsyncTimestamp(timestamp); |
| 238 | mMoreSamplesNeeded = mTracker.needsMoreSamples(); |
Kevin DuBois | a9fdab7 | 2019-11-14 09:44:14 -0800 | [diff] [blame] | 239 | } |
Kevin DuBois | f77025c | 2019-12-18 16:13:24 -0800 | [diff] [blame] | 240 | |
Kevin DuBois | b818bfa | 2020-07-10 14:29:36 -0700 | [diff] [blame] | 241 | if (!mMoreSamplesNeeded) { |
| 242 | setIgnorePresentFencesInternal(false); |
| 243 | } |
Kevin DuBois | f77025c | 2019-12-18 16:13:24 -0800 | [diff] [blame] | 244 | return mMoreSamplesNeeded; |
Kevin DuBois | a9fdab7 | 2019-11-14 09:44:14 -0800 | [diff] [blame] | 245 | } |
| 246 | |
Kevin DuBois | 0028738 | 2019-11-19 15:11:55 -0800 | [diff] [blame] | 247 | void VSyncReactor::dump(std::string& result) const { |
Ady Abraham | 9c53ee7 | 2020-07-22 21:16:18 -0700 | [diff] [blame^] | 248 | std::lock_guard lock(mMutex); |
Ady Abraham | 5e7371c | 2020-03-24 14:47:24 -0700 | [diff] [blame] | 249 | StringAppendF(&result, "VsyncReactor in use\n"); |
| 250 | StringAppendF(&result, "Has %zu unfired fences\n", mUnfiredFences.size()); |
| 251 | StringAppendF(&result, "mInternalIgnoreFences=%d mExternalIgnoreFences=%d\n", |
| 252 | mInternalIgnoreFences, mExternalIgnoreFences); |
| 253 | StringAppendF(&result, "mMoreSamplesNeeded=%d mPeriodConfirmationInProgress=%d\n", |
| 254 | mMoreSamplesNeeded, mPeriodConfirmationInProgress); |
| 255 | if (mPeriodTransitioningTo) { |
| 256 | StringAppendF(&result, "mPeriodTransitioningTo=%" PRId64 "\n", *mPeriodTransitioningTo); |
| 257 | } else { |
| 258 | StringAppendF(&result, "mPeriodTransitioningTo=nullptr\n"); |
| 259 | } |
| 260 | |
| 261 | if (mLastHwVsync) { |
| 262 | StringAppendF(&result, "Last HW vsync was %.2fms ago\n", |
| 263 | (mClock->now() - *mLastHwVsync) / 1e6f); |
| 264 | } else { |
| 265 | StringAppendF(&result, "No Last HW vsync\n"); |
| 266 | } |
| 267 | |
Ady Abraham | 5e7371c | 2020-03-24 14:47:24 -0700 | [diff] [blame] | 268 | StringAppendF(&result, "VSyncTracker:\n"); |
Ady Abraham | 5a85855 | 2020-03-31 17:54:56 -0700 | [diff] [blame] | 269 | mTracker.dump(result); |
Ady Abraham | 5e7371c | 2020-03-24 14:47:24 -0700 | [diff] [blame] | 270 | StringAppendF(&result, "VSyncDispatch:\n"); |
Ady Abraham | 5a85855 | 2020-03-31 17:54:56 -0700 | [diff] [blame] | 271 | mDispatch.dump(result); |
Kevin DuBois | 0028738 | 2019-11-19 15:11:55 -0800 | [diff] [blame] | 272 | } |
| 273 | |
Kevin DuBois | b2501ba | 2019-11-12 14:20:29 -0800 | [diff] [blame] | 274 | } // namespace android::scheduler |