Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
linuxdmabufclientbufferintegration.h
Go to the documentation of this file.
1// Copyright (C) 2018 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef LINUXDMABUFCLIENTBUFFERINTEGRATION_H
5#define LINUXDMABUFCLIENTBUFFERINTEGRATION_H
6
7#include "linuxdmabuf.h"
8
9#include <QtWaylandCompositor/private/qwlclientbufferintegration_p.h>
10#include <QtWaylandCompositor/private/qwlclientbuffer_p.h>
11#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
12#include <QtCore/QMutex>
13
14#include <drm_fourcc.h>
15
17
18typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYWAYLANDBUFFERWL_compat) (EGLDisplay dpy, struct wl_resource *buffer, EGLint attribute, EGLint *value);
19typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFFORMATSEXTPROC) (EGLDisplay dpy, EGLint max_formats, EGLint *formats, EGLint *num_formats);
20typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFMODIFIERSEXTPROC) (EGLDisplay dpy, EGLint format, EGLint max_modifiers, EGLuint64KHR *modifiers, EGLBoolean *external_only, EGLint *num_modifiers);
21
22class LinuxDmabufClientBufferIntegrationPrivate;
25
26// buffer conversion definitions to import YUV buffers
28 EGLint format = DRM_FORMAT_YUYV;
29 EGLint widthDivisor = 1;
30 EGLint heightDivisor = 1;
31 EGLint planeIndex = 0;
32};
34 uint32_t inputPlanes = 1;
35 uint32_t outputPlanes = 1;
37};
38
40{
41public:
44
45 void initializeHardware(struct ::wl_display *display) override;
46 QtWayland::ClientBuffer *createBufferFor(wl_resource *resource) override;
47 bool importBuffer(wl_resource *resource, LinuxDmabufWlBuffer *linuxDmabufBuffer);
48 void removeBuffer(wl_resource *resource);
49 void deleteImage(EGLImageKHR image);
50 PFNGLEGLIMAGETARGETTEXTURE2DOESPROC gl_egl_image_target_texture_2d = nullptr;
51
52private:
54
55 PFNEGLBINDWAYLANDDISPLAYWL egl_bind_wayland_display = nullptr;
56 PFNEGLUNBINDWAYLANDDISPLAYWL egl_unbind_wayland_display = nullptr;
57 PFNEGLCREATEIMAGEKHRPROC egl_create_image = nullptr;
58 PFNEGLDESTROYIMAGEKHRPROC egl_destroy_image = nullptr;
59 PFNEGLQUERYDMABUFMODIFIERSEXTPROC egl_query_dmabuf_modifiers_ext = nullptr;
60 PFNEGLQUERYDMABUFFORMATSEXTPROC egl_query_dmabuf_formats_ext = nullptr;
61
62 bool initSimpleTexture(LinuxDmabufWlBuffer *dmabufBuffer);
63 bool initYuvTexture(LinuxDmabufWlBuffer *dmabufBuffer);
64 QList<uint32_t> supportedDrmFormats();
65 QList<uint64_t> supportedDrmModifiers(uint32_t format);
66
67 EGLDisplay m_eglDisplay = EGL_NO_DISPLAY;
68 ::wl_display *m_wlDisplay = nullptr;
69 bool m_displayBound = false;
70
71 QHash<EGLint, YuvFormatConversion> m_yuvFormats;
72 bool m_supportsDmabufModifiers = false;
73 QHash<struct ::wl_resource *, LinuxDmabufWlBuffer *> m_importedBuffers;
74 QScopedPointer<LinuxDmabuf> m_linuxDmabuf;
75};
76
78{
79public:
80 ~LinuxDmabufClientBuffer() override;
81
82 QWaylandBufferRef::BufferFormatEgl bufferFormatEgl() const override;
83 QSize size() const override;
84 QWaylandSurface::Origin origin() const override;
85 QOpenGLTexture *toOpenGlTexture(int plane) override;
86
87protected:
88 void setDestroyed() override;
89
90private:
92 friend class LinuxDmabufClientBufferIntegrationPrivate;
93
94 LinuxDmabufClientBuffer(LinuxDmabufClientBufferIntegration* integration, wl_resource *bufferResource, LinuxDmabufWlBuffer *dmabufBuffer);
95
96 LinuxDmabufWlBuffer *d = nullptr;
97 LinuxDmabufClientBufferIntegration *m_integration = nullptr;
98};
99
101
102#endif // LINUXDMABUFCLIENTBUFFERINTEGRATION_H
\inmodule QtGui
\inmodule QtCore
Definition qsize.h:25
Origin
This enum type is used to specify the origin of a QWaylandSurface's buffer.
struct wl_display * display
Definition linuxdmabuf.h:41
EGLint EGLint EGLuint64KHR EGLBoolean EGLint * num_modifiers
QT_BEGIN_NAMESPACE typedef struct wl_resource EGLint attribute
QT_BEGIN_NAMESPACE typedef EGLBoolean(EGLAPIENTRYP PFNEGLQUERYWAYLANDBUFFERWL_compat)(EGLDisplay dpy
EGLint EGLint EGLuint64KHR EGLBoolean * external_only
EGLint EGLint max_modifiers
EGLint EGLint EGLint * num_formats
QT_BEGIN_NAMESPACE typedef struct wl_resource * buffer
QT_BEGIN_NAMESPACE typedef struct wl_resource EGLint EGLint * value
EGLint EGLint EGLuint64KHR * modifiers
EGLint EGLint * formats
Combined button and popup list for selecting options.
Definition image.cpp:4
typedef EGLDisplay(EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum platform
quint64 EGLuint64KHR
GLenum GLuint GLintptr GLsizeiptr size
[1]
struct YuvPlaneConversion plane[LinuxDmabufWlBuffer::MaxDmabufPlanes]