GNOME Bugzilla – Bug 693225
Let Gnome Shell work on EGL and GLES2
Last modified: 2013-02-06 08:35:51 UTC
Currently Gnome Shell requires Cogl to use the GLX winsys because it makes some direct GLX calls in order to set the swap event retrieval. If we make it determine whether Cogl is using GLX at run-time we can avoid this restriction and let Gnome Shell work with EGL. EGL is the future for the window system binding of GL so it'd be good to support it as it's not much hassle. This would also be a small step towards getting Gnome Shell to run directly on KMS which would be required for Wayland. Presumably the swap event code could eventually be removed altogether if Gnome Shell starts using the CoglFrameCallback mechanism instead. As Gnome Shell would no longer make any GL calls itself, it would no longer need to directly link against libGL. This also makes it possible to use Gnome Shell with GLES2. A slight problem with this in practice is that currently the X11 EGL platform in Mesa internally calls XFixesQueryVersion using the latest version that libxcb supports. Currently that is only version 4. Calling that function resets what the X server thinks the client can support so then when mutter later tries to create a pointer barrier it will get a BadRequest error. I've posted a patch for xcb-proto to the mailing list to fix this. If you rebuild xcb-proto, libxcb and Mesa with this patch then Gnome Shell works fine under EGL. http://lists.freedesktop.org/archives/xcb/2013-February/008131.html
Created attachment 235251 [details] [review] Don't try to use GLX if Cogl isn't using that Winsys Instead of directly using symbols from GLX to check for the swap event notification, the plugin now first verifies that the Cogl renderer is actually using the GLX winsys and then indirectly fetches the pointers for the GLX functions using cogl_get_proc_address. That way it will continue to work if Cogl is using an EGL winsys. Nothing in the Gnome Shell plugin now directly uses symbols from libGL so we don't need to link to it. This helps to avoid problems linking against two GL APIs when cogl is using a non-GL driver such as GLES2.
Review of attachment 235251 [details] [review]: Patch looks good. Did not test it on EGL though (and going by your comment it won't work yet without a fixed xcb-proto). But given that it did not work before and it does not hurt GLX it is fine.
Thanks for the feedback. I have pushed it to master: http://git.gnome.org/browse/gnome-shell/commit/?id=b8a8edc513f015