Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/drm/drm_backend.h
Show All 17 Lines | |||||
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_BACKEND_H | 20 | #ifndef KWIN_DRM_BACKEND_H | ||
21 | #define KWIN_DRM_BACKEND_H | 21 | #define KWIN_DRM_BACKEND_H | ||
22 | #include "platform.h" | 22 | #include "platform.h" | ||
23 | #include "input.h" | 23 | #include "input.h" | ||
24 | 24 | | |||
25 | #include "drm_buffer.h" | 25 | #include "drm_buffer.h" | ||
26 | #if HAVE_GBM | ||||
27 | #include "drm_buffer_gbm.h" | ||||
28 | #endif | ||||
26 | #include "drm_inputeventfilter.h" | 29 | #include "drm_inputeventfilter.h" | ||
27 | #include "drm_pointer.h" | 30 | #include "drm_pointer.h" | ||
28 | 31 | | |||
29 | #include <QElapsedTimer> | 32 | #include <QElapsedTimer> | ||
30 | #include <QImage> | 33 | #include <QImage> | ||
31 | #include <QPointer> | 34 | #include <QPointer> | ||
32 | #include <QSize> | 35 | #include <QSize> | ||
33 | #include <xf86drmMode.h> | 36 | #include <xf86drmMode.h> | ||
Show All 35 Lines | 70 | public: | |||
69 | virtual ~DrmBackend(); | 72 | virtual ~DrmBackend(); | ||
70 | 73 | | |||
71 | void configurationChangeRequested(KWayland::Server::OutputConfigurationInterface *config) override; | 74 | void configurationChangeRequested(KWayland::Server::OutputConfigurationInterface *config) override; | ||
72 | Screens *createScreens(QObject *parent = nullptr) override; | 75 | Screens *createScreens(QObject *parent = nullptr) override; | ||
73 | QPainterBackend *createQPainterBackend() override; | 76 | QPainterBackend *createQPainterBackend() override; | ||
74 | OpenGLBackend* createOpenGLBackend() override; | 77 | OpenGLBackend* createOpenGLBackend() override; | ||
75 | 78 | | |||
76 | void init() override; | 79 | void init() override; | ||
77 | DrmBuffer *createBuffer(const QSize &size); | 80 | DrmDumbBuffer *createBuffer(const QSize &size); | ||
78 | DrmBuffer *createBuffer(gbm_surface *surface); | 81 | DrmSurfaceBuffer *createBuffer(gbm_surface *surface); | ||
79 | void present(DrmBuffer *buffer, DrmOutput *output); | 82 | void present(DrmBuffer *buffer, DrmOutput *output); | ||
80 | 83 | | |||
81 | int fd() const { | 84 | int fd() const { | ||
82 | return m_fd; | 85 | return m_fd; | ||
83 | } | 86 | } | ||
84 | QVector<DrmOutput*> outputs() const { | 87 | QVector<DrmOutput*> outputs() const { | ||
85 | return m_outputs; | 88 | return m_outputs; | ||
86 | } | 89 | } | ||
87 | QVector<DrmBuffer*> buffers() const { | | |||
88 | return m_buffers; | | |||
89 | } | | |||
90 | QVector<DrmPlane*> planes() const { | 90 | QVector<DrmPlane*> planes() const { | ||
91 | return m_planes; | 91 | return m_planes; | ||
92 | } | 92 | } | ||
93 | void bufferDestroyed(DrmBuffer *b); | | |||
94 | 93 | | |||
95 | void outputWentOff(); | 94 | void outputWentOff(); | ||
96 | void checkOutputsAreOn(); | 95 | void checkOutputsAreOn(); | ||
97 | 96 | | |||
97 | // QPainter reuses buffers | ||||
98 | bool deleteBufferAfterPageFlip() const { | ||||
99 | return m_deleteBufferAfterPageFlip; | ||||
100 | } | ||||
98 | // returns use of AMS, default is not/legacy | 101 | // returns use of AMS, default is not/legacy | ||
99 | bool atomicModeSetting() const { | 102 | bool atomicModeSetting() const { | ||
100 | return m_atomicModeSetting; | 103 | return m_atomicModeSetting; | ||
101 | } | 104 | } | ||
102 | 105 | | |||
103 | void setGbmDevice(gbm_device *device) { | 106 | void setGbmDevice(gbm_device *device) { | ||
104 | m_gbmDevice = device; | 107 | m_gbmDevice = device; | ||
105 | } | 108 | } | ||
Show All 34 Lines | 125 | private: | |||
140 | int m_fd = -1; | 143 | int m_fd = -1; | ||
141 | int m_drmId = 0; | 144 | int m_drmId = 0; | ||
142 | // all crtcs | 145 | // all crtcs | ||
143 | QVector<DrmCrtc*> m_crtcs; | 146 | QVector<DrmCrtc*> m_crtcs; | ||
144 | // all connectors | 147 | // all connectors | ||
145 | QVector<DrmConnector*> m_connectors; | 148 | QVector<DrmConnector*> m_connectors; | ||
146 | // currently active output pipelines (planes + crtc + encoder + connector) | 149 | // currently active output pipelines (planes + crtc + encoder + connector) | ||
147 | QVector<DrmOutput*> m_outputs; | 150 | QVector<DrmOutput*> m_outputs; | ||
148 | DrmBuffer *m_cursor[2]; | 151 | DrmDumbBuffer *m_cursor[2]; | ||
152 | bool m_deleteBufferAfterPageFlip; | ||||
149 | bool m_atomicModeSetting = false; | 153 | bool m_atomicModeSetting = false; | ||
150 | bool m_cursorEnabled = false; | 154 | bool m_cursorEnabled = false; | ||
151 | int m_cursorIndex = 0; | 155 | int m_cursorIndex = 0; | ||
152 | int m_pageFlipsPending = 0; | 156 | int m_pageFlipsPending = 0; | ||
153 | bool m_active = false; | 157 | bool m_active = false; | ||
154 | QVector<DrmBuffer*> m_buffers; | | |||
155 | // all available planes: primarys, cursors and overlays | 158 | // all available planes: primarys, cursors and overlays | ||
156 | QVector<DrmPlane*> m_planes; | 159 | QVector<DrmPlane*> m_planes; | ||
157 | QScopedPointer<DpmsInputEventFilter> m_dpmsFilter; | 160 | QScopedPointer<DpmsInputEventFilter> m_dpmsFilter; | ||
158 | KWayland::Server::OutputManagementInterface *m_outputManagement = nullptr; | 161 | KWayland::Server::OutputManagementInterface *m_outputManagement = nullptr; | ||
159 | gbm_device *m_gbmDevice = nullptr; | 162 | gbm_device *m_gbmDevice = nullptr; | ||
160 | }; | 163 | }; | ||
161 | 164 | | |||
162 | 165 | | |||
163 | } | 166 | } | ||
164 | 167 | | |||
165 | #endif | 168 | #endif | ||
166 | 169 | |