45 #include "private/qeglfswindow_p.h"
47 #include <QtDeviceDiscoverySupport/private/qdevicediscovery_p.h>
48 #include <QtGui/private/qeglconvenience_p.h>
49 #include <QtCore/QLoggingCategory>
50 #include <QtCore/QJsonDocument>
51 #include <QtCore/QJsonObject>
52 #include <QtCore/QJsonArray>
53 #include <QtGui/qpa/qplatformwindow.h>
54 #include <QtGui/QScreen>
57 #include <xf86drmMode.h>
64 qCDebug(qLcEglfsKmsDebug,
"New DRM/KMS via Vsp2 integration created");
67 #ifndef EGL_EXT_platform_base
72 #ifndef EGL_PLATFORM_GBM_KHR
73 #define EGL_PLATFORM_GBM_KHR 0x31D7
78 qCDebug(qLcEglfsKmsDebug,
"Querying EGLDisplay");
81 PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplay =
nullptr;
82 const char *extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
83 if (extensions && (strstr(extensions,
"EGL_KHR_platform_gbm") || strstr(extensions,
"EGL_MESA_platform_gbm"))) {
84 getPlatformDisplay =
reinterpret_cast<PFNEGLGETPLATFORMDISPLAYEXTPROC
>(
85 eglGetProcAddress(
"eglGetPlatformDisplayEXT"));
88 if (getPlatformDisplay) {
91 qCDebug(qLcEglfsKmsDebug,
"No eglGetPlatformDisplay for GBM, falling back to eglGetDisplay");
92 display = eglGetDisplay(nativeDisplay);
106 GBM_BO_USE_RENDERING);
108 return reinterpret_cast<EGLNativeWindowType
>(surface);
113 gbm_surface *surface =
reinterpret_cast<gbm_surface *
>(
window);
115 gbm_surface_destroy(surface);
128 if (!
path.isEmpty()) {
129 qCDebug(qLcEglfsKmsDebug) <<
"VSP2: Using DRM device" <<
path <<
"specified in config file";
133 qCDebug(qLcEglfsKmsDebug) <<
"Found the following video devices:" <<
devices;
137 qFatal(
"Could not find DRM device!");
169 m_window =
reinterpret_cast<EGLNativeWindowType
>(vsp2Screen->createSurface());
171 PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC createPlatformWindowSurface =
nullptr;
172 const char *extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
173 if (extensions && (strstr(extensions,
"EGL_KHR_platform_gbm") || strstr(extensions,
"EGL_MESA_platform_gbm"))) {
174 createPlatformWindowSurface =
reinterpret_cast<PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC
>(
175 eglGetProcAddress(
"eglCreatePlatformWindowSurfaceEXT"));
178 if (createPlatformWindowSurface) {
181 qCDebug(qLcEglfsKmsDebug,
"No eglCreatePlatformWindowSurface for GBM, falling back to eglCreateWindowSurface");
190 vsp2Screen->resetSurface();
static QDeviceDiscovery * create(QDeviceTypes type, QObject *parent=nullptr)
static EGLConfig chooseConfig(EGLDisplay display, const QSurfaceFormat &format)
QEglFSWindow * createWindow(QWindow *window) const override
QKmsDevice * createDevice() override
void presentBuffer(QPlatformSurface *surface) override
void destroyNativeWindow(EGLNativeWindowType window) override
EGLNativeWindowType createNativeOffscreenWindow(const QSurfaceFormat &format) override
EGLDisplay createDisplay(EGLNativeDisplayType nativeDisplay) override
QEglFSKmsVsp2Integration()
void resetSurface() override
const QEglFSKmsVsp2Integration * m_integration
QEglFSKmsVsp2Window(QWindow *w, const QEglFSKmsVsp2Integration *integration)
void invalidateSurface() override
void invalidateSurface() override
EGLNativeWindowType m_window
QEglFSScreen * screen() const override
The QString class provides a Unicode character string.
The QStringList class provides a list of strings.
The QWindow class represents a window in the underlying windowing system.
QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config, const QSurfaceFormat &referenceFormat)
EGLConfig void * native_window
typedef EGLDisplay(EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum platform
typedef EGLSurface(EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)(EGLDisplay dpy
void const EGLint * attrib_list
#define EGL_PLATFORM_GBM_KHR
#define qCDebug(category,...)
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei GLenum format
GLsizei const GLchar *const * path