As part of the GStreamer Hackfest in Nice, France I had some time to go through some outstanding GStreamer issues. One such issue that has been on my mind was this GStreamer OpenGL Wayland issue.
Now, the issue is that OpenGL is an old API and did not have some of the platform extensions it does today. As a result, most windowing system APIs allow creating an output surface (or a window) but never showing it. This also works just fine when you are creating an OpenGL context but not actually rendering anything to the screen and this approach is what is used by all of the other major OpenGL platforms (Windows, macOS, X11, etc) supported by GStreamer.
When wayland initially arrived, this was not the case. A wayland surface could be the back buffer (an OpenGL term for rendering to a surface) but could not be hidden. This is very different from how other windowing APIs worked at the time. As a result, the initial implementation using Wayland within GStreamer OpenGL used some heuristics for determining when a wayland surface would be created and used that basically boiled down to, if there is no shared OpenGL context, then create a window.
This heuristic obviously breaks in multiple different ways, the two most obvious being:
gltestsrc ! gldownload ! some-non-gl-sink
- there should be no surface used here.gltestsrc ! glimagesink gltestsrc ! glimagesink
- there should be two output surfaces used here.
The good news is that issue is now fixed by adding some API that glimagesink
can use to notify that it would like an output surface. This has been
implemented in this merge request
and will be part of GStreamer 1.28.