diff --git a/src/plugins/platforms/drm/egl_gbm_backend.cpp b/src/plugins/platforms/drm/egl_gbm_backend.cpp index 32bcb7dd74..4926d59800 100644 --- a/src/plugins/platforms/drm/egl_gbm_backend.cpp +++ b/src/plugins/platforms/drm/egl_gbm_backend.cpp @@ -584,7 +584,7 @@ bool EglGbmBackend::presentOnOutput(Output &output, const QRegion &damagedRegion output.buffer = QSharedPointer::create(m_gpu, output.directScanoutBuffer, output.bufferInterface); } else if (isPrimary()) { if (supportsSwapBuffersWithDamage()) { - QVector rects = regionToRects(output.damageHistory.constFirst(), output.output); + QVector rects = regionToRects(damagedRegion, output.output); if (!eglSwapBuffersWithDamageEXT(eglDisplay(), output.eglSurface, rects.data(), rects.count() / 4)) { qCCritical(KWIN_DRM, "eglSwapBuffersWithDamageEXT() failed: %x", eglGetError()); @@ -676,7 +676,8 @@ void EglGbmBackend::endFrame(int screenId, const QRegion &renderedRegion, renderFramebufferToSurface(output); - if (!presentOnOutput(output, damagedRegion)) { + const QRegion dirty = damagedRegion.intersected(output.output->geometry()); + if (!presentOnOutput(output, dirty)) { output.damageHistory.clear(); RenderLoopPrivate *renderLoopPrivate = RenderLoopPrivate::get(drmOutput->renderLoop()); renderLoopPrivate->notifyFrameFailed(); @@ -684,7 +685,6 @@ void EglGbmBackend::endFrame(int screenId, const QRegion &renderedRegion, } if (supportsBufferAge()) { - const QRegion dirty = damagedRegion.intersected(output.output->geometry()); if (output.damageHistory.count() > 10) { output.damageHistory.removeLast(); }