Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qeglfskmsgbmwindow.cpp
Go to the documentation of this file.
1// Copyright (C) 2017 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
7
8#include <QtGui/private/qeglconvenience_p.h>
9
11
12#ifndef EGL_EXT_platform_base
13typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
14#endif
15
17{
18 QEglFSKmsGbmScreen *gbmScreen = static_cast<QEglFSKmsGbmScreen *>(screen());
19 EGLDisplay display = gbmScreen->display();
20 QSurfaceFormat platformFormat = m_integration->surfaceFormatFor(window()->requestedFormat());
23 // One fullscreen window per screen -> the native window is simply the gbm_surface the screen created.
24 m_window = reinterpret_cast<EGLNativeWindowType>(gbmScreen->createSurface(m_config));
25
26 PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC createPlatformWindowSurface = nullptr;
27 const char *extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
28 if (extensions && (strstr(extensions, "EGL_KHR_platform_gbm") || strstr(extensions, "EGL_MESA_platform_gbm"))) {
29 createPlatformWindowSurface = reinterpret_cast<PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC>(
30 eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT"));
31 }
32
33 if (createPlatformWindowSurface) {
34 QVector<EGLint> contextAttributes;
35#ifdef EGL_EXT_protected_content
36 if (platformFormat.testOption(QSurfaceFormat::ProtectedContent)) {
37 if (q_hasEglExtension(display, "EGL_EXT_protected_content")) {
38 contextAttributes.append(EGL_PROTECTED_CONTENT_EXT);
39 contextAttributes.append(EGL_TRUE);
40 qCDebug(qLcEglfsKmsDebug, "Enabled EGL_PROTECTED_CONTENT_EXT for eglCreatePlatformWindowSurfaceEXT");
41 } else {
43 }
44 }
45#endif
46 contextAttributes.append(EGL_NONE);
47
48 m_surface = createPlatformWindowSurface(display, m_config, reinterpret_cast<void *>(m_window), contextAttributes.constData());
49 } else {
50 qCDebug(qLcEglfsKmsDebug, "No eglCreatePlatformWindowSurface for GBM, falling back to eglCreateWindowSurface");
51 m_surface = eglCreateWindowSurface(display, m_config, m_window, nullptr);
52 }
53}
54
56{
57 QEglFSKmsGbmScreen *gbmScreen = static_cast<QEglFSKmsGbmScreen *>(screen());
59 gbmScreen->resetSurface();
60}
61
static EGLConfig chooseConfig(EGLDisplay display, const QSurfaceFormat &format)
void resetSurface() override
void invalidateSurface() override
Invalidates the window's surface by releasing its surface buffers.
QSurfaceFormat surfaceFormatFor(const QSurfaceFormat &inputFormat) const override
EGLSurface m_surface
EGLConfig m_config
void invalidateSurface() override
Invalidates the window's surface by releasing its surface buffers.
QSurfaceFormat m_format
EGLNativeWindowType m_window
QEglFSScreen * screen() const override
QWindow * window() const
Returns the window which belongs to the QPlatformWindow.
The QSurfaceFormat class represents the format of a QSurface. \inmodule QtGui.
void setOption(FormatOption option, bool on=true)
struct wl_display * display
Definition linuxdmabuf.h:41
Combined button and popup list for selecting options.
QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config, const QSurfaceFormat &referenceFormat)
bool q_hasEglExtension(EGLDisplay display, const char *extensionName)
QT_BEGIN_NAMESPACE typedef EGLConfig void const EGLint * attrib_list
QT_BEGIN_NAMESPACE typedef EGLSurface(EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)(EGLDisplay dpy
QT_BEGIN_NAMESPACE typedef EGLConfig config
QT_BEGIN_NAMESPACE typedef EGLConfig void * native_window
typedef EGLDisplay(EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum platform
#define qCDebug(category,...)