Skip to content

Commit 9b327dd

Browse files
committed
monitor: mark 0, 0 presentation timestamps as invalid
fixes #10562
1 parent 24915a3 commit 9b327dd

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/helpers/Monitor.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,16 @@ void CMonitor::onConnect(bool noRule) {
7474
auto E = std::any_cast<Aquamarine::IOutput::SPresentEvent>(d);
7575

7676
timespec* ts = E.when;
77-
if (!ts) {
78-
timespec now;
79-
clock_gettime(CLOCK_MONOTONIC, &now);
80-
PROTO::presentation->onPresented(m_self.lock(), Time::fromTimespec(&now), E.refresh, E.seq, E.flags);
81-
} else
77+
78+
if (ts && ts->tv_sec <= 2) {
79+
// drop this timestamp, it's not valid. Likely drm is cringe. We can't push it further because
80+
// a) it's wrong, b) our translations aren't 100% accurate and risk underflows
81+
ts = nullptr;
82+
}
83+
84+
if (!ts)
85+
PROTO::presentation->onPresented(m_self.lock(), Time::steadyNow(), E.refresh, E.seq, E.flags);
86+
else
8287
PROTO::presentation->onPresented(m_self.lock(), Time::fromTimespec(E.when), E.refresh, E.seq, E.flags);
8388
});
8489

0 commit comments

Comments
 (0)