Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/drm/egl_gbm_backend.cpp
Show First 20 Lines • Show All 170 Lines • ▼ Show 20 Line(s) | 169 | { | |||
---|---|---|---|---|---|
171 | auto size = drmOutput->pixelSize(); | 171 | auto size = drmOutput->pixelSize(); | ||
172 | 172 | | |||
173 | auto gbmSurface = std::make_shared<GbmSurface>(m_backend->gbmDevice(), size.width(), size.height(), | 173 | auto gbmSurface = std::make_shared<GbmSurface>(m_backend->gbmDevice(), size.width(), size.height(), | ||
174 | GBM_FORMAT_XRGB8888, GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); | 174 | GBM_FORMAT_XRGB8888, GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); | ||
175 | if (!gbmSurface) { | 175 | if (!gbmSurface) { | ||
176 | qCCritical(KWIN_DRM) << "Create gbm surface failed"; | 176 | qCCritical(KWIN_DRM) << "Create gbm surface failed"; | ||
177 | return false; | 177 | return false; | ||
178 | } | 178 | } | ||
179 | auto eglSurface = eglCreatePlatformWindowSurfaceEXT(eglDisplay(), config(), (void *)(gbmSurface->surface()), nullptr); | 179 | | ||
180 | const int attr[] = { | ||||
181 | EGL_GL_COLORSPACE, EGL_GL_COLORSPACE_SRGB, | ||||
182 | 0 | ||||
183 | }; | ||||
184 | | ||||
185 | const bool hasEglColorspace = epoxy_egl_version(eglDisplay()) >= 15 || | ||||
186 | hasExtension(QByteArrayLiteral("EGL_KHR_gl_colorspace")); | ||||
187 | | ||||
188 | auto eglSurface = eglCreatePlatformWindowSurfaceEXT(eglDisplay(), config(), | ||||
zzag: eglCreatePlatformWindowSurfaceEXT fails with EGL_BAD_ATTRIBUTE when EGL_GL_COLORSPACE is in… | |||||
189 | (void *)(gbmSurface->surface()), | ||||
190 | !isOpenGLES() && hasEglColorspace ? attr : nullptr); | ||||
180 | if (eglSurface == EGL_NO_SURFACE) { | 191 | if (eglSurface == EGL_NO_SURFACE) { | ||
181 | qCCritical(KWIN_DRM) << "Create Window Surface failed"; | 192 | qCCritical(KWIN_DRM) << "Create Window Surface failed"; | ||
182 | return false; | 193 | return false; | ||
183 | } else { | 194 | } else { | ||
184 | // destroy previous surface | 195 | // destroy previous surface | ||
185 | if (o.eglSurface != EGL_NO_SURFACE) { | 196 | if (o.eglSurface != EGL_NO_SURFACE) { | ||
186 | if (surface() == o.eglSurface) { | 197 | if (surface() == o.eglSurface) { | ||
187 | setSurface(eglSurface); | 198 | setSurface(eglSurface); | ||
▲ Show 20 Lines • Show All 239 Lines • Show Last 20 Lines |
eglCreatePlatformWindowSurfaceEXT fails with EGL_BAD_ATTRIBUTE when EGL_GL_COLORSPACE is in attrib_list. (EGL_KHR_gl_colorspace is supported)