KWin
Loading...
Searching...
No Matches
drm_virtual_egl_layer.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: 2022 Xaver Hugl <xaver.hugl@gmail.com>
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8*/
9#pragma once
10#include "drm_layer.h"
11#include "utils/damagejournal.h"
12
13#include <QMap>
14#include <QPointer>
15#include <QRegion>
16#include <epoxy/egl.h>
17#include <optional>
18
19namespace KWin
20{
21
22class EglSwapchain;
23class EglSwapchainSlot;
24class GraphicsBuffer;
25class GLTexture;
26class EglGbmBackend;
27class DrmVirtualOutput;
28class GLRenderTimeQuery;
29class SurfaceInterface;
30
32{
33public:
36
37 std::optional<OutputLayerBeginFrameInfo> beginFrame() override;
38 bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) override;
39 bool scanout(SurfaceItem *surfaceItem) override;
40
41 QRegion currentDamage() const override;
42 std::shared_ptr<GLTexture> texture() const override;
43 void releaseBuffers() override;
44 std::chrono::nanoseconds queryRenderTime() const override;
45
46private:
47 std::shared_ptr<EglSwapchain> createGbmSwapchain() const;
48 bool doesGbmSwapchainFit(EglSwapchain *swapchain) const;
49
50 QPointer<SurfaceInterface> m_scanoutSurface;
51 QPointer<GraphicsBuffer> m_scanoutBuffer;
52 DamageJournal m_damageJournal;
53 DamageJournal m_oldDamageJournal;
54 QRegion m_currentDamage;
55 std::shared_ptr<EglSwapchain> m_gbmSwapchain;
56 std::shared_ptr<EglSwapchain> m_oldGbmSwapchain;
57 std::shared_ptr<EglSwapchainSlot> m_currentSlot;
58 std::unique_ptr<GLRenderTimeQuery> m_query;
59
60 DrmVirtualOutput *const m_output;
61 EglGbmBackend *const m_eglBackend;
62};
63
64}
OpenGL Backend using Egl on a GBM surface.
bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) override
QRegion currentDamage() const override
~VirtualEglGbmLayer() override
std::optional< OutputLayerBeginFrameInfo > beginFrame() override
std::shared_ptr< GLTexture > texture() const override
std::chrono::nanoseconds queryRenderTime() const override
bool scanout(SurfaceItem *surfaceItem) override
VirtualEglGbmLayer(EglGbmBackend *eglBackend, DrmVirtualOutput *output)