check for EGL_KHR_platform_gbm extension as well
Summary: some drivers, like Mali have EGL_KHR_platform_gbm but not EGL_MESA_platform_gbm Test Plan: pending a test on rock64 board Reviewers: #kwin, #plasma, davidedmundson, graesslin Reviewed By: #kwin, #plasma, graesslin Subscribers: graesslin, garg, davidedmundson, plasma-devel, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D10346
This commit is contained in:
parent
627b11ce49
commit
8a2b9a014f
2 changed files with 15 additions and 7 deletions
|
@ -90,9 +90,13 @@ bool EglGbmBackend::initializeEgl()
|
|||
// Use eglGetPlatformDisplayEXT() to get the display pointer
|
||||
// if the implementation supports it.
|
||||
if (display == EGL_NO_DISPLAY) {
|
||||
const bool hasMesaGBM = hasClientExtension(QByteArrayLiteral("EGL_MESA_platform_gbm"));
|
||||
const bool hasKHRGBM = hasClientExtension(QByteArrayLiteral("EGL_KHR_platform_gbm"));
|
||||
const GLenum platform = hasMesaGBM ? EGL_PLATFORM_GBM_MESA : EGL_PLATFORM_GBM_KHR;
|
||||
|
||||
if (!hasClientExtension(QByteArrayLiteral("EGL_EXT_platform_base")) ||
|
||||
!hasClientExtension(QByteArrayLiteral("EGL_MESA_platform_gbm"))) {
|
||||
setFailed("EGL_EXT_platform_base and/or EGL_MESA_platform_gbm missing");
|
||||
(!hasMesaGBM && !hasKHRGBM)) {
|
||||
setFailed("missing one or more extensions between EGL_EXT_platform_base, EGL_MESA_platform_gbm, EGL_KHR_platform_gbm");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -103,7 +107,7 @@ bool EglGbmBackend::initializeEgl()
|
|||
}
|
||||
m_backend->setGbmDevice(device);
|
||||
|
||||
display = eglGetPlatformDisplayEXT(EGL_PLATFORM_GBM_MESA, device, nullptr);
|
||||
display = eglGetPlatformDisplayEXT(platform, device, nullptr);
|
||||
}
|
||||
|
||||
if (display == EGL_NO_DISPLAY)
|
||||
|
|
|
@ -99,22 +99,26 @@ bool EglGbmBackend::initializeEgl()
|
|||
// Use eglGetPlatformDisplayEXT() to get the display pointer
|
||||
// if the implementation supports it.
|
||||
if (display == EGL_NO_DISPLAY) {
|
||||
const bool hasMesaGBM = hasClientExtension(QByteArrayLiteral("EGL_MESA_platform_gbm"));
|
||||
const bool hasKHRGBM = hasClientExtension(QByteArrayLiteral("EGL_KHR_platform_gbm"));
|
||||
const GLenum platform = hasMesaGBM ? EGL_PLATFORM_GBM_MESA : EGL_PLATFORM_GBM_KHR;
|
||||
|
||||
if (!hasClientExtension(QByteArrayLiteral("EGL_EXT_platform_base")) ||
|
||||
!hasClientExtension(QByteArrayLiteral("EGL_MESA_platform_gbm"))) {
|
||||
setFailed("EGL_EXT_platform_base and/or EGL_MESA_platform_gbm missing");
|
||||
(!hasMesaGBM && !hasKHRGBM)) {
|
||||
setFailed("missing one or more extensions between EGL_EXT_platform_base, EGL_MESA_platform_gbm, EGL_KHR_platform_gbm");
|
||||
return false;
|
||||
}
|
||||
|
||||
#if HAVE_GBM
|
||||
initGbmDevice();
|
||||
if (auto device = m_backend->gbmDevice()) {
|
||||
display = eglGetPlatformDisplayEXT(EGL_PLATFORM_GBM_MESA, device, nullptr);
|
||||
display = eglGetPlatformDisplayEXT(platform, device, nullptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (display == EGL_NO_DISPLAY) {
|
||||
qCWarning(KWIN_VIRTUAL) << "Failed to create EGLDisplay through GBM device, trying with default device";
|
||||
display = eglGetPlatformDisplay(EGL_PLATFORM_GBM_MESA, EGL_DEFAULT_DISPLAY, nullptr);
|
||||
display = eglGetPlatformDisplayEXT(platform, EGL_DEFAULT_DISPLAY, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue