/* 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 "drm_plane.h" #include "drm_render_backend.h" #include "opengl/glutils.h" #include "platformsupport/scenes/opengl/abstract_egl_backend.h" #include #include #include namespace KWin { struct DmaBufAttributes; class Output; class DrmAbstractOutput; class DrmOutput; class DumbSwapchain; class DrmBackend; class DrmGpu; class EglGbmLayer; class DrmOutputLayer; class DrmPipeline; class EglContext; class EglDisplay; /** * @brief OpenGL Backend using Egl on a GBM surface. */ class EglGbmBackend : public AbstractEglBackend, public DrmRenderBackend { Q_OBJECT public: EglGbmBackend(DrmBackend *drmBackend); ~EglGbmBackend() override; std::unique_ptr createSurfaceTextureWayland(SurfacePixmap *pixmap) override; DrmDevice *drmDevice() const override; bool present(Output *output, const std::shared_ptr &frame) override; void repairPresentation(Output *output) override; OutputLayer *primaryLayer(Output *output) override; OutputLayer *cursorLayer(Output *output) override; void init() override; std::shared_ptr createDrmPlaneLayer(DrmPipeline *pipeline, DrmPlane::TypeIndex type) override; std::shared_ptr createLayer(DrmVirtualOutput *output) override; std::pair, ColorDescription> textureForOutput(Output *requestedOutput) const override; DrmGpu *gpu() const; EglDisplay *displayForGpu(DrmGpu *gpu); std::shared_ptr contextForGpu(DrmGpu *gpu); private: bool initializeEgl(); bool initRenderingContext(); EglDisplay *createEglDisplay(DrmGpu *gpu) const; DrmBackend *m_backend; std::map> m_contexts; friend class EglGbmTexture; }; } // namespace