Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/drm/drm_backend.h
Show All 24 Lines | |||||
25 | #include "drm_buffer.h" | 25 | #include "drm_buffer.h" | ||
26 | #include "drm_inputeventfilter.h" | 26 | #include "drm_inputeventfilter.h" | ||
27 | #include "drm_pointer.h" | 27 | #include "drm_pointer.h" | ||
28 | 28 | | |||
29 | #include <QElapsedTimer> | 29 | #include <QElapsedTimer> | ||
30 | #include <QImage> | 30 | #include <QImage> | ||
31 | #include <QPointer> | 31 | #include <QPointer> | ||
32 | #include <QSize> | 32 | #include <QSize> | ||
33 | #include <xf86drmMode.h> | 33 | #include <xf86drmMode.h> | ||
graesslin: nitpick: unrelated added empty line. | |||||
34 | 34 | | |||
35 | struct gbm_bo; | 35 | struct gbm_bo; | ||
36 | struct gbm_device; | 36 | struct gbm_device; | ||
37 | struct gbm_surface; | 37 | struct gbm_surface; | ||
38 | 38 | | |||
39 | namespace KWayland | 39 | namespace KWayland | ||
40 | { | 40 | { | ||
41 | namespace Server | 41 | namespace Server | ||
42 | { | 42 | { | ||
43 | class OutputInterface; | 43 | class OutputInterface; | ||
44 | class OutputDeviceInterface; | 44 | class OutputDeviceInterface; | ||
45 | class OutputChangeSet; | 45 | class OutputChangeSet; | ||
46 | class OutputManagementInterface; | 46 | class OutputManagementInterface; | ||
47 | } | 47 | } | ||
48 | } | 48 | } | ||
49 | 49 | | |||
50 | namespace KWin | 50 | namespace KWin | ||
51 | { | 51 | { | ||
52 | 52 | | |||
53 | class Udev; | 53 | class Udev; | ||
54 | class UdevMonitor; | 54 | class UdevMonitor; | ||
55 | 55 | | |||
56 | class DrmOutput; | 56 | class DrmOutput; | ||
57 | class DrmPlane; | ||||
57 | 58 | | |||
58 | 59 | | |||
59 | class KWIN_EXPORT DrmBackend : public Platform | 60 | class KWIN_EXPORT DrmBackend : public Platform | ||
60 | { | 61 | { | ||
61 | Q_OBJECT | 62 | Q_OBJECT | ||
62 | Q_INTERFACES(KWin::Platform) | 63 | Q_INTERFACES(KWin::Platform) | ||
63 | Q_PLUGIN_METADATA(IID "org.kde.kwin.Platform" FILE "drm.json") | 64 | Q_PLUGIN_METADATA(IID "org.kde.kwin.Platform" FILE "drm.json") | ||
64 | public: | 65 | public: | ||
Show All 9 Lines | |||||
74 | DrmBuffer *createBuffer(const QSize &size); | 75 | DrmBuffer *createBuffer(const QSize &size); | ||
75 | DrmBuffer *createBuffer(gbm_surface *surface); | 76 | DrmBuffer *createBuffer(gbm_surface *surface); | ||
76 | void present(DrmBuffer *buffer, DrmOutput *output); | 77 | void present(DrmBuffer *buffer, DrmOutput *output); | ||
77 | 78 | | |||
78 | QSize size() const; | 79 | QSize size() const; | ||
79 | int fd() const { | 80 | int fd() const { | ||
80 | return m_fd; | 81 | return m_fd; | ||
81 | } | 82 | } | ||
82 | QVector<DrmOutput*> outputs() const { | 83 | QVector<DrmOutput*> outputs() const { | ||
graesslin: nitpick: unrelated added empty line. | |||||
83 | return m_outputs; | 84 | return m_outputs; | ||
84 | } | 85 | } | ||
85 | QVector<DrmBuffer*> buffers() const { | 86 | QVector<DrmBuffer*> buffers() const { | ||
86 | return m_buffers; | 87 | return m_buffers; | ||
87 | } | 88 | } | ||
89 | QVector<DrmPlane*> planes() const { | ||||
90 | return m_planes; | ||||
91 | } | ||||
88 | void bufferDestroyed(DrmBuffer *b); | 92 | void bufferDestroyed(DrmBuffer *b); | ||
89 | 93 | | |||
90 | void outputWentOff(); | 94 | void outputWentOff(); | ||
91 | void checkOutputsAreOn(); | 95 | void checkOutputsAreOn(); | ||
92 | 96 | | |||
97 | // returns use of AMS, default is not/legacy | ||||
98 | bool atomicModeSetting() const { | ||||
99 | return m_atomicModeSetting; | ||||
100 | } | ||||
101 | | ||||
93 | void setGbmDevice(gbm_device *device) { | 102 | void setGbmDevice(gbm_device *device) { | ||
94 | m_gbmDevice = device; | 103 | m_gbmDevice = device; | ||
95 | } | 104 | } | ||
graesslin: nitpick: unrelated removed line | |||||
96 | gbm_device *gbmDevice() const { | 105 | gbm_device *gbmDevice() const { | ||
97 | return m_gbmDevice; | 106 | return m_gbmDevice; | ||
98 | } | 107 | } | ||
99 | 108 | | |||
100 | public Q_SLOTS: | 109 | public Q_SLOTS: | ||
101 | void turnOutputsOn(); | 110 | void turnOutputsOn(); | ||
102 | 111 | | |||
103 | | ||||
104 | Q_SIGNALS: | 112 | Q_SIGNALS: | ||
105 | void outputRemoved(KWin::DrmOutput *output); | 113 | void outputRemoved(KWin::DrmOutput *output); | ||
106 | void outputAdded(KWin::DrmOutput *output); | 114 | void outputAdded(KWin::DrmOutput *output); | ||
107 | 115 | | |||
108 | private: | 116 | private: | ||
109 | static void pageFlipHandler(int fd, unsigned int frame, unsigned int sec, unsigned int usec, void *data); | 117 | static void pageFlipHandler(int fd, unsigned int frame, unsigned int sec, unsigned int usec, void *data); | ||
110 | void openDrm(); | 118 | void openDrm(); | ||
111 | void activate(bool active); | 119 | void activate(bool active); | ||
Show All 13 Lines | |||||
125 | DrmOutput *findOutput(quint32 connector); | 133 | DrmOutput *findOutput(quint32 connector); | ||
126 | DrmOutput *findOutput(const QByteArray &uuid); | 134 | DrmOutput *findOutput(const QByteArray &uuid); | ||
127 | QScopedPointer<Udev> m_udev; | 135 | QScopedPointer<Udev> m_udev; | ||
128 | QScopedPointer<UdevMonitor> m_udevMonitor; | 136 | QScopedPointer<UdevMonitor> m_udevMonitor; | ||
129 | int m_fd = -1; | 137 | int m_fd = -1; | ||
130 | int m_drmId = 0; | 138 | int m_drmId = 0; | ||
131 | QVector<DrmOutput*> m_outputs; | 139 | QVector<DrmOutput*> m_outputs; | ||
132 | DrmBuffer *m_cursor[2]; | 140 | DrmBuffer *m_cursor[2]; | ||
141 | bool m_atomicModeSetting = false; | ||||
for better readability I would add the comment in a dedicated line above the variable graesslin: for better readability I would add the comment in a dedicated line above the variable | |||||
133 | bool m_cursorEnabled = false; | 142 | bool m_cursorEnabled = false; | ||
134 | int m_cursorIndex = 0; | 143 | int m_cursorIndex = 0; | ||
graesslin: nitpick: unrelated removed line | |||||
135 | int m_pageFlipsPending = 0; | 144 | int m_pageFlipsPending = 0; | ||
136 | bool m_active = false; | 145 | bool m_active = false; | ||
137 | QVector<DrmBuffer*> m_buffers; | 146 | QVector<DrmBuffer*> m_buffers; | ||
147 | // all available planes: primarys, cursors and overlays | ||||
148 | QVector<DrmPlane*> m_planes; | ||||
138 | QScopedPointer<DpmsInputEventFilter> m_dpmsFilter; | 149 | QScopedPointer<DpmsInputEventFilter> m_dpmsFilter; | ||
139 | KWayland::Server::OutputManagementInterface *m_outputManagement = nullptr; | 150 | KWayland::Server::OutputManagementInterface *m_outputManagement = nullptr; | ||
140 | gbm_device *m_gbmDevice = nullptr; | 151 | gbm_device *m_gbmDevice = nullptr; | ||
141 | }; | 152 | }; | ||
142 | 153 | | |||
143 | 154 | | |||
144 | } | 155 | } | ||
145 | 156 | | |||
146 | #endif | 157 | #endif | ||
147 | 158 | |
nitpick: unrelated added empty line.