/* KWin - the KDE window manager This file is part of the KDE project. SPDX-FileCopyrightText: 2015 Martin Gräßlin SPDX-License-Identifier: GPL-2.0-or-later */ #pragma once #include "core/outputbackend.h" #include #include #include #include #include #include namespace KWin { class Session; class Udev; class UdevMonitor; class UdevDevice; class DrmAbstractOutput; class Cursor; class DrmGpu; class DrmVirtualOutput; class DrmRenderBackend; class KWIN_EXPORT DrmBackend : public OutputBackend { Q_OBJECT public: explicit DrmBackend(Session *session, QObject *parent = nullptr); ~DrmBackend() override; std::unique_ptr createInputBackend() override; std::unique_ptr createQPainterBackend() override; std::unique_ptr createOpenGLBackend() override; EglDisplay *sceneEglDisplayObject() const override; bool initialize() override; Outputs outputs() const override; Session *session() const override; QList supportedCompositors() const override; QString supportInformation() const override; Output *createVirtualOutput(const QString &name, const QSize &size, double scale) override; void removeVirtualOutput(Output *output) override; DrmGpu *primaryGpu() const; DrmGpu *findGpu(dev_t deviceId) const; size_t gpuCount() const; void setRenderBackend(DrmRenderBackend *backend); DrmRenderBackend *renderBackend() const; void createLayers(); void releaseBuffers(); void updateOutputs(); const std::vector> &gpus() const; Q_SIGNALS: void gpuAdded(DrmGpu *gpu); void gpuRemoved(DrmGpu *gpu); protected: bool applyOutputChanges(const OutputConfiguration &config) override; private: friend class DrmGpu; void addOutput(DrmAbstractOutput *output); void removeOutput(DrmAbstractOutput *output); void handleUdevEvent(); DrmGpu *addGpu(const QString &fileName); std::unique_ptr m_udev; std::unique_ptr m_udevMonitor; std::unique_ptr m_socketNotifier; Session *m_session; QList m_outputs; QList m_recentlyUnpluggedDpmsOffOutputs; const QStringList m_explicitGpus; std::vector> m_gpus; QList m_virtualOutputs; DrmRenderBackend *m_renderBackend = nullptr; }; }