[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
icc-effect-5.14.5
Martin Flöser 2017-10-31 18:08:36 +01:00
parent 48590783fa
commit 77b5c3caa9
2 changed files with 21 additions and 1 deletions

View File

@ -75,6 +75,7 @@ bool DrmPlane::initProps()
QByteArrayLiteral("CRTC_H"),
QByteArrayLiteral("FB_ID"),
QByteArrayLiteral("CRTC_ID"),
QByteArrayLiteral("rotation")
};
QVector<QByteArray> 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;

View File

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