KWayland

linuxdmabuf_v1_interface.h
1 /*
2  SPDX-FileCopyrightText: 2019 Roman Gilg <[email protected]>
3  SPDX-FileCopyrightText: 2018 Fredrik Höglund <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
6 */
7 #ifndef WAYLAND_SERVER_LINUXDMABUF_INTERFACE_H
8 #define WAYLAND_SERVER_LINUXDMABUF_INTERFACE_H
9 
10 #include "global.h"
11 #include "resource.h"
12 
13 #include <KWayland/Server/kwaylandserver_export.h>
14 
15 #include <QHash>
16 #include <QSet>
17 #include <QSize>
18 
19 struct wl_buffer_interface;
20 
21 namespace KWayland
22 {
23 namespace Server
24 {
25 class BufferInterface;
26 
33 class KWAYLANDSERVER_EXPORT LinuxDmabufBuffer
34 {
35 public:
37  virtual ~LinuxDmabufBuffer() = default;
38 
42  uint32_t format() const;
46  QSize size() const;
47 
48 private:
49  class Private;
50  Private *d;
51 
52  friend class LinuxDmabufUnstableV1Buffer;
53 };
54 
55 class KWAYLANDSERVER_EXPORT LinuxDmabufUnstableV1Buffer : public LinuxDmabufBuffer
56 {
57 public:
61  LinuxDmabufUnstableV1Buffer(uint32_t format, const QSize &size);
62 
66  virtual ~LinuxDmabufUnstableV1Buffer() = default;
67 
68 private:
69  class Private;
70  Private *d;
71 };
72 
78 class KWAYLANDSERVER_EXPORT LinuxDmabufUnstableV1Interface : public Global
79 {
80  Q_OBJECT
81 public:
82  enum Flag {
83  YInverted = (1 << 0),
84  Interlaced = (1 << 1),
85  BottomFieldFirst = (1 << 2)
86  };
87 
88  Q_DECLARE_FLAGS(Flags, Flag)
89 
90 
93  struct Plane {
94  int fd;
95  uint32_t offset;
96  uint32_t stride;
97  uint64_t modifier;
98  };
99 
103  class Impl {
104  public:
105  Impl() = default;
106  virtual ~Impl() = default;
107 
122  virtual LinuxDmabufUnstableV1Buffer *importBuffer(const QVector<Plane> &planes,
123  uint32_t format,
124  const QSize &size,
125  Flags flags) = 0;
126  };
127 
132 
138  void setImpl(Impl *impl);
139 
140  void setSupportedFormatsWithModifiers(QHash<uint32_t, QSet<uint64_t> > set);
141 
145  static LinuxDmabufUnstableV1Interface *get(wl_resource *native);
146 
147 private:
151  explicit LinuxDmabufUnstableV1Interface(Display *display, QObject *parent = nullptr);
152 
156  static const struct wl_buffer_interface *bufferImplementation();
157 
158  friend class Display;
159  friend class BufferInterface;
160 
161  class Private;
162  Private *d_func() const;
163 };
164 
165 }
166 }
167 
169 Q_DECLARE_OPERATORS_FOR_FLAGS(KWayland::Server::LinuxDmabufUnstableV1Interface::Flags)
170 
171 #endif // WAYLAND_SERVER_LINUXDMABUF_INTERFACE_H
uint32_t stride
The offset from the start of buffer.
uint64_t modifier
The distance from the start of a row to the next row in bytes.
Represents the global zpw_linux_dmabuf_v1 interface.
Class holding the Wayland server display loop.
Definition: display.h:89
Reference counted representation of a Wayland buffer on Server side.
The Iface class provides an interface from the LinuxDmabufInterface into the compositor.
Base class for all Globals.
Definition: global.h:46
The base class for linux-dmabuf buffers.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Aug 11 2020 22:52:07 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.