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
14#ifndef EGL_EXT_platform_base
15typedef EGLDisplay (*PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
16#endif
17
18#ifndef EGL_PLATFORM_WAYLAND_KHR
19#define EGL_PLATFORM_WAYLAND_KHR 0x31D8
20#endif
21
22QT_BEGIN_NAMESPACE
23
24namespace QtWaylandClient {
25
27 0
28};
29
34
35
40
42{
43#if QT_CONFIG(egl_extension_platform_wayland)
45#else
46 if (q_hasEglExtension(EGL_NO_DISPLAY, "EGL_EXT_platform_base")) {
47 if (q_hasEglExtension(EGL_NO_DISPLAY, "EGL_KHR_platform_wayland") ||
48 q_hasEglExtension(EGL_NO_DISPLAY, "EGL_EXT_platform_wayland") ||
49 q_hasEglExtension(EGL_NO_DISPLAY, "EGL_MESA_platform_wayland")) {
50
54
56 } else {
57 qCWarning(lcQpaWayland) << "The EGL implementation does not support the Wayland platform";
58 return;
59 }
60 } else {
61 QByteArray eglPlatform = qgetenv("EGL_PLATFORM");
62 if (eglPlatform.isEmpty()) {
63 setenv("EGL_PLATFORM","wayland",true);
64 }
65
67 }
68#endif
69
71
73 qCWarning(lcQpaWayland) << "EGL not available";
74 return;
75 }
76
79 qCWarning(lcQpaWayland) << "Failed to initialize EGL display" << Qt::hex << eglGetError();
81 return;
82 }
83
85 if (qEnvironmentVariableIsSet("QT_OPENGL_NO_SANITY_CHECK"))
86 return;
87
89 for (int i = 0; qwaylandegl_threadedgl_blacklist_vendor[i]; ++i) {
91 m_supportsThreading = false;
92 break;
93 }
94 }
95
96 // On desktop NVIDIA resizing QtQuick freezes them when using threaded rendering QTBUG-95817
97 // In order to support threaded rendering on embedded platforms where resizing is not needed
98 // we check if XDG_CURRENT_DESKTOP is set which desktop environments should set
99 if (qstrcmp(vendor, "NVIDIA") == 0 && qEnvironmentVariableIsSet("XDG_CURRENT_DESKTOP")) {
100 m_supportsThreading = false;
101 }
102}
103
108
113
115{
116 return true;
117}
118
123
131
133{
134 switch (resource) {
135 case EglDisplay:
136 return m_eglDisplay;
137 default:
138 break;
139 }
140 return nullptr;
141}
142
144{
146 switch (resource) {
147 case EglConfig:
148 return static_cast<QWaylandGLContext *>(context)->eglConfig();
149 case EglContext:
150 return static_cast<QWaylandGLContext *>(context)->eglContext();
151 case EglDisplay:
152 return m_eglDisplay;
153 default:
154 break;
155 }
156 return nullptr;
157}
158
163
164}
165
166QT_END_NAMESPACE
static const char * qwaylandegl_threadedgl_blacklist_vendor[]
EGLDisplay(* PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum platform, void *native_display, const EGLint *attrib_list)