2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2016-08-31 12:00:31 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2016 Roman Gilg <subdiff@gmail.com>
|
2016-08-31 12:00:31 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2019-12-11 16:50:07 +00:00
|
|
|
#pragma once
|
2016-08-31 12:00:31 +00:00
|
|
|
|
|
|
|
#include "drm_object.h"
|
2019-12-11 16:50:07 +00:00
|
|
|
|
2020-07-26 16:37:55 +00:00
|
|
|
#include <qobjectdefs.h>
|
2021-03-22 14:46:09 +00:00
|
|
|
#include <QSharedPointer>
|
2021-07-31 13:32:50 +00:00
|
|
|
#include <QMap>
|
2016-08-31 12:00:31 +00:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
class DrmBuffer;
|
2021-09-22 13:57:57 +00:00
|
|
|
class DrmCrtc;
|
2016-08-31 12:00:31 +00:00
|
|
|
|
|
|
|
class DrmPlane : public DrmObject
|
|
|
|
{
|
2020-07-26 16:37:55 +00:00
|
|
|
Q_GADGET
|
2016-08-31 12:00:31 +00:00
|
|
|
public:
|
2021-04-01 11:21:37 +00:00
|
|
|
DrmPlane(DrmGpu *gpu, uint32_t planeId);
|
2016-08-31 12:00:31 +00:00
|
|
|
|
2021-03-10 21:04:32 +00:00
|
|
|
enum class PropertyIndex : uint32_t {
|
2016-08-31 12:00:31 +00:00
|
|
|
Type = 0,
|
|
|
|
SrcX,
|
|
|
|
SrcY,
|
|
|
|
SrcW,
|
|
|
|
SrcH,
|
|
|
|
CrtcX,
|
|
|
|
CrtcY,
|
|
|
|
CrtcW,
|
|
|
|
CrtcH,
|
|
|
|
FbId,
|
|
|
|
CrtcId,
|
2017-10-31 17:08:36 +00:00
|
|
|
Rotation,
|
2021-07-31 13:32:50 +00:00
|
|
|
In_Formats,
|
2016-08-31 12:00:31 +00:00
|
|
|
Count
|
|
|
|
};
|
2020-07-26 16:37:55 +00:00
|
|
|
Q_ENUM(PropertyIndex)
|
2016-08-31 12:00:31 +00:00
|
|
|
|
2021-03-10 21:04:32 +00:00
|
|
|
enum class TypeIndex : uint32_t {
|
2019-12-11 17:16:13 +00:00
|
|
|
Overlay = 0,
|
|
|
|
Primary,
|
2016-08-31 12:00:31 +00:00
|
|
|
Cursor,
|
|
|
|
Count
|
|
|
|
};
|
2020-07-26 16:37:55 +00:00
|
|
|
Q_ENUM(TypeIndex)
|
2017-10-31 17:08:36 +00:00
|
|
|
|
2021-03-10 21:04:32 +00:00
|
|
|
enum class Transformation : uint32_t {
|
2019-12-11 16:50:07 +00:00
|
|
|
Rotate0 = 1 << 0,
|
|
|
|
Rotate90 = 1 << 1,
|
|
|
|
Rotate180 = 1 << 2,
|
|
|
|
Rotate270 = 1 << 3,
|
|
|
|
ReflectX = 1 << 4,
|
|
|
|
ReflectY = 1 << 5
|
2017-10-31 17:08:36 +00:00
|
|
|
};
|
2020-07-26 16:37:55 +00:00
|
|
|
Q_ENUM(Transformation)
|
2017-10-31 17:08:36 +00:00
|
|
|
Q_DECLARE_FLAGS(Transformations, Transformation);
|
|
|
|
|
2021-01-26 20:23:44 +00:00
|
|
|
bool init() override;
|
2021-09-22 11:26:19 +00:00
|
|
|
bool needsModeset() const override;
|
2021-10-08 09:22:02 +00:00
|
|
|
void disable() override;
|
2016-08-31 12:00:31 +00:00
|
|
|
TypeIndex type();
|
|
|
|
|
2021-09-22 11:26:19 +00:00
|
|
|
bool isCrtcSupported(int pipeIndex) const;
|
|
|
|
QMap<uint32_t, QVector<uint64_t>> formats() const;
|
2016-08-31 12:00:31 +00:00
|
|
|
|
2021-09-22 11:26:19 +00:00
|
|
|
QSharedPointer<DrmBuffer> current() const;
|
|
|
|
QSharedPointer<DrmBuffer> next() const;
|
|
|
|
void setCurrent(const QSharedPointer<DrmBuffer> &b);
|
|
|
|
void setNext(const QSharedPointer<DrmBuffer> &b);
|
2017-05-09 19:29:10 +00:00
|
|
|
void flipBuffer();
|
2016-08-31 12:00:31 +00:00
|
|
|
|
2021-05-25 22:05:17 +00:00
|
|
|
void setBuffer(DrmBuffer *buffer);
|
2021-09-22 11:26:19 +00:00
|
|
|
void set(const QPoint &srcPos, const QSize &srcSize, const QPoint &dstPos, const QSize &dstSize);
|
2021-05-25 22:05:17 +00:00
|
|
|
|
2021-09-22 11:26:19 +00:00
|
|
|
bool setTransformation(Transformations t);
|
|
|
|
Transformations transformation();
|
|
|
|
Transformations supportedTransformations() const;
|
2021-05-25 22:05:17 +00:00
|
|
|
|
2016-08-31 12:00:31 +00:00
|
|
|
private:
|
2021-03-22 14:46:09 +00:00
|
|
|
QSharedPointer<DrmBuffer> m_current;
|
|
|
|
QSharedPointer<DrmBuffer> m_next;
|
2016-08-31 12:00:31 +00:00
|
|
|
|
2021-07-31 13:32:50 +00:00
|
|
|
QMap<uint32_t, QVector<uint64_t>> m_supportedFormats;
|
2016-08-31 12:00:31 +00:00
|
|
|
uint32_t m_possibleCrtcs;
|
2017-11-03 17:35:13 +00:00
|
|
|
Transformations m_supportedTransformations = Transformation::Rotate0;
|
2016-08-31 12:00:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-10-31 17:08:36 +00:00
|
|
|
Q_DECLARE_OPERATORS_FOR_FLAGS(KWin::DrmPlane::Transformations)
|
|
|
|
|