From 77b5c3caa9534862a057ea76f26bd094aaaff56e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Fl=C3=B6ser?= Date: Tue, 31 Oct 2017 18:08:36 +0100 Subject: [PATCH] [platforms/drm] Add support for rotation property on the Plane Summary: A preparation step to support rotation of outputs. The idea is to rotate using DRM directly and not add it to the compositors. With this change and a small hack to try it, I was able to rotate the screen. Reviewers: #kwin, #plasma, subdiff Subscribers: plasma-devel, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D8582 --- plugins/platforms/drm/drm_object_plane.cpp | 6 ++++++ plugins/platforms/drm/drm_object_plane.h | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/plugins/platforms/drm/drm_object_plane.cpp b/plugins/platforms/drm/drm_object_plane.cpp index 8c899a5b0f..cd45f679b3 100644 --- a/plugins/platforms/drm/drm_object_plane.cpp +++ b/plugins/platforms/drm/drm_object_plane.cpp @@ -75,6 +75,7 @@ bool DrmPlane::initProps() QByteArrayLiteral("CRTC_H"), QByteArrayLiteral("FB_ID"), QByteArrayLiteral("CRTC_ID"), + QByteArrayLiteral("rotation") }; QVector typeNames = { @@ -119,6 +120,11 @@ void DrmPlane::setNext(DrmBuffer *b){ m_next = b; } +void DrmPlane::setTransformation(Transformations t) +{ + setValue(int(PropertyIndex::Rotation), int(t)); +} + bool DrmPlane::atomicPopulate(drmModeAtomicReq *req) { bool ret = true; diff --git a/plugins/platforms/drm/drm_object_plane.h b/plugins/platforms/drm/drm_object_plane.h index 280546204b..e8f404dafa 100644 --- a/plugins/platforms/drm/drm_object_plane.h +++ b/plugins/platforms/drm/drm_object_plane.h @@ -48,6 +48,7 @@ public: CrtcH, FbId, CrtcId, + Rotation, Count }; @@ -57,7 +58,17 @@ public: Overlay, Count }; - + + enum class Transformation { + Rotate0 = 1 << 0, + Rotate90 = 1 << 1, + Rotate180 = 1 << 2, + Rotate270 = 1 << 3, + ReflectX = 1 << 4, + ReflectY = 1 << 5 + }; + Q_DECLARE_FLAGS(Transformations, Transformation); + bool atomicInit(); bool initProps(); TypeIndex type(); @@ -79,6 +90,7 @@ public: m_current = b; } void setNext(DrmBuffer *b); + void setTransformation(Transformations t); bool atomicPopulate(drmModeAtomicReq *req); void flipBuffer(); @@ -97,5 +109,7 @@ private: } +Q_DECLARE_OPERATORS_FOR_FLAGS(KWin::DrmPlane::Transformations) + #endif