backends/drm: merge all commits and try again if atomic commits fail

The failure might be from the commit reordering going wrong in some way.
The total accumulated state might still work even if an individual commit
does not though, so before considering the whole frame lost, merge all the
commits and try again
This commit is contained in:
Xaver Hugl 2024-01-30 18:05:54 +01:00
parent 9c0085f5a9
commit 6db05aaef1

View file

@ -59,6 +59,20 @@ DrmCommitThread::DrmCommitThread(const QString &name)
m_committed = std::move(commit);
m_commits.erase(m_commits.begin());
} else {
if (m_commits.size() > 1) {
// the failure may have been because of the reordering of commits
// -> collapse all commits into one and try again with an already tested state
while (m_commits.size() > 1) {
auto toMerge = std::move(m_commits[1]);
m_commits.erase(m_commits.begin() + 1);
m_commits.front()->merge(toMerge.get());
m_droppedCommits.push_back(std::move(toMerge));
}
if (commit->test()) {
// presentation didn't fail after all
continue;
}
}
const bool cursorOnly = std::all_of(m_commits.begin(), m_commits.end(), [](const auto &commit) {
return commit->isCursorOnly();
});