KWin
Loading...
Searching...
No Matches
eglswapchain.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: 2017 Martin Flöser <mgraesslin@kde.org>
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8*/
9#pragma once
10
11#include "kwin_export.h"
12
13#include <QList>
14#include <QSize>
15
16#include <cstdint>
17#include <epoxy/egl.h>
18#include <memory>
19
20namespace KWin
21{
22
23class GraphicsBufferAllocator;
24class GraphicsBuffer;
25class GLFramebuffer;
26class GLTexture;
27class EglContext;
28
29class KWIN_EXPORT EglSwapchainSlot
30{
31public:
32 EglSwapchainSlot(GraphicsBuffer *buffer, std::unique_ptr<GLFramebuffer> &&framebuffer, const std::shared_ptr<GLTexture> &texture);
34
35 GraphicsBuffer *buffer() const;
36 std::shared_ptr<GLTexture> texture() const;
37 GLFramebuffer *framebuffer() const;
38 int age() const;
39
40 static std::shared_ptr<EglSwapchainSlot> create(EglContext *context, GraphicsBuffer *buffer);
41
42private:
43 GraphicsBuffer *m_buffer;
44 std::unique_ptr<GLFramebuffer> m_framebuffer;
45 std::shared_ptr<GLTexture> m_texture;
46 int m_age = 0;
47 friend class EglSwapchain;
48};
49
50class KWIN_EXPORT EglSwapchain
51{
52public:
53 EglSwapchain(GraphicsBufferAllocator *allocator, EglContext *context, const QSize &size, uint32_t format, uint64_t modifier, const std::shared_ptr<EglSwapchainSlot> &seed);
55
56 QSize size() const;
57 uint32_t format() const;
58 uint64_t modifier() const;
59
60 std::shared_ptr<EglSwapchainSlot> acquire();
61 void release(std::shared_ptr<EglSwapchainSlot> slot);
62
63 static std::shared_ptr<EglSwapchain> create(GraphicsBufferAllocator *allocator, EglContext *context, const QSize &size, uint32_t format, const QList<uint64_t> &modifiers);
64
65private:
66 GraphicsBufferAllocator *m_allocator;
67 EglContext *m_context;
68 QSize m_size;
69 uint32_t m_format;
70 uint64_t m_modifier;
71 QList<std::shared_ptr<EglSwapchainSlot>> m_slots;
72};
73
74} // namespace KWin
OpenGL framebuffer object.
GLenum format
Definition gltexture.cpp:49