Signed-off-by: hsc <husichao1@huawei.com>
This commit is contained in:
hsc 2024-09-06 12:02:35 +08:00
parent 8ffa48224a
commit 7ca2c0c31a

View File

@ -139,8 +139,10 @@ void VSyncGenerator::ListenerVsyncEventCB(int64_t occurTimestamp, int64_t nextTi
{
SCOPED_DEBUG_TRACE_FMT("occurTimestamp:%ld, nextTimeStamp:%ld", occurTimestamp, nextTimeStamp);
std::vector<Listener> listeners;
uint32_t vsyncMaxRefreshRate = 360;
{
std::unique_lock<std::mutex> locker(mutex_);
vsyncMaxRefreshRate = vsyncMaxRefreshRate_;
int64_t newOccurTimestamp = SystemTime();
if (isWakeup) {
UpdateWakeupDelay(newOccurTimestamp, nextTimeStamp);
@ -158,7 +160,7 @@ void VSyncGenerator::ListenerVsyncEventCB(int64_t occurTimestamp, int64_t nextTi
RS_TRACE_NAME_FMT("listener phase is %ld", listeners[i].phase_);
if (listeners[i].callback_ != nullptr) {
listeners[i].callback_->OnVSyncEvent(listeners[i].lastTime_,
periodRecord_, currRefreshRate_, vsyncMode_, vsyncMaxRefreshRate_);
periodRecord_, currRefreshRate_, vsyncMode_, vsyncMaxRefreshRate);
}
}
}
@ -734,6 +736,7 @@ uint32_t VSyncGenerator::GetVSyncMaxRefreshRate()
VsyncError VSyncGenerator::SetVSyncMaxRefreshRate(uint32_t refreshRate)
{
std::lock_guard<std::mutex> locker(mutex_);
if (refreshRate < VSYNC_MAX_REFRESHRATE_RANGE_MIN ||
refreshRate > VSYNC_MAX_REFRESHRATE_RANGE_MAX) {
VLOGE("Not support max refresh rate: %{public}u", refreshRate);