Skip to content

RFC: egl/dri2: Set EGL_NATIVE_VISUAL_ID for pbuffers

Jonas Ådahl requested to merge jadahl/mesa:wip/pbuffer-with-native-visual into main

When a compositor uses EGL_MESA_platform_surfaceless to composite its frames, it does so to pbuffers, as it's likely not possible to allocate DMA buffer backed buffers, nor any way to create gbm_surface backed EGLSurfaces, due to running headless with no available render nodes nor device nodes.

When this is the case, it may still be valuable to find out the pixel format of the pbuffer buffer store, so that this information can be used to choose appropriate configuration of adjecent functionality, e.g. PipeWire buffers formats.

To make this possible, start exposing EGL_NATIVE_VISUAL_ID as an EGL configuration attribute. This way, compositors can either select the exact format it expects, or query the format of any selected configuration.


This is something I ran into adding different methods of running headless to mutter. The primary method is to use the gbm platform, in which EGL_NATIVE_VISUAL_ID is available both when creating an EGL platform on top of a device node or render node, but when one don't have access to the device node, and there is no render node available, the surfaceless platform is the only available option, and as far as I understand there is no way to query the actual format of any render target when using the surfaceless platform.

This merge request makes it possible to query the format. I realize this affects pbuffers on all platforms, but as the subject says, this is a RFC whether this is even allowed in EGL, or if there are other / better ways to achieve the same thing.

Merge request reports