Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/drm/drm_object_plane.h
Show All 11 Lines | |||||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
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 | #pragma once | ||
21 | #define KWIN_DRM_OBJECT_PLANE_H | | |||
22 | 21 | | |||
23 | #include "drm_object.h" | 22 | #include "drm_object.h" | ||
24 | // drm | 23 | | ||
25 | #include <xf86drmMode.h> | 24 | #include <xf86drmMode.h> | ||
26 | 25 | | |||
27 | namespace KWin | 26 | namespace KWin | ||
28 | { | 27 | { | ||
29 | 28 | | |||
30 | class DrmBuffer; | 29 | class DrmBuffer; | ||
31 | 30 | | |||
32 | class DrmPlane : public DrmObject | 31 | class DrmPlane : public DrmObject | ||
Show All 15 Lines | 38 | enum class PropertyIndex { | |||
48 | CrtcH, | 47 | CrtcH, | ||
49 | FbId, | 48 | FbId, | ||
50 | CrtcId, | 49 | CrtcId, | ||
51 | Rotation, | 50 | Rotation, | ||
52 | Count | 51 | Count | ||
53 | }; | 52 | }; | ||
54 | 53 | | |||
55 | enum class TypeIndex { | 54 | enum class TypeIndex { | ||
56 | Primary = 0, | 55 | Primary = 0, | ||
romangg: Note: this got switched so it matches how the kernel defines the enum. That's just cosmetics. | |||||
57 | Cursor, | 56 | Cursor, | ||
58 | Overlay, | 57 | Overlay, | ||
59 | Count | 58 | Count | ||
60 | }; | 59 | }; | ||
61 | 60 | | |||
62 | enum class Transformation { | 61 | enum class Transformation { | ||
63 | Rotate0 = 1 << 0, | 62 | Rotate0 = 1 << 0, | ||
64 | Rotate90 = 1 << 1, | 63 | Rotate90 = 1 << 1, | ||
65 | Rotate180 = 1 << 2, | 64 | Rotate180 = 1 << 2, | ||
66 | Rotate270 = 1 << 3, | 65 | Rotate270 = 1 << 3, | ||
67 | ReflectX = 1 << 4, | 66 | ReflectX = 1 << 4, | ||
68 | ReflectY = 1 << 5 | 67 | ReflectY = 1 << 5 | ||
69 | }; | 68 | }; | ||
70 | Q_DECLARE_FLAGS(Transformations, Transformation); | 69 | Q_DECLARE_FLAGS(Transformations, Transformation); | ||
71 | 70 | | |||
72 | bool atomicInit() override; | 71 | bool atomicInit() override; | ||
73 | bool initProps() override; | 72 | bool initProps() override; | ||
74 | TypeIndex type(); | 73 | TypeIndex type(); | ||
75 | 74 | | |||
76 | bool isCrtcSupported(int resIndex) const { | 75 | bool isCrtcSupported(int resIndex) const { | ||
Show All 11 Lines | |||||
88 | } | 87 | } | ||
89 | void setCurrent(DrmBuffer *b) { | 88 | void setCurrent(DrmBuffer *b) { | ||
90 | m_current = b; | 89 | m_current = b; | ||
91 | } | 90 | } | ||
92 | void setNext(DrmBuffer *b); | 91 | void setNext(DrmBuffer *b); | ||
93 | void setTransformation(Transformations t); | 92 | void setTransformation(Transformations t); | ||
94 | Transformations transformation(); | 93 | Transformations transformation(); | ||
95 | 94 | | |||
96 | bool atomicPopulate(drmModeAtomicReq *req) override; | | |||
97 | void flipBuffer(); | 95 | void flipBuffer(); | ||
98 | void flipBufferWithDelete(); | 96 | void flipBufferWithDelete(); | ||
99 | 97 | | |||
100 | Transformations supportedTransformations() const { | 98 | Transformations supportedTransformations() const { | ||
101 | return m_supportedTransformations; | 99 | return m_supportedTransformations; | ||
102 | } | 100 | } | ||
103 | 101 | | |||
102 | bool atomicPopulate(drmModeAtomicReq *req) const override; | ||||
103 | | ||||
104 | private: | 104 | private: | ||
105 | DrmBuffer *m_current = nullptr; | 105 | DrmBuffer *m_current = nullptr; | ||
106 | DrmBuffer *m_next = nullptr; | 106 | DrmBuffer *m_next = nullptr; | ||
107 | 107 | | |||
108 | // TODO: See weston drm_output_check_plane_format for future use of these member variables | 108 | // 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 | 109 | QVector<uint32_t> m_formats; // Possible formats, which can be presented on this plane | ||
110 | 110 | | |||
111 | // TODO: when using overlay planes in the future: restrict possible screens / crtcs of planes | 111 | // TODO: when using overlay planes in the future: restrict possible screens / crtcs of planes | ||
112 | uint32_t m_possibleCrtcs; | 112 | uint32_t m_possibleCrtcs; | ||
113 | 113 | | |||
114 | Transformations m_supportedTransformations = Transformation::Rotate0; | 114 | Transformations m_supportedTransformations = Transformation::Rotate0; | ||
115 | }; | 115 | }; | ||
116 | 116 | | |||
117 | } | 117 | } | ||
118 | 118 | | |||
119 | Q_DECLARE_OPERATORS_FOR_FLAGS(KWin::DrmPlane::Transformations) | 119 | Q_DECLARE_OPERATORS_FOR_FLAGS(KWin::DrmPlane::Transformations) | ||
120 | 120 | | |||
121 | #endif | | |||
122 | |
Note: this got switched so it matches how the kernel defines the enum. That's just cosmetics. It does not make a difference logic-wise since we map the enum at runtime anyway.