KWin
Loading...
Searching...
No Matches
egldisplay.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: 2023 Xaver Hugl <xaver.hugl@gmail.com>
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8*/
9#pragma once
10
11#include "kwin_export.h"
12
13#include <QByteArray>
14#include <QHash>
15#include <QList>
16#include <QSize>
17#include <epoxy/egl.h>
18
19namespace KWin
20{
21
22struct DmaBufAttributes;
23class GLTexture;
24
25class KWIN_EXPORT EglDisplay
26{
27public:
29 {
30 QList<uint64_t> allModifiers;
31 QList<uint64_t> nonExternalOnlyModifiers;
32 QList<uint64_t> externalOnlyModifiers;
33 };
34
35 EglDisplay(::EGLDisplay display, const QList<QByteArray> &extensions, bool owning = true);
37
38 QList<QByteArray> extensions() const;
39 ::EGLDisplay handle() const;
40 bool hasExtension(const QByteArray &name) const;
41
42 QString renderNode() const;
43
44 bool supportsBufferAge() const;
45 bool supportsNativeFence() const;
46
47 QHash<uint32_t, QList<uint64_t>> nonExternalOnlySupportedDrmFormats() const;
48 QHash<uint32_t, DrmFormatInfo> allSupportedDrmFormats() const;
49 bool isExternalOnly(uint32_t format, uint64_t modifier) const;
50
51 EGLImageKHR importDmaBufAsImage(const DmaBufAttributes &dmabuf) const;
52 EGLImageKHR importDmaBufAsImage(const DmaBufAttributes &dmabuf, int plane, int format, const QSize &size) const;
53
54 static std::unique_ptr<EglDisplay> create(::EGLDisplay display, bool owning = true);
55
56private:
57 QHash<uint32_t, DrmFormatInfo> queryImportFormats() const;
58
59 const ::EGLDisplay m_handle;
60 const QList<QByteArray> m_extensions;
61 const bool m_owning;
62
63 const bool m_supportsBufferAge;
64 const bool m_supportsNativeFence;
65 const QHash<uint32_t, DrmFormatInfo> m_importFormats;
66};
67
68}
void * EGLImageKHR
QList< uint64_t > allModifiers
Definition egldisplay.h:30
QList< uint64_t > nonExternalOnlyModifiers
Definition egldisplay.h:31
QList< uint64_t > externalOnlyModifiers
Definition egldisplay.h:32