[Cogl] [PATCH 3/7] CoglTexturePixmapX11: add support for stereo content
Robert Bragg
robert at sixbynine.org
Thu Jul 3 18:54:20 PDT 2014
On Wed, Jun 18, 2014 at 8:21 PM, Owen Taylor <owtaylor at gmail.com> wrote:
> 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.
> */
Ok, yeah, that all seems reasonable.
>
> 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.
A nice idea that Neil had that avoids the need for the ref-counted
pixmap registry could be to have a cogl_texture_pixmap_x11_new_right()
that takes a CoglTexturePixmapX11 *left argument whereby you can keep
a reference to the left eye and share as much or as little state from
the left eye tfp as you need.
As a way to make the apis pair up a bit more clearly, I was also
thinking it could make sense to rename
cogl_texture_pixmap_x11_new_stereo() to
cogl_texture_pixmap_x11_new_left().
It looks like this lets us avoid having a new texture object, lets us
share resources and should be fairly straight forward too I think.
--
Robert
>
> - Owen
>
>
More information about the Cogl
mailing list