17void QEglFSKmsGbmWindow::resetSurface()
19 QEglFSKmsGbmScreen *gbmScreen =
static_cast<QEglFSKmsGbmScreen *>(screen());
20 EGLDisplay display = gbmScreen->display();
21 QSurfaceFormat platformFormat = m_integration->surfaceFormatFor(window()->requestedFormat());
22 m_config = QEglFSDeviceIntegration::chooseConfig(display, platformFormat);
23 m_format = q_glFormatFromConfig(display, m_config, platformFormat);
25 m_window =
reinterpret_cast<EGLNativeWindowType>(gbmScreen->createSurface(m_config));
27 PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC createPlatformWindowSurface =
nullptr;
28 const char *extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
29 if (extensions && (strstr(extensions,
"EGL_KHR_platform_gbm") || strstr(extensions,
"EGL_MESA_platform_gbm"))) {
30 createPlatformWindowSurface =
reinterpret_cast<PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC>(
31 eglGetProcAddress(
"eglCreatePlatformWindowSurfaceEXT"));
34 if (createPlatformWindowSurface) {
35 QVector<EGLint> contextAttributes;
36#ifdef EGL_EXT_protected_content
37 if (platformFormat.testOption(QSurfaceFormat::ProtectedContent)) {
38 if (q_hasEglExtension(display,
"EGL_EXT_protected_content")) {
39 contextAttributes.append(EGL_PROTECTED_CONTENT_EXT);
40 contextAttributes.append(EGL_TRUE);
41 qCDebug(qLcEglfsKmsDebug,
"Enabled EGL_PROTECTED_CONTENT_EXT for eglCreatePlatformWindowSurfaceEXT");
43 m_format.setOption(QSurfaceFormat::ProtectedContent,
false);
47 contextAttributes.append(EGL_NONE);
49 m_surface = createPlatformWindowSurface(display, m_config,
reinterpret_cast<
void *>(m_window), contextAttributes.constData());
51 qCDebug(qLcEglfsKmsDebug,
"No eglCreatePlatformWindowSurface for GBM, falling back to eglCreateWindowSurface");
52 m_surface = eglCreateWindowSurface(display, m_config, m_window,
nullptr);
56void QEglFSKmsGbmWindow::invalidateSurface()
58 QEglFSKmsGbmScreen *gbmScreen =
static_cast<QEglFSKmsGbmScreen *>(screen());
59 QEglFSWindow::invalidateSurface();
60 gbmScreen->resetSurface();