Bug 95079 - GLX and OpenGL should be separated
Summary: GLX and OpenGL should be separated
Status: RESOLVED DUPLICATE of bug 92877
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: unspecified
Hardware: All All
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-23 09:41 UTC by Cédric Legrand
Modified: 2016-04-25 16:05 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Cédric Legrand 2016-04-23 09:41:19 UTC
The OpenGL and GLX stacks are slightly related. To better support Wayland, they should be separated somehow. IMHO, the changes should follow Nvidia names for compatibility:

libGL.so: seems to be a wrapper around the two APIs
libGLX.so
libOpenGL.so: provides OpenGL functions without GLX dependency.

I know it is a very big task, but we can not depend on GLX to use OpenGL anymore now that Wayland is coming.

I'm sorry if this is a duplicate, I could not find anything on this. Feel free to ask for any information you want.
Comment 1 Tobias Droste 2016-04-23 12:04:55 UTC

*** This bug has been marked as a duplicate of bug 92877 ***
Comment 2 Emil Velikov 2016-04-25 13:56:51 UTC
Cédric there is some fiction in your truth, and some truth in your fiction.

Truth is that for historical reasons libGL.so provides both OpenGL and GLX entry points. The fiction is that separation has nothing to do with Wayland and/or alike. One can use OpenGL even if libGL is not present on the system.
Comment 3 Cédric Legrand 2016-04-25 14:44:24 UTC
I'm sorry if I'm wrong, I don't know a lot of things about OpenGL implementation, but here are the facts:
* Wayland EGL won't create an OpenGL context. All OpenGL functions are NULL when I try, only OpenGL ES is working. From the Wayland FAQ, this is because Linux OpenGL implementation is bound to GLX (https://wayland.freedesktop.org/faq.html#heading_toc_j_12).
* Mesa is only providing a libGL for both APIs
* Nvidia is providing separated libraries with what seems to be a wrapper (I think for the historical reasons you are talking about), as I described in my first post.

I must admit that I don't know if the problem comes from the standards, the implementation or Wayland design, nor why exactly Nvidia did it this way.

By the way, as I see it, having them split would allow package maintainers to provide a version of Mesa without libX11 dependency. At the moment, libX11 is almost required, even on a Wayland/Mir system, but this will become less and less the case over time, until the day both worlds will be totally separated (and maybe X11 considered as deprecated). This day, Mesa maintainers would have to ship two versions of the package: a mesa-gl without GLX, and a mesa-gl-compat with GLX, conflicting each other. With a split, libGL would be either a symlink to libOpenGL or a wrapper around libGLX and libOpenGL.

> One can use OpenGL even if libGL is not present on the system
Seems difficult, isn't actually libGL the OpenGL provider?

As I said, I'm not turned into this, so I may be totally wrong. In this case, I would appreciate to know what I got wrong.

PS: I'm sorry if my English is not perfect, as my name stands I'm a Frenchie...
Comment 4 Emil Velikov 2016-04-25 15:30:48 UTC
(In reply to Cédric Legrand from comment #3)
> I'm sorry if I'm wrong, I don't know a lot of things about OpenGL
> implementation, but here are the facts:
> * Wayland EGL won't create an OpenGL context. All OpenGL functions are NULL
> when I try, only OpenGL ES is working. From the Wayland FAQ, this is because
> Linux OpenGL implementation is bound to GLX
> (https://wayland.freedesktop.org/faq.html#heading_toc_j_12).
You can create OpenGL context with EGL as of version 1.2. The latter was released/specced in 2005... some 11 years ago ;-)

> * Mesa is only providing a libGL for both APIs
> * Nvidia is providing separated libraries with what seems to be a wrapper (I
> think for the historical reasons you are talking about), as I described in
> my first post.
> 
Nvidia is shipping the alpha/beta version of the GLVND "library" (it's a collection of libraries as you can see).

> I must admit that I don't know if the problem comes from the standards, the
> implementation or Wayland design, nor why exactly Nvidia did it this way.
> 
Just google "GLVND XDC". The Nvidia folks have a few presentations on the topic.

> By the way, as I see it, having them split would allow package maintainers
> to provide a version of Mesa without libX11 dependency. At the moment,
> libX11 is almost required, even on a Wayland/Mir system, but this will
> become less and less the case over time, until the day both worlds will be
> totally separated (and maybe X11 considered as deprecated).
Possible deprecation of libX11 and/or alike has nothing to do with using OpenGL.

I would welcome that you familiarise yourself with how mesa is build/packaged. If done properly you can use wayland/mir/foo without anything X related. If you spot that something is stopping you - please open bugs reports. I gladly look into them.

> This day, Mesa
> maintainers would have to ship two versions of the package: a mesa-gl
> without GLX, and a mesa-gl-compat with GLX, conflicting each other. With a
> split, libGL would be either a symlink to libOpenGL or a wrapper around
> libGLX and libOpenGL.
> 
So this is what brought you here. Distro maintainers, have shipped thing in a way that seems awkward/conflicting. I feel your pain... I was there so I had to move away to [a few] custom made packages years ago ;-)

> > One can use OpenGL even if libGL is not present on the system
> Seems difficult, isn't actually libGL the OpenGL provider?
> 
> As I said, I'm not turned into this, so I may be totally wrong. In this
> case, I would appreciate to know what I got wrong.
> 
As said above - EGL can give you a OpenGL context.

> PS: I'm sorry if my English is not perfect, as my name stands I'm a
> Frenchie...
Your English is quite fine. If anything I might have made more mistakes.

TL;DR; It's being looked into. Rewriting ~70% on the mesa side and having to rework dozens of things within upstream GLVND takes some time.
Comment 5 Cédric Legrand 2016-04-25 16:05:40 UTC
(In reply to Emil Velikov from comment #4)
> > I'm sorry if I'm wrong, I don't know a lot of things about OpenGL
> > implementation, but here are the facts:
> > * Wayland EGL won't create an OpenGL context. All OpenGL functions are NULL
> > when I try, only OpenGL ES is working. From the Wayland FAQ, this is because
> > Linux OpenGL implementation is bound to GLX
> > (https://wayland.freedesktop.org/faq.html#heading_toc_j_12).
> You can create OpenGL context with EGL as of version 1.2. The latter was
> released/specced in 2005... some 11 years ago ;-)

That's odd. I have already tried, it did not work in a Wayland context. I just tried again to be sure, it seems to work this time. Maybe a mistake on my side, sorry for the noise...

> > * Mesa is only providing a libGL for both APIs
> > * Nvidia is providing separated libraries with what seems to be a wrapper (I
> > think for the historical reasons you are talking about), as I described in
> > my first post.
> >
> Nvidia is shipping the alpha/beta version of the GLVND "library" (it's a
> collection of libraries as you can see).
> 
> > I must admit that I don't know if the problem comes from the standards, the
> > implementation or Wayland design, nor why exactly Nvidia did it this way.
> >
> Just google "GLVND XDC". The Nvidia folks have a few presentations on the
> topic.

Thanks for the enlightenment. I have already have a look at it but could not find it anymore. It's easier with the right keywords.

> > By the way, as I see it, having them split would allow package maintainers
> > to provide a version of Mesa without libX11 dependency. At the moment,
> > libX11 is almost required, even on a Wayland/Mir system, but this will
> > become less and less the case over time, until the day both worlds will be
> > totally separated (and maybe X11 considered as deprecated).
> > Possible deprecation of libX11 and/or alike has nothing to do with using
> > OpenGL.
> >
> I would welcome that you familiarise yourself with how mesa is
> build/packaged. If done properly you can use wayland/mir/foo without
> anything X related. If you spot that something is stopping you - please open
> bugs reports. I gladly look into them.

Deprecation of libX11 is just speculation, but I think it will be one day or another. In 10 years, maybe, but not tomorrow for sure.

> > This day, Mesa
> > maintainers would have to ship two versions of the package: a mesa-gl
> > without GLX, and a mesa-gl-compat with GLX, conflicting each other. With a
> > split, libGL would be either a symlink to libOpenGL or a wrapper around
> > libGLX and libOpenGL.
> > 
> So this is what brought you here. Distro maintainers, have shipped thing in
> a way that seems awkward/conflicting. I feel your pain... I was there so I
> had to move away to [a few] custom made packages years ago ;-)

Not 'have shipped', still ship. At least on Arch Linux, installing Mesa brings Wayland and libX11, if you don't want one or the other, that's the same. The only way to get rid of these dependencies on such distros is to rebuild Mesa yourself. Looking at the built library reveals that libGL is linked against libX11, making all binary distro suffer from the same problem. This is the reason why I was posting.

> > > One can use OpenGL even if libGL is not present on the system
> > Seems difficult, isn't actually libGL the OpenGL provider?
> > 
> > As I said, I'm not turned into this, so I may be totally wrong. In this
> > case, I would appreciate to know what I got wrong.
> > 
> As said above - EGL can give you a OpenGL context.
> 
> > PS: I'm sorry if my English is not perfect, as my name stands I'm a
> > Frenchie...
> Your English is quite fine. If anything I might have made more mistakes.
> 
> TL;DR; It's being looked into. Rewriting ~70% on the mesa side and having to
> rework dozens of things within upstream GLVND takes some time.

I know Rome was not built in one day, as a developper myself I perfectly understand this problem. This is just that I could not find anything on this topic, but I was missing the right keywords. Thanks to have taken some time to explain all this to me.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.