Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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
29 EGLint widthDivisor = 1;
30 EGLint heightDivisor = 1;
31 EGLint planeIndex = 0;
32};
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);
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:
81
83 QSize size() const override;
84 QWaylandSurface::Origin origin() const override;
85 QOpenGLTexture *toOpenGlTexture(int plane) override;
86
87protected:
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
100QT_END_NAMESPACE
101
102#endif // LINUXDMABUFCLIENTBUFFERINTEGRATION_H
QtWayland::ClientBuffer * createBufferFor(wl_resource *resource) override
bool importBuffer(wl_resource *resource, LinuxDmabufWlBuffer *linuxDmabufBuffer)
void initializeHardware(struct ::wl_display *display) override
PFNGLEGLIMAGETARGETTEXTURE2DOESPROC gl_egl_image_target_texture_2d
QOpenGLTexture * toOpenGlTexture(int plane) override
QWaylandBufferRef::BufferFormatEgl bufferFormatEgl() const override
QWaylandSurface::Origin origin() const override
static const uint32_t MaxDmabufPlanes
EGLint EGLint EGLuint64KHR EGLBoolean EGLint * num_modifiers
QT_BEGIN_NAMESPACE typedef struct wl_resource EGLint attribute
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
struct YuvPlaneConversion plane[LinuxDmabufWlBuffer::MaxDmabufPlanes]