From bedd85821fea89347b7d0737596b2ba35028d6a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Fl=C3=B6ser?= Date: Sat, 5 Jan 2019 10:45:26 +0100 Subject: [PATCH] [platforms/virtual] Add support for EGL_MESA_platform_surfaceless Summary: Thus we don't require vgem any more which fails with latest mesa. Kepping the vgem variant as fallback for older systems. See T10245 Test Plan: SceneOpenGL Test passes without init vgem, not tested with latest mesa Reviewers: #kwin Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D17980 --- TESTING.md | 3 ++- plugins/platforms/virtual/egl_gbm_backend.cpp | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/TESTING.md b/TESTING.md index ea24a0bbe8..a8a764212d 100644 --- a/TESTING.md +++ b/TESTING.md @@ -11,7 +11,8 @@ The following additional software needs to be installed for running the test sui * breeze window decoration # Preparing a run of the test suite -Please load the kernel module "vgem". This is required to provide a virtual OpenGL device. +In case your system does not support the EGL extension EGL_MESA_platform_surfaceless, +please load the kernel module "vgem". This is required to provide a virtual OpenGL device. sudo modprobe vgem diff --git a/plugins/platforms/virtual/egl_gbm_backend.cpp b/plugins/platforms/virtual/egl_gbm_backend.cpp index cce4d3d4d3..36ba67eb19 100644 --- a/plugins/platforms/virtual/egl_gbm_backend.cpp +++ b/plugins/platforms/virtual/egl_gbm_backend.cpp @@ -99,6 +99,13 @@ bool EglGbmBackend::initializeEgl() // Use eglGetPlatformDisplayEXT() to get the display pointer // if the implementation supports it. if (display == EGL_NO_DISPLAY) { + // first try surfaceless + if (hasClientExtension(QByteArrayLiteral("EGL_MESA_platform_surfaceless"))) { + display = eglGetPlatformDisplayEXT(EGL_PLATFORM_SURFACELESS_MESA, EGL_DEFAULT_DISPLAY, nullptr); + } + } + if (display == EGL_NO_DISPLAY) { + qCDebug(KWIN_VIRTUAL) << "Failed to create surfaceless platform, trying with vgem device"; 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;