protocols: commit and presentation timing fixes (#13174)

* move commit timing fields to surface state

* fix toTimespec init

* update sendQueued api

* update onPresented api

* set zero copy flag

* send clock id

* move presented calcs inside condition

* use only CLOCK_MONOTONIC for commit/presentation timings

* fix setSetTimestamp

* do not wait for commit timing while tearing

* proto config

* fix config defaults
This commit is contained in:
UjinT34 2026-02-10 17:55:21 +03:00 committed by GitHub
parent 407a623801
commit ff061d177e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 107 additions and 64 deletions

View file

@ -626,6 +626,30 @@ bool CWLSurfaceResource::hasVisibleSubsurface() {
return false;
}
bool CWLSurfaceResource::isTearing() {
if (m_enteredOutputs.empty() && m_hlSurface) {
for (auto& m : g_pCompositor->m_monitors) {
if (!m || !m->m_enabled)
continue;
auto box = m_hlSurface->getSurfaceBoxGlobal();
if (box && !box->intersection({m->m_position, m->m_size}).empty()) {
if (m->m_tearingState.activelyTearing)
return true;
}
}
} else {
for (auto& m : m_enteredOutputs) {
if (!m)
continue;
if (m->m_tearingState.activelyTearing)
return true;
}
}
return false;
}
void CWLSurfaceResource::updateCursorShm(CRegion damage) {
if (damage.empty())
return;
@ -670,8 +694,14 @@ void CWLSurfaceResource::presentFeedback(const Time::steady_tp& when, PHLMONITOR
FEEDBACK->attachMonitor(pMonitor);
if (discarded)
FEEDBACK->discarded();
else
else {
FEEDBACK->presented();
if (!pMonitor->m_lastScanout.expired()) {
const auto WINDOW = m_hlSurface ? Desktop::View::CWindow::fromView(m_hlSurface->view()) : nullptr;
if (WINDOW == pMonitor->m_lastScanout)
FEEDBACK->setPresentationType(true);
}
}
PROTO::presentation->queueData(std::move(FEEDBACK));
}

View file

@ -128,6 +128,7 @@ class CWLSurfaceResource {
NColorManagement::PImageDescription getPreferredImageDescription();
void sortSubsurfaces();
bool hasVisibleSubsurface();
bool isTearing();
// returns a pair: found surface (null if not found) and surface local coords.
// localCoords param is relative to 0,0 of this surface