Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/virtual/egl_gbm_backend.cpp
Show First 20 Lines • Show All 93 Lines • ▼ Show 20 Line(s) | |||||
94 | bool EglGbmBackend::initializeEgl() | 94 | bool EglGbmBackend::initializeEgl() | ||
95 | { | 95 | { | ||
96 | initClientExtensions(); | 96 | initClientExtensions(); | ||
97 | EGLDisplay display = m_backend->sceneEglDisplay(); | 97 | EGLDisplay display = m_backend->sceneEglDisplay(); | ||
98 | 98 | | |||
99 | // Use eglGetPlatformDisplayEXT() to get the display pointer | 99 | // Use eglGetPlatformDisplayEXT() to get the display pointer | ||
100 | // if the implementation supports it. | 100 | // if the implementation supports it. | ||
101 | if (display == EGL_NO_DISPLAY) { | 101 | if (display == EGL_NO_DISPLAY) { | ||
102 | const bool hasMesaGBM = hasClientExtension(QByteArrayLiteral("EGL_MESA_platform_gbm")); | ||||
103 | const bool hasKHRGBM = hasClientExtension(QByteArrayLiteral("EGL_KHR_platform_gbm")); | ||||
104 | const GLenum platform = hasMesaGBM ? EGL_PLATFORM_GBM_MESA : EGL_PLATFORM_GBM_KHR; | ||||
105 | | ||||
102 | if (!hasClientExtension(QByteArrayLiteral("EGL_EXT_platform_base")) || | 106 | if (!hasClientExtension(QByteArrayLiteral("EGL_EXT_platform_base")) || | ||
103 | !hasClientExtension(QByteArrayLiteral("EGL_MESA_platform_gbm"))) { | 107 | (!hasMesaGBM && !hasKHRGBM)) { | ||
104 | setFailed("EGL_EXT_platform_base and/or EGL_MESA_platform_gbm missing"); | 108 | setFailed("missing one or more extensions between EGL_EXT_platform_base, EGL_MESA_platform_gbm, EGL_KHR_platform_gbm"); | ||
105 | return false; | 109 | return false; | ||
106 | } | 110 | } | ||
107 | 111 | | |||
108 | #if HAVE_GBM | 112 | #if HAVE_GBM | ||
109 | initGbmDevice(); | 113 | initGbmDevice(); | ||
110 | if (auto device = m_backend->gbmDevice()) { | 114 | if (auto device = m_backend->gbmDevice()) { | ||
111 | display = eglGetPlatformDisplayEXT(EGL_PLATFORM_GBM_MESA, device, nullptr); | 115 | display = eglGetPlatformDisplayEXT(platform, device, nullptr); | ||
112 | } | 116 | } | ||
113 | #endif | 117 | #endif | ||
114 | 118 | | |||
115 | if (display == EGL_NO_DISPLAY) { | 119 | if (display == EGL_NO_DISPLAY) { | ||
116 | qCWarning(KWIN_VIRTUAL) << "Failed to create EGLDisplay through GBM device, trying with default device"; | 120 | qCWarning(KWIN_VIRTUAL) << "Failed to create EGLDisplay through GBM device, trying with default device"; | ||
117 | display = eglGetPlatformDisplay(EGL_PLATFORM_GBM_MESA, EGL_DEFAULT_DISPLAY, nullptr); | 121 | display = eglGetPlatformDisplayEXT(platform, EGL_DEFAULT_DISPLAY, nullptr); | ||
118 | } | 122 | } | ||
119 | } | 123 | } | ||
120 | 124 | | |||
121 | if (display == EGL_NO_DISPLAY) | 125 | if (display == EGL_NO_DISPLAY) | ||
122 | return false; | 126 | return false; | ||
123 | setEglDisplay(display); | 127 | setEglDisplay(display); | ||
124 | return initEglAPI(); | 128 | return initEglAPI(); | ||
125 | } | 129 | } | ||
▲ Show 20 Lines • Show All 164 Lines • Show Last 20 Lines |