From 7a68aa6fc753bcf07a4024aa08807823630b444b Mon Sep 17 00:00:00 2001 From: Elvis Lee Date: Thu, 28 Jan 2021 17:16:04 +0900 Subject: Support EGL protected content extension A protected context is required to allow the GPU to operate on protected resources, including protected surfaces and protected EGLImages. For example, GPU can post-process on protected content like DRM protected content so that complex, nonlinear video effects or mapping onto textures can be used. The surface format option may be relevant for DirectX and Vulkan in the future: https://microsoft.github.io/DirectX-Specs/d3d/ProtectedResources.html https://www.khronos.org/registry/vulkan/specs/1.1-khr-extensions/html/chap12.html#memory-protected-memory Change-Id: I2d155f0e68b830276690b4833b22a2bc452cdcad Reviewed-by: Elvis Lee Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../deviceintegration/eglfs_kms/qeglfskmsgbmwindow.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms/eglfs') diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.cpp index 426fb8f4e9..3a0222db92 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.cpp @@ -67,7 +67,21 @@ void QEglFSKmsGbmWindow::resetSurface() } if (createPlatformWindowSurface) { - m_surface = createPlatformWindowSurface(display, m_config, reinterpret_cast(m_window), nullptr); + QVector contextAttributes; +#ifdef EGL_EXT_protected_content + if (platformFormat.testOption(QSurfaceFormat::ProtectedContent)) { + if (q_hasEglExtension(display, "EGL_EXT_protected_content")) { + contextAttributes.append(EGL_PROTECTED_CONTENT_EXT); + contextAttributes.append(EGL_TRUE); + qCDebug(qLcEglfsKmsDebug, "Enabled EGL_PROTECTED_CONTENT_EXT for eglCreatePlatformWindowSurfaceEXT"); + } else { + m_format.setOption(QSurfaceFormat::ProtectedContent, false); + } + } +#endif + contextAttributes.append(EGL_NONE); + + m_surface = createPlatformWindowSurface(display, m_config, reinterpret_cast(m_window), contextAttributes.constData()); } else { qCDebug(qLcEglfsKmsDebug, "No eglCreatePlatformWindowSurface for GBM, falling back to eglCreateWindowSurface"); m_surface = eglCreateWindowSurface(display, m_config, m_window, nullptr); -- cgit v1.2.3