summaryrefslogtreecommitdiff
path: root/src/helpers/Monitor.cpp
diff options
context:
space:
mode:
authorIkalco <73481042+ikalco@users.noreply.github.com>2025-03-17 16:06:41 -0500
committerGitHub <noreply@github.com>2025-03-17 22:06:41 +0100
commit5f60fc7d00eb08ee39cac1f5eceeb97ffbea0e7f (patch)
treeb72f0b0953f8ddd4afdd8afeb85bceabc0578935 /src/helpers/Monitor.cpp
parentc4f46473df0cbfcc822e3158db717c6b7f809760 (diff)
renderer: only commit hw cursor stuff if needed (#9654)
Diffstat (limited to 'src/helpers/Monitor.cpp')
-rw-r--r--src/helpers/Monitor.cpp29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp
index d3c0549c..2af548d2 100644
--- a/src/helpers/Monitor.cpp
+++ b/src/helpers/Monitor.cpp
@@ -1355,8 +1355,26 @@ bool CMonitor::attemptDirectScanout() {
Debug::log(TRACE, "attemptDirectScanout: surface {:x} passed, will attempt, buffer {}", (uintptr_t)PSURFACE.get(), (uintptr_t)PSURFACE->current.buffer->buffer.get());
- auto PBUFFER = PSURFACE->current.buffer->buffer.lock();
- bool SAMEBUFFER = PBUFFER == output->state->state().buffer;
+ auto PBUFFER = PSURFACE->current.buffer->buffer.lock();
+
+ if (PBUFFER == output->state->state().buffer) {
+ if (scanoutNeedsCursorUpdate) {
+ if (!state.test()) {
+ Debug::log(TRACE, "attemptDirectScanout: failed basic test");
+ return false;
+ }
+
+ if (!output->commit()) {
+ Debug::log(TRACE, "attemptDirectScanout: failed to commit cursor update");
+ lastScanout.reset();
+ return false;
+ }
+
+ scanoutNeedsCursorUpdate = false;
+ }
+
+ return true;
+ }
// FIXME: make sure the buffer actually follows the available scanout dmabuf formats
// and comes from the appropriate device. This may implode on multi-gpu!!
@@ -1370,8 +1388,7 @@ bool CMonitor::attemptDirectScanout() {
drmFormat = params.format;
}
- if (!SAMEBUFFER)
- output->state->setBuffer(PBUFFER);
+ output->state->setBuffer(PBUFFER);
output->state->setPresentationMode(tearingState.activelyTearing ? Aquamarine::eOutputPresentationMode::AQ_OUTPUT_PRESENTATION_IMMEDIATE :
Aquamarine::eOutputPresentationMode::AQ_OUTPUT_PRESENTATION_VSYNC);
@@ -1426,7 +1443,9 @@ bool CMonitor::attemptDirectScanout() {
Debug::log(LOG, "Entered a direct scanout to {:x}: \"{}\"", (uintptr_t)PCANDIDATE.get(), PCANDIDATE->m_szTitle);
}
- if (!PBUFFER->lockedByBackend || PBUFFER->hlEvents.backendRelease || SAMEBUFFER)
+ scanoutNeedsCursorUpdate = false;
+
+ if (!PBUFFER->lockedByBackend || PBUFFER->hlEvents.backendRelease)
return true;
// lock buffer while DRM/KMS is using it, then release it when page flip happens since DRM/KMS should be done by then