GNOME Bugzilla – Bug 733277
Add support for quad-buffer stereo
Last modified: 2021-07-05 13:45:14 UTC
Track the stereo status of windows using the new EXT_stereo_tree GLX extension. When stereo is enabled or disabled, a restart is triggered via meta_restart() after a timeout, setting a _META_ENABLE_STEREO property on the root window to indicate whether we should turn on a stereo stage for clutter. The property avoids a loop, since we need to enable stereo *before* initializing Clutter and GL, but we need GL to figure out whether we have stereo windows. Stereo windows are drawn to the stage using new functionality in Cogl to setup a stereo context, select which buffer to draw to, and draw either the left or right buffer of a stereo texture_from_pixmap.
Created attachment 280886 [details] [review] Add support for quad-buffer stereo
Review of attachment 280886 [details] [review]: Code looks good to me but a) I have no way of actually testing it and b) I am not sure I like the "_right" naming (does not mean anything on its own but have no better suggestion that aren't just too long).
Created attachment 346408 [details] [review] Add support for quad-buffer stereo [ Rebased to current master, I also have a very slightly different version for gnome-3-22 ] Track the stereo status of windows using the new EXT_stereo_tree GLX extension. When stereo is enabled or disabled, a restart is triggered via meta_restart() after a timeout, setting a _META_ENABLE_STEREO property on the root window to indicate whether we should turn on a stereo stage for clutter. The property avoids a loop, since we need to enable stereo *before* initializing Clutter and GL, but we need GL to figure out whether we have stereo windows. Stereo windows are drawn to the stage using new functionality in Cogl to setup a stereo context, select which buffer to draw to, and draw either the left or right buffer of a stereo texture_from_pixmap.
Review of attachment 346408 [details] [review]: some nitpicks you can ignore. overall looks fine ::: src/compositor/compositor.c @@ +482,3 @@ +#define GLX_STEREO_TREE_EXT 0x20F5 +#define GLX_STEREO_NOTIFY_MASK_EXT 0x00000001 +#define GLX_STEREO_NOTIFY_EXT 0x00000000 I see these defined in GL/glxext.h but they won't ever change so, ok @@ +493,3 @@ + Drawable window; + Bool stereo_tree; +} StereoNotifyEvent; otoh, this doesn't seem to be defined on any headers I have @@ +508,3 @@ + query_extensions_string = + (const char * (*) (Display *, int)) + cogl_get_proc_address ("glXQueryExtensionsString"); would be nice to have this kind of code in mutter consolidated but i guess this will be the last addition we need of direct gl/glx API usage @@ +516,3 @@ +} + +#include <GL/gl.h> don't think we need this include @@ +567,3 @@ + cogl_get_proc_address ("glXSelectEvent"); + + select_event (xdisplay, xwindow, GLX_STEREO_NOTIFY_MASK_EXT); I suppose this is safe since nothing else in mutter/clutter/cogl selects for other glx events but a comment would be nice
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/mutter/-/issues/ Thank you for your understanding and your help.