9#include "private/qeglfswindow_p.h"
11#include <QtDeviceDiscoverySupport/private/qdevicediscovery_p.h>
12#include <QtGui/private/qeglconvenience_p.h>
13#include <QtCore/QLoggingCategory>
14#include <QtCore/QJsonDocument>
15#include <QtCore/QJsonObject>
16#include <QtCore/QJsonArray>
17#include <QtGui/qpa/qplatformwindow.h>
18#include <QtGui/QScreen>
21#include <xf86drmMode.h>
28 qCDebug(qLcEglfsKmsDebug,
"New DRM/KMS via Vsp2 integration created");
31#ifndef EGL_EXT_platform_base
36#ifndef EGL_PLATFORM_GBM_KHR
37#define EGL_PLATFORM_GBM_KHR 0x31D7
42 qCDebug(qLcEglfsKmsDebug,
"Querying EGLDisplay");
46 const char *extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
47 if (extensions && (strstr(extensions,
"EGL_KHR_platform_gbm") || strstr(extensions,
"EGL_MESA_platform_gbm"))) {
49 eglGetProcAddress(
"eglGetPlatformDisplayEXT"));
52 if (getPlatformDisplay) {
55 qCDebug(qLcEglfsKmsDebug,
"No eglGetPlatformDisplay for GBM, falling back to eglGetDisplay");
56 display = eglGetDisplay(nativeDisplay);
70 GBM_BO_USE_RENDERING);
72 return reinterpret_cast<EGLNativeWindowType
>(surface);
77 gbm_surface *surface =
reinterpret_cast<gbm_surface *
>(
window);
79 gbm_surface_destroy(surface);
92 if (!
path.isEmpty()) {
93 qCDebug(qLcEglfsKmsDebug) <<
"VSP2: Using DRM device" <<
path <<
"specified in config file";
97 qCDebug(qLcEglfsKmsDebug) <<
"Found the following video devices:" <<
devices;
101 qFatal(
"Could not find DRM device!");
133 m_window =
reinterpret_cast<EGLNativeWindowType
>(vsp2Screen->createSurface());
135 PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC createPlatformWindowSurface =
nullptr;
136 const char *extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
137 if (extensions && (strstr(extensions,
"EGL_KHR_platform_gbm") || strstr(extensions,
"EGL_MESA_platform_gbm"))) {
138 createPlatformWindowSurface =
reinterpret_cast<PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC
>(
139 eglGetProcAddress(
"eglCreatePlatformWindowSurfaceEXT"));
142 if (createPlatformWindowSurface) {
145 qCDebug(qLcEglfsKmsDebug,
"No eglCreatePlatformWindowSurface for GBM, falling back to eglCreateWindowSurface");
154 vsp2Screen->resetSurface();
static QDeviceDiscovery * create(QDeviceTypes type, QObject *parent=nullptr)
static EGLConfig chooseConfig(EGLDisplay display, const QSurfaceFormat &format)
QKmsScreenConfig * screenConfig() const
QSurfaceFormat surfaceFormatFor(const QSurfaceFormat &inputFormat) const override
QKmsDevice * device() const
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
Invalidates the window's surface by releasing its surface buffers.
void invalidateSurface() override
Invalidates the window's surface by releasing its surface buffers.
EGLNativeWindowType m_window
QEglFSScreen * screen() const override
QString devicePath() const
\macro QT_RESTRICTED_CAST_FROM_ASCII
struct wl_display * display
Combined button and popup list for selecting options.
QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config, const QSurfaceFormat &referenceFormat)
#define EGL_PLATFORM_GBM_KHR
EGLConfig void * native_window
typedef EGLDisplay(EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum platform
typedef EGLSurface(EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)(EGLDisplay dpy
void const EGLint * attrib_list
typedef EGLDisplay(EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum platform
#define qCDebug(category,...)
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei GLenum format
GLsizei const GLchar *const * path
EGLDisplay(* PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum platform, void *native_display, const EGLint *attrib_list)