KWin
Loading...
Searching...
No Matches
x11_windowed_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
11#include "core/outputlayer.h"
12#include "opengl/glutils.h"
14
15namespace KWin
16{
17
18class EglSwapchainSlot;
19class EglSwapchain;
20class GraphicsBufferAllocator;
21class X11WindowedBackend;
22class X11WindowedOutput;
23class X11WindowedEglBackend;
24class GLRenderTimeQuery;
25
27{
28public:
31
32 std::optional<OutputLayerBeginFrameInfo> beginFrame() override;
33 bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) override;
34 std::chrono::nanoseconds queryRenderTime() const override;
35
36 std::shared_ptr<GLTexture> texture() const;
37 void present();
38
39private:
40 std::shared_ptr<EglSwapchain> m_swapchain;
41 std::shared_ptr<EglSwapchainSlot> m_buffer;
42 std::unique_ptr<GLRenderTimeQuery> m_query;
43 X11WindowedOutput *const m_output;
44 X11WindowedEglBackend *const m_backend;
45};
46
48{
49 Q_OBJECT
50
51public:
54
55 std::optional<OutputLayerBeginFrameInfo> beginFrame() override;
56 bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) override;
57 std::chrono::nanoseconds queryRenderTime() const override;
58
59private:
60 X11WindowedOutput *const m_output;
61 X11WindowedEglBackend *const m_backend;
62 std::unique_ptr<GLFramebuffer> m_framebuffer;
63 std::unique_ptr<GLTexture> m_texture;
64 std::unique_ptr<GLRenderTimeQuery> m_query;
65};
66
71{
72 Q_OBJECT
73
74public:
76 ~X11WindowedEglBackend() override;
77
80
81 std::unique_ptr<SurfaceTexture> createSurfaceTextureWayland(SurfacePixmap *pixmap) override;
82 std::pair<std::shared_ptr<GLTexture>, ColorDescription> textureForOutput(Output *output) const override;
83 void init() override;
84 void endFrame(Output *output, const QRegion &renderedRegion, const QRegion &damagedRegion);
85 void present(Output *output, const std::shared_ptr<OutputFrame> &frame) override;
86 OutputLayer *primaryLayer(Output *output) override;
87 OutputLayer *cursorLayer(Output *output) override;
88
89protected:
90 void cleanupSurfaces() override;
91
92private:
93 bool initializeEgl();
94 bool initRenderingContext();
95
96 struct Layers
97 {
98 std::unique_ptr<X11WindowedEglPrimaryLayer> primaryLayer;
99 std::unique_ptr<X11WindowedEglCursorLayer> cursorLayer;
100 };
101
102 std::unique_ptr<GraphicsBufferAllocator> m_allocator;
103 std::map<Output *, Layers> m_outputs;
104 X11WindowedBackend *m_backend;
105};
106
107} // namespace KWin
OpenGL Backend using Egl windowing system over an X overlay window.
OutputLayer * primaryLayer(Output *output) override
std::pair< std::shared_ptr< GLTexture >, ColorDescription > textureForOutput(Output *output) const override
std::unique_ptr< SurfaceTexture > createSurfaceTextureWayland(SurfacePixmap *pixmap) override
void endFrame(Output *output, const QRegion &renderedRegion, const QRegion &damagedRegion)
OutputLayer * cursorLayer(Output *output) override
X11WindowedBackend * backend() const
GraphicsBufferAllocator * graphicsBufferAllocator() const override
X11WindowedEglBackend(X11WindowedBackend *backend)
void present(Output *output, const std::shared_ptr< OutputFrame > &frame) override
X11WindowedEglCursorLayer(X11WindowedEglBackend *backend, X11WindowedOutput *output)
std::chrono::nanoseconds queryRenderTime() const override
bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) override
std::optional< OutputLayerBeginFrameInfo > beginFrame() override
std::optional< OutputLayerBeginFrameInfo > beginFrame() override
std::chrono::nanoseconds queryRenderTime() const override
X11WindowedEglPrimaryLayer(X11WindowedEglBackend *backend, X11WindowedOutput *output)
bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) override
std::shared_ptr< GLTexture > texture() const