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 <andy.nichols@qt.io>
(cherry picked from commit 818f8de64a2b1a7371ecb4bdd527b05343190582)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Laszlo Agocs 2024-03-04 17:53:23 +01:00 committed by Qt Cherry-pick Bot
parent e3b2386dd7
commit bdf324871a
2 changed files with 9 additions and 1 deletions

View File

@ -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);

View File

@ -83,6 +83,8 @@ protected:
bool cloneFlipPending = false;
};
QList<CloneDestination> m_cloneDests;
bool needsNewModeSetForNextFb = false;
};
QT_END_NAMESPACE