From 47306865a7560bf66167eff080e585b4f294c317 Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Sun, 1 Dec 2019 12:51:38 +0100 Subject: [PATCH] [platforms/drm] Refactor updateTransform Summary: Small intermediate refactor. For now just do the normal rotation when a flipped transform is requested. In the future we might want to provide the possibility to flip the output image. Test Plan: Compiles Reviewers: #kwin, zzag Reviewed By: #kwin, zzag Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D25649 --- plugins/platforms/drm/drm_output.cpp | 41 ++++++++++++---------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/plugins/platforms/drm/drm_output.cpp b/plugins/platforms/drm/drm_output.cpp index 78b5c68878..a2760d1ea3 100644 --- a/plugins/platforms/drm/drm_output.cpp +++ b/plugins/platforms/drm/drm_output.cpp @@ -651,41 +651,36 @@ bool DrmOutput::dpmsLegacyApply() void DrmOutput::updateTransform(Transform transform) { + DrmPlane::Transformation planeTransform; + + // TODO: Do we want to support reflections (flips)? + switch (transform) { case Transform::Normal: - if (m_primaryPlane) { - m_primaryPlane->setTransformation(DrmPlane::Transformation::Rotate0); - } - break; - case Transform::Rotated90: - if (m_primaryPlane) { - m_primaryPlane->setTransformation(DrmPlane::Transformation::Rotate90); - } - break; - case Transform::Rotated180: - if (m_primaryPlane) { - m_primaryPlane->setTransformation(DrmPlane::Transformation::Rotate180); - } - break; - case Transform::Rotated270: - if (m_primaryPlane) { - m_primaryPlane->setTransformation(DrmPlane::Transformation::Rotate270); - } - break; case Transform::Flipped: - // TODO: what is this exactly? + planeTransform = DrmPlane::Transformation::Rotate0; break; + case Transform::Rotated90: case Transform::Flipped90: - // TODO: what is this exactly? + planeTransform = DrmPlane::Transformation::Rotate90; break; + case Transform::Rotated180: case Transform::Flipped180: - // TODO: what is this exactly? + planeTransform = DrmPlane::Transformation::Rotate180; break; + case Transform::Rotated270: case Transform::Flipped270: - // TODO: what is this exactly? + planeTransform = DrmPlane::Transformation::Rotate270; break; + default: + Q_UNREACHABLE(); + } + + if (m_primaryPlane) { + m_primaryPlane->setTransformation(planeTransform); } m_modesetRequested = true; + // the cursor might need to get rotated updateCursor(); showCursor();