Merge "Support EGL protected content extension"
This commit is contained in:
commit
b34462c840
@ -152,6 +152,9 @@ public:
|
||||
the monitoring of the loss of context, such as, Windows with WGL, or Linux/X11 (xcb) with GLX, will
|
||||
monitor the status in every call to \l{QOpenGLContext::makeCurrent()}{makeCurrent()}. See
|
||||
\l{QOpenGLContext::isValid()}{isValid()} for more information on this.
|
||||
\value ProtectedContent Enables access to protected content. This allows the GPU to operate on protected
|
||||
resources (surfaces, buffers, textures), for example DRM-protected video content.
|
||||
Currently only implemented for EGL.
|
||||
*/
|
||||
|
||||
/*!
|
||||
@ -351,6 +354,9 @@ void QSurfaceFormat::setSamples(int numSamples)
|
||||
|
||||
Sets the format options to \a options.
|
||||
|
||||
To verify that an option was respected, compare the actual format to the
|
||||
requested format after surface/context creation.
|
||||
|
||||
\sa options(), testOption()
|
||||
*/
|
||||
void QSurfaceFormat::setOptions(QSurfaceFormat::FormatOptions options)
|
||||
@ -366,6 +372,9 @@ void QSurfaceFormat::setOptions(QSurfaceFormat::FormatOptions options)
|
||||
|
||||
Sets the format option \a option if \a on is true; otherwise, clears the option.
|
||||
|
||||
To verify that an option was respected, compare the actual format to the
|
||||
requested format after surface/context creation.
|
||||
|
||||
\sa setOptions(), options(), testOption()
|
||||
*/
|
||||
void QSurfaceFormat::setOption(QSurfaceFormat::FormatOption option, bool on)
|
||||
|
@ -57,7 +57,8 @@ public:
|
||||
StereoBuffers = 0x0001,
|
||||
DebugContext = 0x0002,
|
||||
DeprecatedFunctions = 0x0004,
|
||||
ResetNotification = 0x0008
|
||||
ResetNotification = 0x0008,
|
||||
ProtectedContent = 0x0010
|
||||
};
|
||||
Q_ENUM(FormatOption)
|
||||
Q_DECLARE_FLAGS(FormatOptions, FormatOption)
|
||||
|
@ -155,6 +155,17 @@ QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatform
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef EGL_EXT_protected_content
|
||||
if (format.testOption(QSurfaceFormat::ProtectedContent)) {
|
||||
if (q_hasEglExtension(m_eglDisplay, "EGL_EXT_protected_content")) {
|
||||
contextAttrs.append(EGL_PROTECTED_CONTENT_EXT);
|
||||
contextAttrs.append(EGL_TRUE);
|
||||
} else {
|
||||
m_format.setOption(QSurfaceFormat::ProtectedContent, false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Special Options for OpenVG surfaces
|
||||
if (m_format.renderableType() == QSurfaceFormat::OpenVG) {
|
||||
contextAttrs.append(EGL_ALPHA_MASK_SIZE);
|
||||
|
@ -67,7 +67,21 @@ void QEglFSKmsGbmWindow::resetSurface()
|
||||
}
|
||||
|
||||
if (createPlatformWindowSurface) {
|
||||
m_surface = createPlatformWindowSurface(display, m_config, reinterpret_cast<void *>(m_window), nullptr);
|
||||
QVector<EGLint> 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<void *>(m_window), contextAttributes.constData());
|
||||
} else {
|
||||
qCDebug(qLcEglfsKmsDebug, "No eglCreatePlatformWindowSurface for GBM, falling back to eglCreateWindowSurface");
|
||||
m_surface = eglCreateWindowSurface(display, m_config, m_window, nullptr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user