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
qwaylandeglclientbufferintegration.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
6
9
10#include <wayland-client-core.h>
11
12#include <QtCore/QDebug>
13#include <private/qeglconvenience_p.h>
14#include <private/qeglpbuffer_p.h>
15
16#ifndef EGL_EXT_platform_base
17typedef EGLDisplay (*PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
18#endif
19
20#ifndef EGL_PLATFORM_WAYLAND_KHR
21#define EGL_PLATFORM_WAYLAND_KHR 0x31D8
22#endif
23
24QT_BEGIN_NAMESPACE
25
26namespace QtWaylandClient {
27
29 0
30};
31
36
37
42
44{
45#if QT_CONFIG(egl_extension_platform_wayland)
47#else
48 if (q_hasEglExtension(EGL_NO_DISPLAY, "EGL_EXT_platform_base")) {
49 if (q_hasEglExtension(EGL_NO_DISPLAY, "EGL_KHR_platform_wayland") ||
50 q_hasEglExtension(EGL_NO_DISPLAY, "EGL_EXT_platform_wayland") ||
51 q_hasEglExtension(EGL_NO_DISPLAY, "EGL_MESA_platform_wayland")) {
52
56
58 } else {
59 qCWarning(lcQpaWayland) << "The EGL implementation does not support the Wayland platform";
60 return;
61 }
62 } else {
63 QByteArray eglPlatform = qgetenv("EGL_PLATFORM");
64 if (eglPlatform.isEmpty()) {
65 setenv("EGL_PLATFORM","wayland",true);
66 }
67
69 }
70#endif
71
73
75 qCWarning(lcQpaWayland) << "EGL not available";
76 return;
77 }
78
81 qCWarning(lcQpaWayland) << "Failed to initialize EGL display" << Qt::hex << eglGetError();
83 return;
84 }
85
87 if (qEnvironmentVariableIsSet("QT_OPENGL_NO_SANITY_CHECK"))
88 return;
89
91 for (int i = 0; qwaylandegl_threadedgl_blacklist_vendor[i]; ++i) {
93 m_supportsThreading = false;
94 break;
95 }
96 }
97}
98
103
108
113
119
124
129
134
136{
137 switch (resource) {
138 case EglDisplay:
139 return m_eglDisplay;
140 default:
141 break;
142 }
143 return nullptr;
144}
145
147{
149 switch (resource) {
150 case EglConfig:
151 return static_cast<QWaylandGLContext *>(context)->eglConfig();
152 case EglContext:
153 return static_cast<QWaylandGLContext *>(context)->eglContext();
154 case EglDisplay:
155 return m_eglDisplay;
156 default:
157 break;
158 }
159 return nullptr;
160}
161
166
167}
168
169QT_END_NAMESPACE
static const char * qwaylandegl_threadedgl_blacklist_vendor[]
EGLDisplay(*) PFNEGLGETPLATFORMDISPLAYEXTPROC(EGLenum platform, void *native_display, const EGLint *attrib_list)