backends/drm: prevent calling frameFailed multiple times per present

This commit is contained in:
Xaver Hugl 2022-04-08 17:37:48 +02:00
parent 972534eb3c
commit 52c1155b26
3 changed files with 11 additions and 7 deletions

View file

@ -320,14 +320,15 @@ bool DrmOutput::present()
setVrrPolicy(RenderLoop::VrrPolicy::Never);
}
}
if (m_pipeline->present()) {
bool modeset = gpu()->needsModeset();
if (modeset ? m_pipeline->maybeModeset() : m_pipeline->present()) {
Q_EMIT outputChange(m_pipeline->pending.layer->currentDamage());
return true;
} else {
} else if (!modeset) {
qCWarning(KWIN_DRM) << "Presentation failed!" << strerror(errno);
frameFailed();
return false;
}
return false;
}
int DrmOutput::gammaRampSize() const

View file

@ -61,10 +61,6 @@ bool DrmPipeline::testScanout()
bool DrmPipeline::present()
{
Q_ASSERT(pending.crtc);
if (gpu()->needsModeset()) {
m_modesetPresentPending = true;
return gpu()->maybeModeset();
}
if (gpu()->atomicModeSetting()) {
return commitPipelines({this}, CommitMode::Commit);
} else {
@ -79,6 +75,12 @@ bool DrmPipeline::present()
return true;
}
bool DrmPipeline::maybeModeset()
{
m_modesetPresentPending = true;
return gpu()->maybeModeset();
}
bool DrmPipeline::commitPipelines(const QVector<DrmPipeline *> &pipelines, CommitMode mode, const QVector<DrmObject *> &unusedObjects)
{
Q_ASSERT(!pipelines.isEmpty());

View file

@ -63,6 +63,7 @@ public:
*/
bool present();
bool testScanout();
bool maybeModeset();
bool needsModeset() const;
void applyPendingChanges();