12#include "config-kwin.h"
20#include <drm_fourcc.h>
26 :
DrmObject(gpu, planeId, DRM_MODE_OBJECT_PLANE)
27 ,
type(this, QByteArrayLiteral(
"type"), {
28 QByteArrayLiteral(
"Overlay"),
29 QByteArrayLiteral(
"Primary"),
30 QByteArrayLiteral(
"Cursor"),
32 , srcX(
this, QByteArrayLiteral(
"SRC_X"))
33 , srcY(
this, QByteArrayLiteral(
"SRC_Y"))
34 , srcW(
this, QByteArrayLiteral(
"SRC_W"))
35 , srcH(
this, QByteArrayLiteral(
"SRC_H"))
36 , crtcX(
this, QByteArrayLiteral(
"CRTC_X"))
37 , crtcY(
this, QByteArrayLiteral(
"CRTC_Y"))
38 , crtcW(
this, QByteArrayLiteral(
"CRTC_W"))
39 , crtcH(
this, QByteArrayLiteral(
"CRTC_H"))
40 , fbId(
this, QByteArrayLiteral(
"FB_ID"))
41 , crtcId(
this, QByteArrayLiteral(
"CRTC_ID"))
42 , rotation(
this, QByteArrayLiteral(
"rotation"), {
43 QByteArrayLiteral(
"rotate-0"),
44 QByteArrayLiteral(
"rotate-90"),
45 QByteArrayLiteral(
"rotate-180"),
46 QByteArrayLiteral(
"rotate-270"),
47 QByteArrayLiteral(
"reflect-x"),
48 QByteArrayLiteral(
"reflect-y"),
50 , inFormats(
this, QByteArrayLiteral(
"IN_FORMATS"))
51 , alpha(
this, QByteArrayLiteral(
"alpha"))
52 , pixelBlendMode(
this, QByteArrayLiteral(
"pixel blend mode"), {
53 QByteArrayLiteral(
"None"),
54 QByteArrayLiteral(
"Pre-multiplied"),
55 QByteArrayLiteral(
"Coverage"),
57 , colorEncoding(
this, QByteArrayLiteral(
"COLOR_ENCODING"), {
58 QByteArrayLiteral(
"ITU-R BT.601 YCbCr"),
59 QByteArrayLiteral(
"ITU-R BT.709 YCbCr"),
60 QByteArrayLiteral(
"ITU-R BT.2020 YCbCr"),
62 , colorRange(
this, QByteArrayLiteral(
"COLOR_RANGE"), {
63 QByteArrayLiteral(
"YCbCr limited range"),
64 QByteArrayLiteral(
"YCbCr full range"),
66 , vmHotspotX(
this, QByteArrayLiteral(
"HOTSPOT_X"))
67 , vmHotspotY(
this, QByteArrayLiteral(
"HOTSPOT_Y"))
68 , inFenceFd(
this, QByteArrayLiteral(
"IN_FENCE_FD"))
76 qCWarning(KWIN_DRM) <<
"Failed to get kernel plane" <<
id();
106 m_possibleCrtcs = p->possible_crtcs;
109 m_supportedFormats.clear();
111 drmModeFormatModifierIterator iterator{};
113 m_supportedFormats[iterator.fmt].push_back(iterator.mod);
118 for (uint32_t i = 0; i < p->count_formats; i++) {
119 m_supportedFormats.insert(p->formats[i], modifiers);
121 if (m_supportedFormats.isEmpty()) {
122 qCWarning(KWIN_DRM) <<
"Driver doesn't advertise any formats for this plane. Falling back to XRGB8888 without explicit modifiers";
123 m_supportedFormats.insert(DRM_FORMAT_XRGB8888, modifiers);
145 return (m_possibleCrtcs & (1 << pipeIndex));
150 return m_supportedFormats;
172 m_current->releaseBuffer();
190#include "moc_drm_plane.cpp"
void addProperty(const DrmProperty &prop, uint64_t value)
void addBuffer(DrmPlane *plane, const std::shared_ptr< DrmFramebuffer > &buffer)
DrmPropertyList queryProperties() const
DrmEnumProperty< TypeIndex > type
DrmEnumProperty< Transformations > rotation
void setCurrentBuffer(const std::shared_ptr< DrmFramebuffer > &b)
void disable(DrmAtomicCommit *commit) override
DrmEnumProperty< ColorRange > colorRange
DrmEnumProperty< PixelBlendMode > pixelBlendMode
QMap< uint32_t, QList< uint64_t > > formats() const
std::shared_ptr< DrmFramebuffer > currentBuffer() const
bool updateProperties() override
DrmEnumProperty< ColorEncoding > colorEncoding
void set(DrmAtomicCommit *commit, const QPoint &srcPos, const QSize &srcSize, const QRect &dst)
DrmPlane(DrmGpu *gpu, uint32_t planeId)
void releaseCurrentBuffer()
bool isCrtcSupported(int pipeIndex) const
static int32_t transformationToDegrees(Transformations transformation)
void update(DrmPropertyList &propertyList)
drmModePropertyBlobRes * immutableBlob() const
drmModePlanePtr drmModeGetPlane(int fd, uint32_t plane_id)
std::unique_ptr< T, DrmDeleter< T > > DrmUniquePtr