16void QEglFSKmsGbmWindow::resetSurface()
18 QEglFSKmsGbmScreen *gbmScreen =
static_cast<QEglFSKmsGbmScreen *>(screen());
19 EGLDisplay display = gbmScreen->display();
20 QSurfaceFormat platformFormat = m_integration->surfaceFormatFor(window()->requestedFormat());
21 m_config = QEglFSDeviceIntegration::chooseConfig(display, platformFormat);
22 m_format = q_glFormatFromConfig(display, m_config, platformFormat);
24 m_window =
reinterpret_cast<EGLNativeWindowType>(gbmScreen->createSurface(m_config));
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"));
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");
42 m_format.setOption(QSurfaceFormat::ProtectedContent,
false);
46 contextAttributes.append(EGL_NONE);
48 m_surface = createPlatformWindowSurface(display, m_config,
reinterpret_cast<
void *>(m_window), contextAttributes.constData());
50 qCDebug(qLcEglfsKmsDebug,
"No eglCreatePlatformWindowSurface for GBM, falling back to eglCreateWindowSurface");
51 m_surface = eglCreateWindowSurface(display, m_config, m_window,
nullptr);
55void QEglFSKmsGbmWindow::invalidateSurface()
57 QEglFSKmsGbmScreen *gbmScreen =
static_cast<QEglFSKmsGbmScreen *>(screen());
58 QEglFSWindow::invalidateSurface();
59 gbmScreen->resetSurface();