Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/drm/drm_object_plane.h
Show All 26 Lines | |||||
27 | namespace KWin | 27 | namespace KWin | ||
28 | { | 28 | { | ||
29 | 29 | | |||
30 | class DrmBuffer; | 30 | class DrmBuffer; | ||
31 | 31 | | |||
32 | class DrmPlane : public DrmObject | 32 | class DrmPlane : public DrmObject | ||
33 | { | 33 | { | ||
34 | public: | 34 | public: | ||
35 | DrmPlane(uint32_t plane_id, int fd); | 35 | DrmPlane(uint32_t plane_id, DrmBackend *backend); | ||
36 | 36 | | |||
37 | virtual ~DrmPlane(); | 37 | ~DrmPlane(); | ||
38 | 38 | | |||
39 | enum class PropertyIndex { | 39 | enum class PropertyIndex { | ||
40 | Type = 0, | 40 | Type = 0, | ||
41 | SrcX, | 41 | SrcX, | ||
42 | SrcY, | 42 | SrcY, | ||
43 | SrcW, | 43 | SrcW, | ||
44 | SrcH, | 44 | SrcH, | ||
45 | CrtcX, | 45 | CrtcX, | ||
46 | CrtcY, | 46 | CrtcY, | ||
47 | CrtcW, | 47 | CrtcW, | ||
48 | CrtcH, | 48 | CrtcH, | ||
49 | FbId, | 49 | FbId, | ||
50 | CrtcId, | 50 | CrtcId, | ||
51 | Count | 51 | Count | ||
52 | }; | 52 | }; | ||
53 | 53 | | |||
54 | enum class TypeIndex { | 54 | enum class TypeIndex { | ||
55 | Primary = 0, | 55 | Primary = 0, | ||
56 | Cursor, | 56 | Cursor, | ||
57 | Overlay, | 57 | Overlay, | ||
58 | Count | 58 | Count | ||
59 | }; | 59 | }; | ||
60 | 60 | | |||
61 | bool init(); | 61 | bool atomicInit(); | ||
62 | bool initProps(); | 62 | bool initProps(); | ||
63 | TypeIndex type(); | 63 | TypeIndex type(); | ||
64 | bool isCrtcSupported(uint32_t crtc); | | |||
65 | DrmObject::AtomicReturn atomicReqPlanePopulate(drmModeAtomicReq *req); | | |||
66 | 64 | | |||
67 | DrmBuffer *current(){ | 65 | bool isCrtcSupported(int resIndex) const { | ||
66 | return (m_possibleCrtcs & (1 << resIndex)); | ||||
67 | } | ||||
68 | QVector<uint32_t> formats() const { | ||||
69 | return m_formats; | ||||
70 | } | ||||
71 | | ||||
72 | DrmBuffer *current() const { | ||||
68 | return m_current; | 73 | return m_current; | ||
69 | } | 74 | } | ||
70 | DrmBuffer *next(){ | 75 | DrmBuffer *next() const { | ||
71 | return m_next; | 76 | return m_next; | ||
72 | } | 77 | } | ||
73 | void setCurrent(DrmBuffer *b){ | 78 | void setCurrent(DrmBuffer *b) { | ||
74 | m_current = b; | 79 | m_current = b; | ||
75 | } | 80 | } | ||
76 | void setNext(DrmBuffer *b){ | 81 | void setNext(DrmBuffer *b); | ||
77 | m_next = b; | | |||
78 | } | | |||
79 | 82 | | |||
80 | QVector<uint32_t> formats(){ | 83 | bool atomicPopulate(drmModeAtomicReq *req); | ||
81 | return m_formats; | 84 | void flipBuffer(); | ||
82 | } | 85 | void flipBufferWithDelete(); | ||
83 | void setFormats(uint32_t const *f, int fcount); | | |||
84 | | ||||
85 | void setPossibleCrtcs(uint32_t value){ | | |||
86 | m_possibleCrtcs = value; | | |||
87 | } | | |||
88 | uint32_t possibleCrtcs(){ | | |||
89 | return m_possibleCrtcs; | | |||
90 | } | | |||
91 | 86 | | |||
92 | private: | 87 | private: | ||
93 | DrmBuffer *m_current = nullptr; | 88 | DrmBuffer *m_current = nullptr; | ||
94 | DrmBuffer *m_next = nullptr; | 89 | DrmBuffer *m_next = nullptr; | ||
95 | 90 | | |||
96 | // TODO: See weston drm_output_check_plane_format for future use of these member variables | 91 | // TODO: See weston drm_output_check_plane_format for future use of these member variables | ||
97 | QVector<uint32_t> m_formats; // Possible formats, which can be presented on this plane | 92 | QVector<uint32_t> m_formats; // Possible formats, which can be presented on this plane | ||
98 | 93 | | |||
99 | // TODO: when using overlay planes in the future: restrict possible screens / crtcs of planes | 94 | // TODO: when using overlay planes in the future: restrict possible screens / crtcs of planes | ||
100 | uint32_t m_possibleCrtcs; | 95 | uint32_t m_possibleCrtcs; | ||
101 | }; | 96 | }; | ||
102 | 97 | | |||
103 | } | 98 | } | ||
104 | 99 | | |||
105 | #endif | 100 | #endif | ||
106 | 101 | |