[Cogl] [PATCH 0/7] Quad-buffer stereo support

Robert Bragg robert at sixbynine.org
Sun Jun 15 09:46:29 PDT 2014


Hi Owen,

Thanks for sending these patches out. I have some initial comments
below and I'll also comment on individual patches...

On Thu, Jun 12, 2014 at 7:11 PM,  <otaylor at redhat.com> wrote:
> From: "Owen W. Taylor" <otaylor at fishsoup.net>
>
> This patchset adds support for quad-buffer stereo. There are basically three
> pieces to this:
>
>  1. Configuring the creation of a CoglOnscreen with the right fbconfig
>  2. Controlling whether drawing is going to the right or left framebuffer
>  3. Supporting drawing from the left or right buffer for CoglTexturePixmap
>
> Of these 1. is the part I'm least certain about in this patchset - I made
> the stereo selection part of the CoglOnscreenTemplate and made it "best
> effort" - if stereo support isn't available, it falls back to non-stereo.
>
> This isn't in agreement with how alpha is handled - where it is part of the
> CoglSwapChain and initialization fails if alpha isn't supported. I think
> the approach of cogl_renderer_check_onscreen_template() is rather awkward -
> if you look at https://git.gnome.org/browse/clutter/tree/clutter/x11/clutter-backend-x11.c#n728
> extending that to alpha and stereo would be really ugly - it would have
> to try all the different combinations.

Right. For reference; in cogl master we got rid of the swap-chain
object since it was overly cumbersome. Maybe we could even get rid of
it on the 1.18 branch if done in sync with updating clutter. The
OnscreenTemplate api is pretty much just there to help handle the
awkward GLX and EGL requirements that windows need to be configured
with a config that's compatible with the context. Maybe eventually
when drivers get rid of that requirement we can stop using/remove this
api.

About the _check_onscreen_template() api; that is currently
implemented as a shorthand for connecting the renderer and then trying
to setup a transient CoglDisplay with that template. This isn't great
at all, not least because you end up creating and discarding a GL
context in the success cases which is a pretty heavyweight object. It
could be improved if it just checked for suitable configs without
creating a CoglDisplay + GL context. Perhaps it could be better to do
this at the display level too, so something like cogl_display_check().

With the current api it would probably be better to forgo explicit
template checks and rely on cogl_display_setup() to catch an
inconsistent display configuration. Fallbacks would then only be
considered after a setup failure.

Currently we're missing a way to check renderer features that can help
you avoid configuring a display with unsupported features. We should
probably expose a cogl_renderer_has_feature() api. This could expose
winsys features, such as whether stereo rendering is supported. A
hacky workaround for the 1.18 branch could be to expose another
COGL_WINSYS_FEATURE_ that clutter can access via
cogl_clutter_winsys_has_feature().

>
> Is there a direction here to allow for sharing a single GL context across
> different fbconfigs in the style of EGL_MESA_configless_context? I'm guessing
> since Neil wrote that extension there is some plan to support it in Cogl.
> My current need is to support stereo with GLX, where I don't think we'll
> get away from the need for a different GL context, but eventually there will
> presumably be stereo support for EGL as well.

I don't know of any plans for configless GLX myself.

It would be nice to use configless in Cogl where available and start
to break down the limitation that onscreen framebuffers can only be
configured according to an onscreen-template; though I don't know of
any plans to look at this a.t.m.

For stereoscopic rendering with EGL there is theoretically
EGL_EXT_multiview_window that can be used in conjunction with
GL_EXT_multiview_draw_buffers - depending on what driver you are
using.

>
> I certainly would appreciate feedback about whether there is some better
> way to set things up than what I did here.

Hopefully the above comments speak to this a bit, though I'll also
comment on the patches specifically and I'm open to ideas for
improving the display configuration.

--
Regards
Robert

>
> Thanks,
> Owen
>
> Owen W. Taylor (7):
>   Add support for setting up stereo CoglOnscreens
>   Add a simple example of stereo drawing
>   CoglTexturePixmapX11: add support for stereo content
>   examples/cogl-x11-tfp.c: Wait for the window to be mapped
>   examples/cogl-x11-tfp.c: Handle WM_DELETE_WINDOW
>   examples/cogl-x11-tfp: Add a --gears option to run glxgears
>   examples/cogl-texture-pixmap-x11: Add a --stereo command line option
>
>  cogl/Makefile.am                                |   1 +
>  cogl/cogl-context-private.h                     |   1 +
>  cogl/cogl-framebuffer-private.h                 |   9 +-
>  cogl/cogl-framebuffer.c                         |  46 ++++
>  cogl/cogl-framebuffer.h                         |  52 ++++
>  cogl/cogl-glx-display-private.h                 |   3 +-
>  cogl/cogl-onscreen-template.c                   |   8 +
>  cogl/cogl-onscreen-template.h                   |  19 ++
>  cogl/cogl-types.h                               |  15 ++
>  cogl/driver/gl/cogl-framebuffer-gl.c            |  29 +++
>  cogl/winsys/cogl-texture-pixmap-x11-private.h   |  43 ++++
>  cogl/winsys/cogl-texture-pixmap-x11-right.c     | 324 ++++++++++++++++++++++++
>  cogl/winsys/cogl-texture-pixmap-x11.c           | 122 ++++++---
>  cogl/winsys/cogl-texture-pixmap-x11.h           |  59 ++++-
>  cogl/winsys/cogl-winsys-egl-x11.c               |   4 +-
>  cogl/winsys/cogl-winsys-glx-feature-functions.h |   5 +
>  cogl/winsys/cogl-winsys-glx.c                   | 135 +++++++---
>  cogl/winsys/cogl-winsys-private.h               |   4 +-
>  examples/Makefile.am                            |   4 +-
>  examples/cogl-stereo.c                          | 155 ++++++++++++
>  examples/cogl-x11-tfp.c                         | 215 ++++++++++++++--
>  21 files changed, 1159 insertions(+), 94 deletions(-)
>  create mode 100644 cogl/winsys/cogl-texture-pixmap-x11-right.c
>  create mode 100644 examples/cogl-stereo.c
>
> --
> 1.9.3
>
> _______________________________________________
> Cogl mailing list
> Cogl at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/cogl


More information about the Cogl mailing list