monitor: set format back after failing DS activation (#14168)

we do run m_lastScanout.reset(), but m_lastScanout might sometimes not
be set. cache format from before attempting DS, and set back to it on
activation failure.
This commit is contained in:
fazzi 2026-04-26 19:21:13 +01:00 committed by GitHub
parent d669ea7db2
commit 84d45bd13a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1991,7 +1991,8 @@ bool CMonitor::attemptDirectScanout() {
if (m_lastScanout.expired())
m_prevDrmFormat = m_drmFormat;
const bool NEEDS_TEST = !m_lastScanout || m_drmFormat != params.format; // do not retest while it's active
const auto PREV_FORMAT = m_drmFormat;
const bool NEEDS_TEST = !m_lastScanout || m_drmFormat != params.format; // do not retest while it's active
if (m_drmFormat != params.format) {
m_output->state->setFormat(params.format);
m_drmFormat = params.format;
@ -2004,6 +2005,10 @@ bool CMonitor::attemptDirectScanout() {
if (NEEDS_TEST && !m_state.test()) {
Log::logger->log(Log::TRACE, "attemptDirectScanout: failed basic test");
if (m_drmFormat != PREV_FORMAT) {
m_output->state->setFormat(PREV_FORMAT);
m_drmFormat = PREV_FORMAT;
}
return false;
}
@ -2029,6 +2034,10 @@ bool CMonitor::attemptDirectScanout() {
if (!ok) {
Log::logger->log(Log::TRACE, "attemptDirectScanout: failed to scanout surface");
if (m_drmFormat != PREV_FORMAT) {
m_output->state->setFormat(PREV_FORMAT);
m_drmFormat = PREV_FORMAT;
}
m_lastScanout.reset();
return false;
}