Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/drm/drm_object_plane.h
Show All 14 Lines | |||||
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. | ||
16 | 16 | | |||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | #ifndef KWIN_DRM_OBJECT_PLANE_H | 20 | #ifndef KWIN_DRM_OBJECT_PLANE_H | ||
21 | #define KWIN_DRM_OBJECT_PLANE_H | 21 | #define KWIN_DRM_OBJECT_PLANE_H | ||
22 | 22 | | |||
23 | #include <QObject> | ||||
23 | #include "drm_object.h" | 24 | #include "drm_object.h" | ||
24 | // drm | 25 | // drm | ||
25 | #include <xf86drmMode.h> | 26 | #include <xf86drmMode.h> | ||
26 | 27 | | |||
27 | namespace KWin | 28 | namespace KWin | ||
28 | { | 29 | { | ||
29 | 30 | | |||
30 | class DrmBuffer; | 31 | class DrmBuffer; | ||
31 | 32 | | |||
32 | class DrmPlane : public DrmObject | 33 | class DrmPlane : public DrmObject | ||
33 | { | 34 | { | ||
35 | Q_GADGET | ||||
34 | public: | 36 | public: | ||
35 | DrmPlane(uint32_t plane_id, int fd); | 37 | DrmPlane(uint32_t plane_id, int fd); | ||
36 | 38 | | |||
37 | ~DrmPlane(); | 39 | ~DrmPlane(); | ||
38 | 40 | | |||
39 | enum class PropertyIndex { | 41 | enum class PropertyIndex { | ||
40 | Type = 0, | 42 | Type = 0, | ||
41 | SrcX, | 43 | SrcX, | ||
42 | SrcY, | 44 | SrcY, | ||
43 | SrcW, | 45 | SrcW, | ||
44 | SrcH, | 46 | SrcH, | ||
45 | CrtcX, | 47 | CrtcX, | ||
46 | CrtcY, | 48 | CrtcY, | ||
47 | CrtcW, | 49 | CrtcW, | ||
48 | CrtcH, | 50 | CrtcH, | ||
49 | FbId, | 51 | FbId, | ||
50 | CrtcId, | 52 | CrtcId, | ||
51 | Rotation, | 53 | Rotation, | ||
52 | Count | 54 | Count | ||
53 | }; | 55 | }; | ||
56 | Q_ENUM(PropertyIndex); | ||||
54 | 57 | | |||
55 | enum class TypeIndex { | 58 | enum class TypeIndex { | ||
56 | Primary = 0, | 59 | Primary = 0, | ||
57 | Cursor, | 60 | Cursor, | ||
58 | Overlay, | 61 | Overlay, | ||
59 | Count | 62 | Count | ||
60 | }; | 63 | }; | ||
64 | Q_ENUM(TypeIndex); | ||||
61 | 65 | | |||
62 | enum class Transformation { | 66 | enum class Transformation { | ||
63 | Rotate0 = 1 << 0, | 67 | Rotate0 = 1 << 0, | ||
64 | Rotate90 = 1 << 1, | 68 | Rotate90 = 1 << 1, | ||
65 | Rotate180 = 1 << 2, | 69 | Rotate180 = 1 << 2, | ||
66 | Rotate270 = 1 << 3, | 70 | Rotate270 = 1 << 3, | ||
67 | ReflectX = 1 << 4, | 71 | ReflectX = 1 << 4, | ||
68 | ReflectY = 1 << 5 | 72 | ReflectY = 1 << 5 | ||
69 | }; | 73 | }; | ||
70 | Q_DECLARE_FLAGS(Transformations, Transformation); | 74 | Q_DECLARE_FLAGS(Transformations, Transformation); | ||
75 | Q_ENUM(Transformation) | ||||
71 | 76 | | |||
72 | bool atomicInit(); | 77 | bool atomicInit(); | ||
73 | bool initProps(); | 78 | bool initProps(); | ||
74 | TypeIndex type(); | 79 | TypeIndex type(); | ||
75 | 80 | | |||
76 | bool isCrtcSupported(int resIndex) const { | 81 | bool isCrtcSupported(int resIndex) const { | ||
77 | return (m_possibleCrtcs & (1 << resIndex)); | 82 | return (m_possibleCrtcs & (1 << resIndex)); | ||
78 | } | 83 | } | ||
Show All 17 Lines | |||||
96 | bool atomicPopulate(drmModeAtomicReq *req); | 101 | bool atomicPopulate(drmModeAtomicReq *req); | ||
97 | void flipBuffer(); | 102 | void flipBuffer(); | ||
98 | void flipBufferWithDelete(); | 103 | void flipBufferWithDelete(); | ||
99 | 104 | | |||
100 | Transformations supportedTransformations() const { | 105 | Transformations supportedTransformations() const { | ||
101 | return m_supportedTransformations; | 106 | return m_supportedTransformations; | ||
102 | } | 107 | } | ||
103 | 108 | | |||
109 | void transformationsNotSupported(Transformations t) { | ||||
110 | m_supportedTransformations &= ~t; | ||||
111 | } | ||||
112 | | ||||
104 | private: | 113 | private: | ||
105 | DrmBuffer *m_current = nullptr; | 114 | DrmBuffer *m_current = nullptr; | ||
106 | DrmBuffer *m_next = nullptr; | 115 | DrmBuffer *m_next = nullptr; | ||
107 | 116 | | |||
108 | // TODO: See weston drm_output_check_plane_format for future use of these member variables | 117 | // TODO: See weston drm_output_check_plane_format for future use of these member variables | ||
109 | QVector<uint32_t> m_formats; // Possible formats, which can be presented on this plane | 118 | QVector<uint32_t> m_formats; // Possible formats, which can be presented on this plane | ||
110 | 119 | | |||
111 | // TODO: when using overlay planes in the future: restrict possible screens / crtcs of planes | 120 | // TODO: when using overlay planes in the future: restrict possible screens / crtcs of planes | ||
Show All 11 Lines |