[Cogl] [PATCH 3/7] CoglTexturePixmapX11: add support for stereo content

Owen Taylor owtaylor at gmail.com
Wed Jun 18 12:22:03 PDT 2014


On Sun, 2014-06-15 at 18:12 +0100, Robert Bragg wrote:
> On Thu, Jun 12, 2014 at 7:11 PM,  <otaylor at redhat.com> wrote:
> > From: "Owen W. Taylor" <otaylor at fishsoup.net>
> >
> > Add cogl_texture_pixmap_x11_new_stereo() to create a a texture
> > pixmap using a stereo visual, which can be used to render pixmaps for
> > windows with stereo content. The actual rendering is done by using
> > cogl_texture_pixmap_x11_create_right_texture(), which returns a
> > separate texture that renders with the right image.
> 
> I don't really understand why we would need a whole new texture object
> to represent the right eye of a stereoscopic pixmap. Can't we just add
> a cogl_texture_pixmap_x11_new_stereo() function that takes a
> _LEFT/_RIGHT eye enum to effectively say that you want a
> texture-from-pixmap-eye and the normal cogl_texture_pixmap_x11_new()
> is equivalent to selecting the left eye?

The problem is that we ideally would have:

 One Window (not exposed to Cogl)
 One Pixmap (passed to cogl_texture_pixmap_x11_new)
 One Damage object (cogl_texture_pixmap_x11_set_damage_object)
 One GLXPixmap (created internally) 
 Two textures

Deviating from this is not only inefficient, it might not work reliably
- e.g. there's a comment in cogl-winsys-glx.c:

  /* We need to trap errors from glXCreatePixmap because it can
   * sometimes fail during normal usage. For example on NVidia it gets
   * upset if you try to create two GLXPixmaps for the same drawable.
   */

So I don't think the left and right eye textures can just be
independent. The alternative that  comes to mind to what I am doing
is to internally have an object that represents the Pixmap that we store
in a reference-counted hash table hung off the CoglContext and then have
the object that cogl_texture_pixmap_x11_new_[stereo] creates reference
that.

Aside from the complexity there would still be caveats like that you
couldn't call cogl_texture_pixmap_x11_new() and
cogl_texture_pixmap_x11_new_stereo() on the same pixmap because the
latter requires as GLXPixmap created with a stereo fbconfig.

Or you could make that object public, but that gets you into a naming
minefield - its one a TexturePixmap and one a PixmapTexture? :-)

That's why I think this approach may be the right one.

- Owen




More information about the Cogl mailing list