From fb1a6ecd8d0303426f85625327f58bff3ece02bc Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 3 Jan 2023 12:59:17 +0200 Subject: [PATCH] backends/drm: Fix buffer centering with active hardware transform Prior to beb6cca65d9036eb47cd9209250c75ad0eeca8c8, the drm backend used to specify QRect(0, 0, modeSize.width(), modeSize.height()) CRTC rect, so we didn't have to care about buffer transforms, but now that we compute the CRTC rect from the buffer size, we have to take the buffer transform into account. It fixes squashed output contents when the output is rotated 90 or 270 degrees and it uses hardware transforms. --- src/backends/drm/drm_pipeline.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/backends/drm/drm_pipeline.cpp b/src/backends/drm/drm_pipeline.cpp index 62e5eae94d..a069abcfd7 100644 --- a/src/backends/drm/drm_pipeline.cpp +++ b/src/backends/drm/drm_pipeline.cpp @@ -207,6 +207,15 @@ DrmPipeline::Error DrmPipeline::commitPipelinesAtomic(const QVectorsetPending(DrmCrtc::PropertyIndex::VrrEnabled, m_pending.syncMode == RenderLoopPrivate::SyncMode::Adaptive || m_pending.syncMode == RenderLoopPrivate::SyncMode::AdaptiveAsync); m_pending.crtc->setPending(DrmCrtc::PropertyIndex::Gamma_LUT, m_pending.gamma ? m_pending.gamma->blobId() : 0); const auto fb = m_pending.layer->currentBuffer().get(); - m_pending.crtc->primaryPlane()->set(QPoint(0, 0), fb->buffer()->size(), centerBuffer(fb->buffer()->size(), m_pending.mode->size())); + m_pending.crtc->primaryPlane()->set(QPoint(0, 0), fb->buffer()->size(), centerBuffer(orientateSize(fb->buffer()->size(), m_pending.bufferOrientation), m_pending.mode->size())); m_pending.crtc->primaryPlane()->setBuffer(fb); if (m_pending.crtc->cursorPlane()) {