Bug 456372 - kwin_x11 (EGL): Creating the OpenGL rendering failed: "Invalid QOpenGLContext::globalShareContext()"
Summary: kwin_x11 (EGL): Creating the OpenGL rendering failed: "Invalid QOpenGLContex...
Status: RESOLVED INTENTIONAL
Alias: None
Product: kwin
Classification: Plasma
Component: egl (show other bugs)
Version: 5.25.2
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-05 22:53 UTC by Dan
Modified: 2024-03-03 02:40 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dan 2022-07-05 22:53:39 UTC
kwin_x11 works perfectly with KWIN_COMPOSE=O2 (GLX) and everything works, but if I use KWIN_COMPOSE=O2ES (EGL), it fails with "Invalid QOpenGLContext::globalShareContext()".

Operating System: Linux
KDE Plasma Version: 5.25.2
KDE Frameworks Version: 5.96.0
Qt Version: 5.15.5
Kernel Version: 5.18.9 (64-bit)
Graphics Processor: NVIDIA GeForce RTX 2070 with Max-Q Design/PCIe/SSE2

kwin_core: Compositing forced to OpenGL mode by environment variable
kwin_core: Forcing EGL native interface as OpenGL ES requested through KWIN_COMPOSE environment variable.
kwin_core: Attempting to load the OpenGL scene
kwin_platform_x11_standalone: Global share context format: QSurfaceFormat(version 4.6, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions|ResetNotification), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 0, stencilBufferSize 0, samples -1, swapBehavior QSurfaceFormat::DefaultSwapBehavior, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile)
kwin_scene_opengl: Creating the OpenGL rendering failed:  "Invalid QOpenGLContext::globalShareContext()"
kwin_core: Starting without compositing...

Any idea? Thanks.
Comment 1 Arjen Hiemstra 2022-10-18 14:34:37 UTC
Note that "KWIN_COMPOSE=O2ES" means you're forcing KWin into OpenGLES rendering, which happens to also use EGL as platform layer but has a lot more impact than just the platform layer. The correct environment variable for selecting EGL is `KWIN_OPENGL_INTERFACE=egl`.
Comment 2 Dan 2022-10-18 15:01:17 UTC
(In reply to Arjen Hiemstra from comment #1)
> Note that "KWIN_COMPOSE=O2ES" means you're forcing KWin into OpenGLES
> rendering, which happens to also use EGL as platform layer but has a lot
> more impact than just the platform layer. The correct environment variable
> for selecting EGL is `KWIN_OPENGL_INTERFACE=egl`.

I tried just with "KWIN_OPENGL_INTERFACE=egl`" and I got the same output:

kwin_core: Forcing EGL native interface through environment variable
kwin_core: Attempting to load the OpenGL scene
kwin_platform_x11_standalone: Global share context format: QSurfaceFormat(version 4.6, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions|ResetNotification), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 0, stencilBufferSize 0, samples -1, swapBehavior QSurfaceFormat::DefaultSwapBehavior, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile)
kwin_scene_opengl: Creating the OpenGL rendering failed:  "Invalid QOpenGLContext::globalShareContext()"
kwin_core: Starting without compositing...
Comment 3 serfreeman1337 2022-11-26 13:50:16 UTC
I was able to run X11 EGL with following envs:

QT_XCB_GL_INTEGRATION=xcb_egl
KWIN_OPENGL_INTERFACE=egl
Comment 4 Dan 2022-11-26 16:56:42 UTC
(In reply to serfreeman1337 from comment #3)
> I was able to run X11 EGL with following envs:
> 
> QT_XCB_GL_INTEGRATION=xcb_egl
> KWIN_OPENGL_INTERFACE=egl

I tested here with those variables and it seems to run using EGL, but I get the following repeating errors:

[7161:7320:1126/135150.233476:ERROR:gl_context_egl.cc(259)] eglCreateContext failed with error EGL_BAD_CONTEXT
[7161:7320:1126/135150.233482:ERROR:gpu_channel_manager.cc(753)] ContextResult::kFatalFailure: Failed to create shared context for virtualization.
[7161:7320:1126/135150.233484:ERROR:shared_image_stub.cc(470)] SharedImageStub: unable to create context
[7161:7320:1126/135150.233487:ERROR:gpu_channel.cc(449)] GpuChannel: Failed to create SharedImageStub

and I noticed a high CPU usage all the time and the panel is missing.
Comment 5 Dan 2024-03-03 02:40:48 UTC
Clsoing this one, since the issue doesn't happen with Plasma 6.