Skip to content

Introduce persistent global share context

Vlad Zahorodnii requested to merge work/persistent-global-share-context into master

On Wayland, internal windows that use OpenGL are rendered into fbos, which are later handed over to kwin. In order to achieve that, our QPA creates OpenGL contexts that share resources with the scene's context.

The problems start when compositing has been restarted. If user changes any compositing settings, the underlying render backend will be reinitialized and with it, the scene's context will be destroyed. Thus, we no longer can accept framebuffer objects from internal windows.

This change address the framebuffer object sharing problem by adding a so called global share context. It persists throughout the lifetime of kwin. It can never be made current. The scene context and all contexts created in our QPA share resources with it.

Therefore we can destroy the scene OpenGL context without affecting OpenGL contexts owned by internal windows, e.g. the outline visual or tabbox.

It's worth noting that Qt provides a way to create a global share context. But for our purposes it's not suitable since the share context and other "child" contexts must be created on the same EGL display; otherwise we might get weird errors such as EGL_BAD_CONTEXT when calling eglCreateContext().

BUG: 415798

Merge request reports