From bdf324871a7f1d924cf23e7311390db64aa6b99d Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 4 Mar 2024 17:53:23 +0100 Subject: [PATCH] drm: Fix having more than window over the screen's lifetime ...when not using atomic. On the non-atmic path the fb is passed in to drmModeSetCrtc. Here we need a new call to it if a new QWindow gets created after the previous one is destroyed. Previously this was not done, so it ended up with Device busy errors. Atomic does not need this since there the flip commit always contains framebufferPropertyId. Change-Id: Ie68152cad50438807ef45adfba65e74c8f30c956 Fixes: QTBUG-122663 Pick-to: 6.6 6.5 Reviewed-by: Andy Nichols (cherry picked from commit 818f8de64a2b1a7371ecb4bdd527b05343190582) Reviewed-by: Qt Cherry-pick Bot --- .../deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp | 8 +++++++- .../deviceintegration/eglfs_kms/qeglfskmsgbmscreen_p.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp index 336ee9c312f..073ba3bdccf 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp @@ -184,6 +184,11 @@ void QEglFSKmsGbmScreen::resetSurface() // still do its work, when called. Otherwise we end up // in device-is-busy errors if there is a new QWindow // created afterwards. (QTBUG-122663) + + // If not using atomic, will need a new drmModeSetCrtc if a new window + // gets created later on (and so there's a new fb). + if (!device()->hasAtomicSupport()) + needsNewModeSetForNextFb = true; } void QEglFSKmsGbmScreen::initCloning(QPlatformScreen *screenThisScreenClones, @@ -213,8 +218,9 @@ void QEglFSKmsGbmScreen::ensureModeSet(uint32_t fb) QKmsOutput &op(output()); const int fd = device()->fd(); - if (!op.mode_set) { + if (!op.mode_set || needsNewModeSetForNextFb) { op.mode_set = true; + needsNewModeSetForNextFb = false; bool doModeSet = true; drmModeCrtcPtr currentMode = drmModeGetCrtc(fd, op.crtc_id); diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen_p.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen_p.h index 3660f094d2b..aca34fcae21 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen_p.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen_p.h @@ -83,6 +83,8 @@ protected: bool cloneFlipPending = false; }; QList m_cloneDests; + + bool needsNewModeSetForNextFb = false; }; QT_END_NAMESPACE