Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/drm/drm_backend.h
Show All 36 Lines | |||||
37 | #include <xf86drmMode.h> | 37 | #include <xf86drmMode.h> | ||
38 | 38 | | |||
39 | #include <memory> | 39 | #include <memory> | ||
40 | 40 | | |||
41 | struct gbm_bo; | 41 | struct gbm_bo; | ||
42 | struct gbm_device; | 42 | struct gbm_device; | ||
43 | struct gbm_surface; | 43 | struct gbm_surface; | ||
44 | 44 | | |||
45 | namespace KWayland | | |||
46 | { | | |||
47 | namespace Server | | |||
48 | { | | |||
49 | class OutputInterface; | | |||
50 | class OutputDeviceInterface; | | |||
51 | class OutputChangeSet; | | |||
52 | class OutputManagementInterface; | | |||
53 | } | | |||
54 | } | | |||
55 | | ||||
56 | namespace KWin | 45 | namespace KWin | ||
57 | { | 46 | { | ||
58 | 47 | | |||
59 | class Udev; | 48 | class Udev; | ||
60 | class UdevMonitor; | 49 | class UdevMonitor; | ||
61 | 50 | | |||
62 | class DrmOutput; | 51 | class DrmOutput; | ||
63 | class DrmPlane; | 52 | class DrmPlane; | ||
64 | class DrmCrtc; | 53 | class DrmCrtc; | ||
65 | class DrmConnector; | 54 | class DrmConnector; | ||
66 | class GbmSurface; | 55 | class GbmSurface; | ||
67 | 56 | | |||
68 | 57 | | |||
69 | class KWIN_EXPORT DrmBackend : public Platform | 58 | class KWIN_EXPORT DrmBackend : public Platform | ||
70 | { | 59 | { | ||
71 | Q_OBJECT | 60 | Q_OBJECT | ||
72 | Q_INTERFACES(KWin::Platform) | 61 | Q_INTERFACES(KWin::Platform) | ||
73 | Q_PLUGIN_METADATA(IID "org.kde.kwin.Platform" FILE "drm.json") | 62 | Q_PLUGIN_METADATA(IID "org.kde.kwin.Platform" FILE "drm.json") | ||
74 | public: | 63 | public: | ||
75 | explicit DrmBackend(QObject *parent = nullptr); | 64 | explicit DrmBackend(QObject *parent = nullptr); | ||
76 | ~DrmBackend() override; | 65 | ~DrmBackend() override; | ||
77 | 66 | | |||
78 | void configurationChangeRequested(KWayland::Server::OutputConfigurationInterface *config) override; | | |||
79 | Screens *createScreens(QObject *parent = nullptr) override; | 67 | Screens *createScreens(QObject *parent = nullptr) override; | ||
80 | QPainterBackend *createQPainterBackend() override; | 68 | QPainterBackend *createQPainterBackend() override; | ||
81 | OpenGLBackend* createOpenGLBackend() override; | 69 | OpenGLBackend* createOpenGLBackend() override; | ||
82 | 70 | | |||
83 | void init() override; | 71 | void init() override; | ||
84 | void prepareShutdown() override; | 72 | void prepareShutdown() override; | ||
85 | 73 | | |||
86 | DrmDumbBuffer *createBuffer(const QSize &size); | 74 | DrmDumbBuffer *createBuffer(const QSize &size); | ||
Show All 9 Lines | 77 | #endif | |||
96 | Outputs enabledOutputs() const override; | 84 | Outputs enabledOutputs() const override; | ||
97 | QVector<DrmOutput*> drmOutputs() const { | 85 | QVector<DrmOutput*> drmOutputs() const { | ||
98 | return m_outputs; | 86 | return m_outputs; | ||
99 | } | 87 | } | ||
100 | QVector<DrmOutput*> drmEnabledOutputs() const { | 88 | QVector<DrmOutput*> drmEnabledOutputs() const { | ||
101 | return m_enabledOutputs; | 89 | return m_enabledOutputs; | ||
102 | } | 90 | } | ||
103 | 91 | | |||
92 | void enableOutput(AbstractOutput *output, bool enable) override; | ||||
93 | | ||||
104 | QVector<DrmPlane*> planes() const { | 94 | QVector<DrmPlane*> planes() const { | ||
105 | return m_planes; | 95 | return m_planes; | ||
106 | } | 96 | } | ||
107 | QVector<DrmPlane*> overlayPlanes() const { | 97 | QVector<DrmPlane*> overlayPlanes() const { | ||
108 | return m_overlayPlanes; | 98 | return m_overlayPlanes; | ||
109 | } | 99 | } | ||
110 | 100 | | |||
111 | void outputWentOff(); | 101 | void outputWentOff(); | ||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | 152 | private: | |||
170 | void updateCursor(); | 160 | void updateCursor(); | ||
171 | void moveCursor(); | 161 | void moveCursor(); | ||
172 | void initCursor(); | 162 | void initCursor(); | ||
173 | void outputDpmsChanged(); | 163 | void outputDpmsChanged(); | ||
174 | void readOutputsConfiguration(); | 164 | void readOutputsConfiguration(); | ||
175 | void writeOutputsConfiguration(); | 165 | void writeOutputsConfiguration(); | ||
176 | QByteArray generateOutputConfigurationUuid() const; | 166 | QByteArray generateOutputConfigurationUuid() const; | ||
177 | DrmOutput *findOutput(quint32 connector); | 167 | DrmOutput *findOutput(quint32 connector); | ||
178 | DrmOutput *findOutput(const QByteArray &uuid); | | |||
179 | QScopedPointer<Udev> m_udev; | 168 | QScopedPointer<Udev> m_udev; | ||
180 | QScopedPointer<UdevMonitor> m_udevMonitor; | 169 | QScopedPointer<UdevMonitor> m_udevMonitor; | ||
181 | int m_fd = -1; | 170 | int m_fd = -1; | ||
182 | int m_drmId = 0; | 171 | int m_drmId = 0; | ||
183 | // all crtcs | 172 | // all crtcs | ||
184 | QVector<DrmCrtc*> m_crtcs; | 173 | QVector<DrmCrtc*> m_crtcs; | ||
185 | // all connectors | 174 | // all connectors | ||
186 | QVector<DrmConnector*> m_connectors; | 175 | QVector<DrmConnector*> m_connectors; | ||
Show All 11 Lines | |||||
198 | QByteArray m_devNode; | 187 | QByteArray m_devNode; | ||
199 | #if HAVE_EGL_STREAMS | 188 | #if HAVE_EGL_STREAMS | ||
200 | bool m_useEglStreams = false; | 189 | bool m_useEglStreams = false; | ||
201 | #endif | 190 | #endif | ||
202 | // all available planes: primarys, cursors and overlays | 191 | // all available planes: primarys, cursors and overlays | ||
203 | QVector<DrmPlane*> m_planes; | 192 | QVector<DrmPlane*> m_planes; | ||
204 | QVector<DrmPlane*> m_overlayPlanes; | 193 | QVector<DrmPlane*> m_overlayPlanes; | ||
205 | QScopedPointer<DpmsInputEventFilter> m_dpmsFilter; | 194 | QScopedPointer<DpmsInputEventFilter> m_dpmsFilter; | ||
206 | KWayland::Server::OutputManagementInterface *m_outputManagement = nullptr; | | |||
207 | gbm_device *m_gbmDevice = nullptr; | 195 | gbm_device *m_gbmDevice = nullptr; | ||
208 | }; | 196 | }; | ||
209 | 197 | | |||
210 | 198 | | |||
211 | } | 199 | } | ||
212 | 200 | | |||
213 | #endif | 201 | #endif | ||
214 | 202 | |