KWin
Loading...
Searching...
No Matches
drm_egl_backend.h
Go to the documentation of this file.
1/*
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5 SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org>
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8*/
9#pragma once
10#include "drm_render_backend.h"
12
13#include "opengl/glutils.h"
14
15#include <QHash>
16#include <QPointer>
17#include <optional>
18
19namespace KWin
20{
21
22struct DmaBufAttributes;
23class Output;
24class DrmAbstractOutput;
25class DrmOutput;
26class DumbSwapchain;
27class DrmBackend;
28class DrmGpu;
29class EglGbmLayer;
30class DrmOutputLayer;
31class DrmPipeline;
32class EglContext;
33class EglDisplay;
34
39{
40 Q_OBJECT
41public:
42 EglGbmBackend(DrmBackend *drmBackend);
43 ~EglGbmBackend() override;
44
45 std::unique_ptr<SurfaceTexture> createSurfaceTextureWayland(SurfacePixmap *pixmap) override;
46
48
49 void present(Output *output, const std::shared_ptr<OutputFrame> &frame) override;
50 OutputLayer *primaryLayer(Output *output) override;
51 OutputLayer *cursorLayer(Output *output) override;
52
53 void init() override;
54 bool prefer10bpc() const override;
55 std::shared_ptr<DrmPipelineLayer> createPrimaryLayer(DrmPipeline *pipeline) override;
56 std::shared_ptr<DrmPipelineLayer> createCursorLayer(DrmPipeline *pipeline) override;
57 std::shared_ptr<DrmOutputLayer> createLayer(DrmVirtualOutput *output) override;
58
59 std::pair<std::shared_ptr<KWin::GLTexture>, ColorDescription> textureForOutput(Output *requestedOutput) const override;
60
61 DrmGpu *gpu() const;
62
64 std::shared_ptr<EglContext> contextForGpu(DrmGpu *gpu);
65
66private:
67 bool initializeEgl();
68 bool initRenderingContext();
69 EglDisplay *createEglDisplay(DrmGpu *gpu) const;
70
71 DrmBackend *m_backend;
72 std::map<EglDisplay *, std::weak_ptr<EglContext>> m_contexts;
73
74 friend class EglGbmTexture;
75};
76
77} // namespace
OpenGL Backend using Egl on a GBM surface.
EglGbmBackend(DrmBackend *drmBackend)
std::shared_ptr< DrmOutputLayer > createLayer(DrmVirtualOutput *output) override
EglDisplay * displayForGpu(DrmGpu *gpu)
std::pair< std::shared_ptr< KWin::GLTexture >, ColorDescription > textureForOutput(Output *requestedOutput) const override
OutputLayer * primaryLayer(Output *output) override
std::unique_ptr< SurfaceTexture > createSurfaceTextureWayland(SurfacePixmap *pixmap) override
bool prefer10bpc() const override
std::shared_ptr< DrmPipelineLayer > createPrimaryLayer(DrmPipeline *pipeline) override
std::shared_ptr< EglContext > contextForGpu(DrmGpu *gpu)
OutputLayer * cursorLayer(Output *output) override
GraphicsBufferAllocator * graphicsBufferAllocator() const override
std::shared_ptr< DrmPipelineLayer > createCursorLayer(DrmPipeline *pipeline) override
friend class EglGbmTexture
void present(Output *output, const std::shared_ptr< OutputFrame > &frame) override