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
5
8
9#include <wayland-client-core.h>
10
11#include <QtCore/QDebug>
12#include <private/qeglconvenience_p.h>
13#include <private/qeglpbuffer_p.h>
14
15#ifndef EGL_EXT_platform_base
16typedef EGLDisplay (*PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
17#endif
18
19#ifndef EGL_PLATFORM_WAYLAND_KHR
20#define EGL_PLATFORM_WAYLAND_KHR 0x31D8
21#endif
22
23QT_BEGIN_NAMESPACE
24
25namespace QtWaylandClient {
26
28 0
29};
30
35
36
41
43{
44#if QT_CONFIG(egl_extension_platform_wayland)
46#else
47 if (q_hasEglExtension(EGL_NO_DISPLAY, "EGL_EXT_platform_base")) {
48 if (q_hasEglExtension(EGL_NO_DISPLAY, "EGL_KHR_platform_wayland") ||
49 q_hasEglExtension(EGL_NO_DISPLAY, "EGL_EXT_platform_wayland") ||
50 q_hasEglExtension(EGL_NO_DISPLAY, "EGL_MESA_platform_wayland")) {
51
55
57 } else {
58 qCWarning(lcQpaWayland) << "The EGL implementation does not support the Wayland platform";
59 return;
60 }
61 } else {
62 QByteArray eglPlatform = qgetenv("EGL_PLATFORM");
63 if (eglPlatform.isEmpty()) {
64 setenv("EGL_PLATFORM","wayland",true);
65 }
66
68 }
69#endif
70
72
74 qCWarning(lcQpaWayland) << "EGL not available";
75 return;
76 }
77
80 qCWarning(lcQpaWayland) << "Failed to initialize EGL display" << Qt::hex << eglGetError();
82 return;
83 }
84
86 if (qEnvironmentVariableIsSet("QT_OPENGL_NO_SANITY_CHECK"))
87 return;
88
90 for (int i = 0; qwaylandegl_threadedgl_blacklist_vendor[i]; ++i) {
92 m_supportsThreading = false;
93 break;
94 }
95 }
96
97 // On desktop NVIDIA resizing QtQuick freezes them when using threaded rendering QTBUG-95817
98 // In order to support threaded rendering on embedded platforms where resizing is not needed
99 // we check if XDG_CURRENT_DESKTOP is set which desktop environments should set
100 if (qstrcmp(vendor, "NVIDIA") == 0 && qEnvironmentVariableIsSet("XDG_CURRENT_DESKTOP")) {
101 m_supportsThreading = false;
102 }
103}
104
109
114
116{
117 return true;
118}
119
124
132
137
142
144{
145 switch (resource) {
146 case EglDisplay:
147 return m_eglDisplay;
148 default:
149 break;
150 }
151 return nullptr;
152}
153
155{
157 switch (resource) {
158 case EglConfig:
159 return static_cast<QWaylandGLContext *>(context)->eglConfig();
160 case EglContext:
161 return static_cast<QWaylandGLContext *>(context)->eglContext();
162 case EglDisplay:
163 return m_eglDisplay;
164 default:
165 break;
166 }
167 return nullptr;
168}
169
174
175}
176
177QT_END_NAMESPACE
static const char * qwaylandegl_threadedgl_blacklist_vendor[]
EGLDisplay(* PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum platform, void *native_display, const EGLint *attrib_list)