From ecc66a03d0535cdd94247b32341e6af89bd3a436 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Wed, 17 May 2023 17:31:55 +0200 Subject: [PATCH] backends/drm: force a modeset after tty switches with legacy We don't know what the current mode is, or if the display is even enabled or whatever. Always do a modeset to be sure everything is correct BUG: 469280 --- src/backends/drm/drm_gpu.cpp | 6 ++++++ src/backends/drm/drm_pipeline.h | 1 + src/backends/drm/drm_pipeline_legacy.cpp | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/src/backends/drm/drm_gpu.cpp b/src/backends/drm/drm_gpu.cpp index dac72f3d85..dbb3b7fed9 100644 --- a/src/backends/drm/drm_gpu.cpp +++ b/src/backends/drm/drm_gpu.cpp @@ -702,6 +702,12 @@ void DrmGpu::setActive(bool active) } // while the session was inactive, the output list may have changed m_platform->updateOutputs(); + for (const auto &output : std::as_const(m_drmOutputs)) { + // force a modeset with legacy, we can't reliably know if one is needed + if (!atomicModeSetting()) { + output->pipeline()->forceLegacyModeset(); + } + } } else { for (const auto &output : std::as_const(m_drmOutputs)) { output->renderLoop()->inhibit(); diff --git a/src/backends/drm/drm_pipeline.h b/src/backends/drm/drm_pipeline.h index c438d6523e..36645b88c4 100644 --- a/src/backends/drm/drm_pipeline.h +++ b/src/backends/drm/drm_pipeline.h @@ -72,6 +72,7 @@ public: Error present(); bool testScanout(); bool maybeModeset(); + void forceLegacyModeset(); bool needsModeset() const; void applyPendingChanges(); diff --git a/src/backends/drm/drm_pipeline_legacy.cpp b/src/backends/drm/drm_pipeline_legacy.cpp index c7b0776221..9925e63239 100644 --- a/src/backends/drm/drm_pipeline_legacy.cpp +++ b/src/backends/drm/drm_pipeline_legacy.cpp @@ -43,6 +43,11 @@ DrmPipeline::Error DrmPipeline::presentLegacy() return Error::None; } +void DrmPipeline::forceLegacyModeset() +{ + legacyModeset(); +} + DrmPipeline::Error DrmPipeline::legacyModeset() { uint32_t connId = m_connector->id();