diff options
| author | Ikalco <73481042+ikalco@users.noreply.github.com> | 2025-04-15 18:02:31 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-16 01:02:31 +0200 |
| commit | 0e521788bcc414c9cf81648d3167757d83deb60f (patch) | |
| tree | be5ff6f3773144f0f8af57969c3b1bd7eb350e74 /src/helpers/Monitor.cpp | |
| parent | ffd6cf65e40a7140e82dc6e076c90b5119d41a54 (diff) | |
core: wait for dmabuf readiness (#9806)
* add doOnReadable to event loop manager
* move syncTimeline addWaiter to doOnReadable
* wait on dmabuf buffers to be readable
* don't over synchronize in scanout, also give present feedback on same buffer commit
Diffstat (limited to 'src/helpers/Monitor.cpp')
| -rw-r--r-- | src/helpers/Monitor.cpp | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index 495cecbc..0a16643e 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -1377,6 +1377,10 @@ bool CMonitor::attemptDirectScanout() { auto PBUFFER = PSURFACE->current.buffer.buffer; if (PBUFFER == output->state->state().buffer) { + timespec now; + clock_gettime(CLOCK_MONOTONIC, &now); + PSURFACE->presentFeedback(&now, self.lock()); + if (scanoutNeedsCursorUpdate) { if (!state.test()) { Debug::log(TRACE, "attemptDirectScanout: failed basic test"); @@ -1423,32 +1427,10 @@ bool CMonitor::attemptDirectScanout() { output->state->addDamage(PSURFACE->current.accumulateBufferDamage()); output->state->resetExplicitFences(); - auto cleanup = CScopeGuard([this]() { output->state->resetExplicitFences(); }); - - auto explicitOptions = g_pHyprRenderer->getExplicitSyncSettings(output); - - bool DOEXPLICIT = PSURFACE->syncobj && PSURFACE->current.buffer && PSURFACE->current.acquire && explicitOptions.explicitKMSEnabled; - if (DOEXPLICIT) { - // wait for surface's explicit fence if present - inFence = PSURFACE->current.acquire.exportAsFD(); - if (inFence.isValid()) { - Debug::log(TRACE, "attemptDirectScanout: setting IN_FENCE for aq to {}", inFence.get()); - output->state->setExplicitInFence(inFence.get()); - } else { - Debug::log(TRACE, "attemptDirectScanout: failed to acquire an sync file fd for aq IN_FENCE"); - DOEXPLICIT = false; - } - } + // no need to do explicit sync here as surface current can only ever be ready to read bool ok = output->commit(); - if (!ok && DOEXPLICIT) { - Debug::log(TRACE, "attemptDirectScanout: EXPLICIT SYNC FAILED: commit() returned false. Resetting fences and retrying, might result in glitches."); - output->state->resetExplicitFences(); - - ok = output->commit(); - } - if (!ok) { Debug::log(TRACE, "attemptDirectScanout: failed to scanout surface"); lastScanout.reset(); |
