Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
drmeglserverbufferintegration.h
Go to the documentation of this file.
1
// Copyright (C) 2017 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
// Qt-Security score:critical reason:network-protocol
4
5
#
ifndef
DRMEGLSERVERBUFFERINTEGRATION_H
6
#
define
DRMEGLSERVERBUFFERINTEGRATION_H
7
8
#
include
<
QtCore
/
QVariant
>
9
#
include
<
QtWaylandCompositor
/
private
/
qwlserverbufferintegration_p
.
h
>
10
11
#
include
"qwayland-server-drm-egl-server-buffer.h"
12
13
#
include
<
QtGui
/
QWindow
>
14
#
include
<
QtGui
/
qpa
/
qplatformnativeinterface
.
h
>
15
#
include
<
QtGui
/
QGuiApplication
>
16
17
#
include
<
QtWaylandCompositor
/
qwaylandcompositor
.
h
>
18
#
include
<
QtWaylandCompositor
/
private
/
qwayland
-
server
-
server
-
buffer
-
extension
.
h
>
19
20
#
include
<
QtCore
/
QDebug
>
21
#
include
<
EGL
/
egl
.
h
>
22
#
include
<
EGL
/
eglext
.
h
>
23
24
#
ifndef
EGL_KHR_image
25
typedef
void
*EGLImageKHR;
26
typedef
EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer,
const
EGLint *attrib_list);
27
typedef
EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
28
#
endif
29
30
#
ifndef
GL_OES_EGL_image
31
typedef
void
(
GL_APIENTRYP
PFNGLEGLIMAGETARGETTEXTURE2DOESPROC
) (GLenum target,
GLeglImageOES
image
);
32
#
endif
33
#
ifndef
EGL_MESA_drm_image
34
typedef
EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy,
const
EGLint *attrib_list);
35
typedef
EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
36
#
endif
37
38
QT_BEGIN_NAMESPACE
39
40
class
DrmEglServerBufferIntegration;
41
class
QImage;
42
43
class
DrmEglServerBuffer
:
public
QtWayland
::
ServerBuffer
,
public
QtWaylandServer
::
qt_server_buffer
44
{
45
public
:
46
DrmEglServerBuffer
(
DrmEglServerBufferIntegration
*integration,
const
QImage &qimage, QtWayland::ServerBuffer::Format format);
47
48
struct
::
wl_resource
*
resourceForClient
(
struct
::wl_client *)
override
;
49
bool
bufferInUse
()
override
;
50
QOpenGLTexture
*
toOpenGlTexture
()
override
;
51
52
private
:
53
DrmEglServerBufferIntegration
*m_integration =
nullptr
;
54
55
EGLImageKHR m_image;
56
57
int32_t m_name;
58
int32_t m_stride;
59
QOpenGLTexture *m_texture =
nullptr
;
60
QtWaylandServer::qt_drm_egl_server_buffer::format m_drm_format;
61
};
62
63
class
DrmEglServerBufferIntegration
:
64
public
QtWayland
::
ServerBufferIntegration
,
65
public
QtWaylandServer
::
qt_drm_egl_server_buffer
66
{
67
public
:
68
DrmEglServerBufferIntegration
();
69
~
DrmEglServerBufferIntegration
()
override
;
70
71
bool
initializeHardware
(QWaylandCompositor *)
override
;
72
73
bool
supportsFormat
(QtWayland::ServerBuffer::Format format)
const
override
;
74
QtWayland
::
ServerBuffer
*
createServerBufferFromImage
(
const
QImage &qimage, QtWayland::ServerBuffer::Format format)
override
;
75
76
EGLDisplay
display
()
const
{
return
m_egl_display; }
77
78
inline
EGLImageKHR
eglCreateImageKHR
(EGLContext ctx, EGLenum target, EGLClientBuffer buffer,
const
EGLint *attrib_list);
79
inline
EGLBoolean
eglDestroyImageKHR
(EGLImageKHR image);
80
inline
EGLImageKHR
eglCreateDRMImageMESA
(
const
EGLint *attrib_list);
81
inline
EGLBoolean
eglExportDRMImageMESA
(EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
82
inline
void
glEGLImageTargetTexture2DOES
(GLenum target, GLeglImageOES image);
83
84
private
:
85
EGLDisplay m_egl_display = EGL_NO_DISPLAY;
86
PFNEGLCREATEDRMIMAGEMESAPROC m_egl_create_drm_image;
87
PFNEGLEXPORTDRMIMAGEMESAPROC m_egl_export_drm_image;
88
PFNGLEGLIMAGETARGETTEXTURE2DOESPROC m_gl_egl_image_target_texture_2d;
89
90
PFNEGLCREATEIMAGEKHRPROC m_egl_create_image;
91
PFNEGLDESTROYIMAGEKHRPROC m_egl_destroy_image;
92
};
93
94
EGLImageKHR
DrmEglServerBufferIntegration
::
eglCreateImageKHR
(EGLContext ctx, EGLenum target, EGLClientBuffer buffer,
const
EGLint *attrib_list)
95
{
96
if
(!m_egl_create_image) {
97
qWarning(
"DrmEglServerBufferIntegration: Trying to used unresolved function eglCreateImageKHR"
);
98
return
EGL_NO_IMAGE_KHR;
99
}
100
return
m_egl_create_image(m_egl_display, ctx, target, buffer,attrib_list);
101
}
102
103
EGLBoolean
DrmEglServerBufferIntegration
::
eglDestroyImageKHR
(EGLImageKHR image)
104
{
105
if
(!m_egl_destroy_image) {
106
qWarning(
"DrmEglServerBufferIntegration: Trying to use unresolved function eglDestroyImageKHR"
);
107
return
false
;
108
}
109
return
m_egl_destroy_image(m_egl_display, image);
110
}
111
112
EGLImageKHR
DrmEglServerBufferIntegration
::
eglCreateDRMImageMESA
(
const
EGLint *attrib_list)
113
{
114
if
(m_egl_create_drm_image)
115
return
m_egl_create_drm_image(m_egl_display, attrib_list);
116
else
117
qWarning(
"DrmEglServerBufferIntegration: Trying to use unresolved function eglCreateDRMImageMESA"
);
118
return
EGL_NO_IMAGE_KHR;
119
120
}
121
122
EGLBoolean
DrmEglServerBufferIntegration
::
eglExportDRMImageMESA
(EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride)
123
{
124
if
(m_egl_export_drm_image)
125
return
m_egl_export_drm_image(m_egl_display, image, name, handle, stride);
126
else
127
qWarning(
"DrmEglServerBufferIntegration: Trying to use unresolved function eglExportDRMImageMESA"
);
128
return
0;
129
}
130
131
void
DrmEglServerBufferIntegration
::
glEGLImageTargetTexture2DOES
(GLenum target, GLeglImageOES image)
132
{
133
if
(m_gl_egl_image_target_texture_2d)
134
return
m_gl_egl_image_target_texture_2d(target, image);
135
else
136
qWarning(
"DrmEglServerBufferIntegration: Trying to use unresolved function glEGLImageTargetTexture2DOES"
);
137
}
138
QT_END_NAMESPACE
139
140
#
endif
DrmEglServerBufferIntegration
Definition
drmeglserverbufferintegration.h:66
DrmEglServerBufferIntegration::supportsFormat
bool supportsFormat(QtWayland::ServerBuffer::Format format) const override
Definition
drmeglserverbufferintegration.cpp:146
DrmEglServerBufferIntegration::~DrmEglServerBufferIntegration
~DrmEglServerBufferIntegration() override
Definition
drmeglserverbufferintegration.cpp:98
DrmEglServerBufferIntegration::eglExportDRMImageMESA
EGLBoolean eglExportDRMImageMESA(EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride)
Definition
drmeglserverbufferintegration.h:122
DrmEglServerBufferIntegration::createServerBufferFromImage
QtWayland::ServerBuffer * createServerBufferFromImage(const QImage &qimage, QtWayland::ServerBuffer::Format format) override
Definition
drmeglserverbufferintegration.cpp:162
DrmEglServerBufferIntegration::glEGLImageTargetTexture2DOES
void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
Definition
drmeglserverbufferintegration.h:131
DrmEglServerBufferIntegration::display
EGLDisplay display() const
Definition
drmeglserverbufferintegration.h:76
DrmEglServerBufferIntegration::initializeHardware
bool initializeHardware(QWaylandCompositor *) override
Definition
drmeglserverbufferintegration.cpp:102
DrmEglServerBufferIntegration::eglCreateImageKHR
EGLImageKHR eglCreateImageKHR(EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list)
Definition
drmeglserverbufferintegration.h:94
DrmEglServerBufferIntegration::eglCreateDRMImageMESA
EGLImageKHR eglCreateDRMImageMESA(const EGLint *attrib_list)
Definition
drmeglserverbufferintegration.h:112
DrmEglServerBufferIntegration::eglDestroyImageKHR
EGLBoolean eglDestroyImageKHR(EGLImageKHR image)
Definition
drmeglserverbufferintegration.h:103
DrmEglServerBufferIntegration::DrmEglServerBufferIntegration
DrmEglServerBufferIntegration()
Definition
drmeglserverbufferintegration.cpp:94
DrmEglServerBuffer
Definition
drmeglserverbufferintegration.h:44
DrmEglServerBuffer::bufferInUse
bool bufferInUse() override
Definition
drmeglserverbufferintegration.cpp:89
DrmEglServerBuffer::toOpenGlTexture
QOpenGLTexture * toOpenGlTexture() override
Definition
drmeglserverbufferintegration.cpp:81
DrmEglServerBuffer::DrmEglServerBuffer
DrmEglServerBuffer(DrmEglServerBufferIntegration *integration, const QImage &qimage, QtWayland::ServerBuffer::Format format)
Definition
drmeglserverbufferintegration.cpp:12
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
image
GLeglImageOES image
Definition
drmeglserverbufferintegration.h:24
void
typedef void(GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)(GLenum target
qtwayland
src
hardwareintegration
compositor
drm-egl-server
drmeglserverbufferintegration.h
Generated on
for Qt by
1.18.0