Changeset View
Changeset View
Standalone View
Standalone View
platformsupport/scenes/opengl/egl_dmabuf.h
- This file was moved from platformsupport/scenes/opengl/linux_dmabuf.h.
Show All 14 Lines | |||||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | GNU General Public License for more details. | 16 | GNU General Public License for more details. | ||
17 | 17 | | |||
18 | You should have received a copy of the GNU General Public License | 18 | You should have received a copy of the GNU General Public License | ||
19 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 19 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
20 | *********************************************************************/ | 20 | *********************************************************************/ | ||
21 | #pragma once | 21 | #pragma once | ||
22 | 22 | | |||
23 | #include "abstract_egl_backend.h" | 23 | #include "../../../linux_dmabuf.h" | ||
24 | 24 | | |||
25 | #include <KWayland/Server/linuxdmabuf_v1_interface.h> | 25 | #include "abstract_egl_backend.h" | ||
26 | 26 | | |||
27 | #include <QVector> | 27 | #include <QVector> | ||
28 | 28 | | |||
29 | namespace KWin | 29 | namespace KWin | ||
30 | { | 30 | { | ||
31 | class LinuxDmabuf; | 31 | class EglDmabuf; | ||
32 | 32 | | |||
33 | class DmabufBuffer : public KWayland::Server::LinuxDmabufUnstableV1Buffer | 33 | class EglDmabufBuffer : public DmabufBuffer | ||
34 | { | 34 | { | ||
35 | public: | 35 | public: | ||
36 | using Plane = KWayland::Server::LinuxDmabufUnstableV1Interface::Plane; | 36 | using Plane = KWayland::Server::LinuxDmabufUnstableV1Interface::Plane; | ||
37 | using Flags = KWayland::Server::LinuxDmabufUnstableV1Interface::Flags; | 37 | using Flags = KWayland::Server::LinuxDmabufUnstableV1Interface::Flags; | ||
38 | 38 | | |||
39 | enum class ImportType { | 39 | enum class ImportType { | ||
40 | Direct, | 40 | Direct, | ||
41 | Conversion | 41 | Conversion | ||
42 | }; | 42 | }; | ||
43 | 43 | | |||
44 | DmabufBuffer(EGLImage image, | 44 | EglDmabufBuffer(EGLImage image, | ||
45 | const QVector<Plane> &planes, | 45 | const QVector<Plane> &planes, | ||
46 | uint32_t format, | 46 | uint32_t format, | ||
47 | const QSize &size, | 47 | const QSize &size, | ||
48 | Flags flags, | 48 | Flags flags, | ||
49 | LinuxDmabuf *interfaceImpl); | 49 | EglDmabuf *interfaceImpl); | ||
50 | 50 | | |||
51 | DmabufBuffer(const QVector<Plane> &planes, | 51 | EglDmabufBuffer(const QVector<Plane> &planes, | ||
52 | uint32_t format, | 52 | uint32_t format, | ||
53 | const QSize &size, | 53 | const QSize &size, | ||
54 | Flags flags, | 54 | Flags flags, | ||
55 | LinuxDmabuf *interfaceImpl); | 55 | EglDmabuf *interfaceImpl); | ||
56 | 56 | | |||
57 | ~DmabufBuffer() override; | 57 | ~EglDmabufBuffer() override; | ||
58 | 58 | | |||
59 | void setInterfaceImplementation(EglDmabuf *interfaceImpl); | ||||
59 | void addImage(EGLImage image); | 60 | void addImage(EGLImage image); | ||
60 | void removeImages(); | 61 | void removeImages(); | ||
61 | 62 | | |||
62 | QVector<EGLImage> images() const { return m_images; } | 63 | QVector<EGLImage> images() const { return m_images; } | ||
63 | Flags flags() const { return m_flags; } | | |||
64 | const QVector<Plane> &planes() const { return m_planes; } | | |||
65 | 64 | | |||
66 | private: | 65 | private: | ||
67 | QVector<EGLImage> m_images; | 66 | QVector<EGLImage> m_images; | ||
68 | QVector<Plane> m_planes; | 67 | EglDmabuf *m_interfaceImpl; | ||
69 | Flags m_flags; | | |||
70 | LinuxDmabuf *m_interfaceImpl; | | |||
71 | ImportType m_importType; | 68 | ImportType m_importType; | ||
72 | }; | 69 | }; | ||
73 | 70 | | |||
74 | class LinuxDmabuf : public KWayland::Server::LinuxDmabufUnstableV1Interface::Impl | 71 | class EglDmabuf : public LinuxDmabuf | ||
75 | { | 72 | { | ||
76 | public: | 73 | public: | ||
77 | using Plane = KWayland::Server::LinuxDmabufUnstableV1Interface::Plane; | 74 | using Plane = KWayland::Server::LinuxDmabufUnstableV1Interface::Plane; | ||
78 | using Flags = KWayland::Server::LinuxDmabufUnstableV1Interface::Flags; | 75 | using Flags = KWayland::Server::LinuxDmabufUnstableV1Interface::Flags; | ||
79 | 76 | | |||
80 | static LinuxDmabuf* factory(AbstractEglBackend *backend); | 77 | static EglDmabuf* factory(AbstractEglBackend *backend); | ||
81 | 78 | | |||
82 | explicit LinuxDmabuf(AbstractEglBackend *backend); | 79 | explicit EglDmabuf(AbstractEglBackend *backend); | ||
83 | ~LinuxDmabuf(); | 80 | ~EglDmabuf(); | ||
84 | 81 | | |||
85 | KWayland::Server::LinuxDmabufUnstableV1Buffer *importBuffer(const QVector<Plane> &planes, | 82 | KWayland::Server::LinuxDmabufUnstableV1Buffer *importBuffer(const QVector<Plane> &planes, | ||
86 | uint32_t format, | 83 | uint32_t format, | ||
87 | const QSize &size, | 84 | const QSize &size, | ||
88 | Flags flags) override; | 85 | Flags flags) override; | ||
89 | 86 | | |||
90 | private: | 87 | private: | ||
91 | EGLImage createImage(const QVector<Plane> &planes, | 88 | EGLImage createImage(const QVector<Plane> &planes, | ||
92 | uint32_t format, | 89 | uint32_t format, | ||
93 | const QSize &size); | 90 | const QSize &size); | ||
94 | 91 | | |||
95 | | ||||
96 | KWayland::Server::LinuxDmabufUnstableV1Buffer *yuvImport(const QVector<Plane> &planes, | 92 | KWayland::Server::LinuxDmabufUnstableV1Buffer *yuvImport(const QVector<Plane> &planes, | ||
97 | uint32_t format, | 93 | uint32_t format, | ||
98 | const QSize &size, | 94 | const QSize &size, | ||
99 | Flags flags); | 95 | Flags flags); | ||
100 | 96 | | |||
101 | void removeBuffer(DmabufBuffer *buffer); | | |||
102 | void setSupportedFormatsAndModifiers(); | 97 | void setSupportedFormatsAndModifiers(); | ||
103 | 98 | | |||
104 | KWayland::Server::LinuxDmabufUnstableV1Interface *m_interface; | | |||
105 | QSet<DmabufBuffer*> m_buffers; | | |||
106 | AbstractEglBackend *m_backend; | 99 | AbstractEglBackend *m_backend; | ||
107 | 100 | | |||
108 | friend class DmabufBuffer; | 101 | friend class EglDmabufBuffer; | ||
109 | }; | 102 | }; | ||
110 | 103 | | |||
111 | } | 104 | } |