platforms/drm: use surfaceless context
On multi-gpu systems it could happen that the primary GPU has no working outputs attached, yet we still need the egl context.
This commit is contained in:
parent
1fa66fb504
commit
5a2177a51c
1 changed files with 6 additions and 9 deletions
|
@ -86,6 +86,10 @@ bool EglGbmBackend::initializeEgl()
|
||||||
// Use eglGetPlatformDisplayEXT() to get the display pointer
|
// Use eglGetPlatformDisplayEXT() to get the display pointer
|
||||||
// if the implementation supports it.
|
// if the implementation supports it.
|
||||||
if (display == EGL_NO_DISPLAY) {
|
if (display == EGL_NO_DISPLAY) {
|
||||||
|
if (!supportsSurfacelessContext()) {
|
||||||
|
setFailed("EGL_KHR_surfaceless_context extension is unavailable!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
const bool hasMesaGBM = hasClientExtension(QByteArrayLiteral("EGL_MESA_platform_gbm"));
|
const bool hasMesaGBM = hasClientExtension(QByteArrayLiteral("EGL_MESA_platform_gbm"));
|
||||||
const bool hasKHRGBM = hasClientExtension(QByteArrayLiteral("EGL_KHR_platform_gbm"));
|
const bool hasKHRGBM = hasClientExtension(QByteArrayLiteral("EGL_KHR_platform_gbm"));
|
||||||
const GLenum platform = hasMesaGBM ? EGL_PLATFORM_GBM_MESA : EGL_PLATFORM_GBM_KHR;
|
const GLenum platform = hasMesaGBM ? EGL_PLATFORM_GBM_MESA : EGL_PLATFORM_GBM_KHR;
|
||||||
|
@ -151,12 +155,8 @@ bool EglGbmBackend::initRenderingContext()
|
||||||
qCCritical(KWIN_DRM) << "Create Window Surfaces failed";
|
qCCritical(KWIN_DRM) << "Create Window Surfaces failed";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!m_outputs.isEmpty()) {
|
if (isPrimary()) {
|
||||||
// Set our first surface as the one for the abstract backend, just to make it happy.
|
return makeCurrent();
|
||||||
setSurface(m_outputs.first().eglSurface);
|
|
||||||
if (isPrimary()) {
|
|
||||||
return makeContextCurrent(m_outputs.first());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -196,9 +196,6 @@ bool EglGbmBackend::resetOutput(Output &output, DrmOutput *drmOutput)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (surface() == output.eglSurface || surface() == EGL_NO_SURFACE) {
|
|
||||||
setSurface(eglSurface);
|
|
||||||
}
|
|
||||||
// destroy previous surface
|
// destroy previous surface
|
||||||
if (output.eglSurface != EGL_NO_SURFACE) {
|
if (output.eglSurface != EGL_NO_SURFACE) {
|
||||||
eglDestroySurface(eglDisplay(), output.eglSurface);
|
eglDestroySurface(eglDisplay(), output.eglSurface);
|
||||||
|
|
Loading…
Reference in a new issue