All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/2 v4] package/libglvnd: introduce the GL vendor-neutral proxy (branch yem/libglvnd)
@ 2020-07-27  8:46 Yann E. MORIN
  2020-07-27  8:47 ` [Buildroot] [PATCH 1/2 v4] package/libglvnd: new package Yann E. MORIN
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Yann E. MORIN @ 2020-07-27  8:46 UTC (permalink / raw)
  To: buildroot

Hello All!

This is a respin from the original series by Jakub, heavily massaged
by me (Yann); thanks Jakub for your initial work! :-) What follows is
Jakub's original cover letter (tweaked to drop the reference to other
patches not include in this respin):

Here comes support for GLVND which is a GL Vendor-Neutral disaptches,
initially proposed by NVidia, currently done within the Freedestop/
RedHat project team as libglvnd.

It's useful not only for NVidia (they were first to adopt it though)
but might be also beneficial for others, for example allowing you to
deliver an image running on multiple machines with different GPUs and
their respective OpenGL providers, which happens quite often on x86_64
and was the major reason to implement it in Buildroot for me.

On the other hand, if your board has multiple GPUs it also helps a lot
- for example when you have a "display" unit and "compute/accel"
graphics units from different vendors. Happens on some ARM boards
recently and there are already efforts to integrate it in these GL
stacks.

The only EXT needed by GL provider is to implement GL_EXT_libglvnd
which is a dummy extension allowing GL lib to "register" to let it
receive GL calls.

In practive it's very simple, the libglvnd delivers its own set of
"dummy" libraries:

  - libGL.so
  - libGLX.so
  - libOpenGL.so
  - libEGL.so

and needs the actual providers to be present as they already are but
with names like libGLX_nvidia.so.

It allows developers to link against vendor-neutral dummy libs and
openGL contexts without thinking about target GPU too much as long as
it supports desired GL/EGL standard.

Also delivers GL API headers (GL/gl.h, GL/egl.h, etc.) so removes need
of mesa3d-headers in GLVND-supported drivers.

Currently it's supported by all Mesa-compatible drivers and NVidia. For
simplicity sake, and to ease introduction of libglvnd, only mesa3d is
converted to be compatible with libglvnd. Other providers, like NVidia,
can be converted (or added!) in follow-up patches.

Changes v3 -> v4:
  - bump to libglvnd 1.3.2


Regards,
Yann E. MORIN.


The following changes since commit 1640b0c1f967e394f87eb7a0ca04ae40aade11b4

  package/mbpfan: new package (2020-07-27 10:13:06 +0200)


are available in the git repository at:

  https://git.busybox.net/~ymorin/git/buildroot

for you to fetch changes up to c48baa11cd0c06ec5af3fd4989306c3ec581d0e9

  package/mesa3d: make it aware of libglvnd and support it when present (2020-07-27 10:45:34 +0200)


----------------------------------------------------------------
Jakub Skrzypnik (2):
      package/libglvnd: new package
      package/mesa3d: make it aware of libglvnd and support it when present

 package/Config.in              |  1 +
 package/libglvnd/Config.in     | 42 +++++++++++++++++++++++++++++++++
 package/libglvnd/libglvnd.hash |  7 ++++++
 package/libglvnd/libglvnd.mk   | 53 ++++++++++++++++++++++++++++++++++++++++++
 package/mesa3d/Config.in       | 15 +++++++-----
 package/mesa3d/mesa3d.mk       | 15 ++++++++----
 6 files changed, 123 insertions(+), 10 deletions(-)
 create mode 100644 package/libglvnd/Config.in
 create mode 100644 package/libglvnd/libglvnd.hash
 create mode 100644 package/libglvnd/libglvnd.mk

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 1/2 v4] package/libglvnd: new package
  2020-07-27  8:46 [Buildroot] [PATCH 0/2 v4] package/libglvnd: introduce the GL vendor-neutral proxy (branch yem/libglvnd) Yann E. MORIN
@ 2020-07-27  8:47 ` Yann E. MORIN
  2020-07-27  8:47 ` [Buildroot] [PATCH 2/2 v4] package/mesa3d: make it aware of libglvnd and support it when present Yann E. MORIN
  2022-01-09 16:50 ` [Buildroot] [PATCH 0/2 v4] package/libglvnd: introduce the GL vendor-neutral proxy (branch yem/libglvnd) Arnout Vandecappelle
  2 siblings, 0 replies; 8+ messages in thread
From: Yann E. MORIN @ 2020-07-27  8:47 UTC (permalink / raw)
  To: buildroot

From: Jakub Skrzypnik <jskrzypnik@novomatic-tech.com>

libglvnd is the GL Vendor-Neutral Dispatch library, used to dispatch
GL calls across multiple GL implementations at runtime.

Full GL support, as usual, requires (parts of) the X11 stack: libX11,
libXext, and xorgproto (for glproto). However, with just libX11, it is
possible to do EGL on X11. EGL and GLES have no dependencies.

Note: x11 and glx are 'features', so need to be 'enabled' or 'disabled'
(or 'auto', but we don't care in Buildroot), while egl and gles1/2 are
'booleans', so need to be 'true' or 'false'.

When an actual provider for GL, EGL, or GLES is enabled, so must the
corresponding flavour be enabled in libglvnd. Conversely, when there is
no actual provider, the corresponding support must be disabled in
libglvnd. So we make each flavour selectable with hidden options, which
actual providers will have to select.

The license for libglvnd itself is a custom license by NVidia. It is
pretty close to MIT, but it's different (although Debian does classify
it as MIT); SPDX has no identifier for that license either. As such, we
choose to just identify it as 'libglvnd license', and let users deal
that with their legal department. Additionally, libglvnd bundles some
code from other projects, so we list them explicitly as well.

Signed-off-by: Jakub Skrzypnik <jskrzypnik@novomatic-tech.com>
[yann.morin.1998 at free.fr:
  - provide help text
  - don't force X11 libraries, split them between X11 and full GL
  - make each flavour selectable
  - fix make check-package issues
  - fix and complete licensing information
  - bump to 1.3.2
  - expand commit log
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
---
 package/Config.in              |  1 +
 package/libglvnd/Config.in     | 42 +++++++++++++++++++++++++++
 package/libglvnd/libglvnd.hash |  7 +++++
 package/libglvnd/libglvnd.mk   | 53 ++++++++++++++++++++++++++++++++++
 4 files changed, 103 insertions(+)
 create mode 100644 package/libglvnd/Config.in
 create mode 100644 package/libglvnd/libglvnd.hash
 create mode 100644 package/libglvnd/libglvnd.mk

diff --git a/package/Config.in b/package/Config.in
index 5c30d27b7a..58e648fadc 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -311,6 +311,7 @@ comment "Graphic libraries"
 	source "package/fbv/Config.in"
 	source "package/freerdp/Config.in"
 	source "package/imagemagick/Config.in"
+	source "package/libglvnd/Config.in"
 	source "package/linux-fusion/Config.in"
 	source "package/lite/Config.in"
 	source "package/mesa3d/Config.in"
diff --git a/package/libglvnd/Config.in b/package/libglvnd/Config.in
new file mode 100644
index 0000000000..680479a19b
--- /dev/null
+++ b/package/libglvnd/Config.in
@@ -0,0 +1,42 @@
+config BR2_PACKAGE_LIBGLVND
+	bool "libglvnd"
+	help
+	  The GL Vendor-Neutral Dispatch library
+
+	  libglvnd is a vendor-neutral dispatch layer for arbitrating
+	  OpenGL API calls between multiple vendors. It allows multiple
+	  drivers from different vendors to coexist on the same
+	  filesystem, and determines which vendor to dispatch each API
+	  call to at runtime.
+
+	  Both GLX and EGL are supported, in any combination with OpenGL
+	  and OpenGL ES.
+
+if BR2_PACKAGE_LIBGLVND
+
+config BR2_PACKAGE_LIBGLVND_DISPATCH_GL
+	bool
+	depends on BR2_PACKAGE_XORG7 # libx11, libXext, xorgproto
+	select BR2_PACKAGE_XLIB_LIBX11
+	select BR2_PACKAGE_XLIB_LIBXEXT
+	select BR2_PACKAGE_XLIB_XORGPROTO
+	select BR2_PACKAGE_HAS_LIBGL
+
+config BR2_PACKAGE_LIBGLVND_DISPATCH_EGL
+	bool
+	select BR2_PACKAGE_HAS_LIBEGL
+
+config BR2_PACKAGE_LIBGLVND_DISPATCH_GLES
+	bool
+	select BR2_PACKAGE_HAS_LIBGLES
+
+config BR2_PACKAGE_PROVIDES_LIBGL
+	default "libglvnd" if BR2_PACKAGE_LIBGLVND_DISPATCH_GL
+
+config BR2_PACKAGE_PROVIDES_LIBEGL
+	default "libglvnd" if BR2_PACKAGE_LIBGLVND_DISPATCH_EGL
+
+config BR2_PACKAGE_PROVIDES_LIBGLES
+	default "libglvnd" if BR2_PACKAGE_LIBGLVND_DISPATCH_GLES
+
+endif
diff --git a/package/libglvnd/libglvnd.hash b/package/libglvnd/libglvnd.hash
new file mode 100644
index 0000000000..15e76ea9e8
--- /dev/null
+++ b/package/libglvnd/libglvnd.hash
@@ -0,0 +1,7 @@
+# Locally computed
+sha256  6332c27f4c792b09a3eb1d7ae18c2d6ff6a0acaf3a746489caf859e659fca2f7  libglvnd-v1.3.2.tar.gz
+
+# Locally computed hashes for license files
+sha256  224534547628a9e5e889d8808385bd38839e6bdb77d89c90ac04dad6891a4f5f  README.md
+sha256  bebdc0fd27cd37af8406e47af23c113866b7856c3f7349ffcbc672029ec8acf7  src/util/uthash/LICENSE
+sha256  f6f207863675ca5a5128fd120b9aef4f4bbab73ffa57e5f771ccffc8e3cc56b7  src/util/cJSON/LICENSE
diff --git a/package/libglvnd/libglvnd.mk b/package/libglvnd/libglvnd.mk
new file mode 100644
index 0000000000..3df609f6eb
--- /dev/null
+++ b/package/libglvnd/libglvnd.mk
@@ -0,0 +1,53 @@
+################################################################################
+#
+# libglvnd
+#
+################################################################################
+
+LIBGLVND_VERSION = 1.3.2
+LIBGLVND_SOURCE = libglvnd-v$(LIBGLVND_VERSION).tar.gz
+LIBGLVND_SITE = https://gitlab.freedesktop.org/glvnd/libglvnd/-/archive/v$(LIBGLVND_VERSION)
+
+LIBGLVND_LICENSE = \
+	libglvnd license, \
+	Apache-2.0 (Khronos headers), \
+	MIT (Xorg; mesa; cJSON), \
+	BSD-1=Clause (uthash)
+
+LIBGLVND_LICENSE_FILES = \
+	README.md \
+	src/util/uthash/LICENSE \
+	src/util/cJSON/LICENSE
+
+LIBGLVND_INSTALL_STAGING = YES
+
+ifeq ($(BR2_PACKAGE_XLIB_LIBX11),y)
+LIBGLVND_DEPENDENCIES += xlib_libX11
+LIBGLVND_CONF_OPTS += -Dx11=enabled
+else
+LIBGLVND_CONF_OPTS += -Dx11=disabled
+endif
+
+ifeq ($(BR2_PACKAGE_LIBGLVND_DISPATCH_GL),y)
+LIBGLVND_DEPENDENCIES += xlib_libXext xorgproto
+LIBGLVND_CONF_OPTS += -Dglx=enabled
+LIBGLVND_PROVIDES += libgl
+else
+LIBGLVND_CONF_OPTS += -Dglx=disabled
+endif
+
+ifeq ($(BR2_PACKAGE_LIBGLVND_DISPATCH_EGL),y)
+LIBGLVND_CONF_OPTS = -Degl=true
+LIBGLVND_PROVIDES += libegl
+else
+LIBGLVND_CONF_OPTS = -Degl=false
+endif
+
+ifeq ($(BR2_PACKAGE_LIBGLVND_DISPATCH_GLES),y)
+LIBGLVND_CONF_OPTS = -Dgles1=true -Dgles2=true
+LIBGLVND_PROVIDES += libgles
+else
+LIBGLVND_CONF_OPTS = -Dgles1=false -Dgles2=false
+endif
+
+$(eval $(meson-package))
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 2/2 v4] package/mesa3d: make it aware of libglvnd and support it when present
  2020-07-27  8:46 [Buildroot] [PATCH 0/2 v4] package/libglvnd: introduce the GL vendor-neutral proxy (branch yem/libglvnd) Yann E. MORIN
  2020-07-27  8:47 ` [Buildroot] [PATCH 1/2 v4] package/libglvnd: new package Yann E. MORIN
@ 2020-07-27  8:47 ` Yann E. MORIN
  2020-07-27 15:38   ` Thomas Petazzoni
  2022-01-09 16:50 ` [Buildroot] [PATCH 0/2 v4] package/libglvnd: introduce the GL vendor-neutral proxy (branch yem/libglvnd) Arnout Vandecappelle
  2 siblings, 1 reply; 8+ messages in thread
From: Yann E. MORIN @ 2020-07-27  8:47 UTC (permalink / raw)
  To: buildroot

From: Jakub Skrzypnik <jskrzypnik@novomatic-tech.com>

When libglvnd is enabled, mesa3d must be told so, so as it installs its
libraries with the vendor suffix (e.g. libEGL_mesa.so instead of
libEGL.so).

Additionally, the provider (in Buildroot parlance) is libglvnd, not mesa3d.

Signed-off-by: Jakub Skrzypnik <jskrzypnik@novomatic-tech.com>
[yann.morin.1998 at free.fr:
  - don't override the _PROVIDES variable, only assign when needed
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
---
 package/mesa3d/Config.in | 15 +++++++++------
 package/mesa3d/mesa3d.mk | 15 +++++++++++----
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/package/mesa3d/Config.in b/package/mesa3d/Config.in
index 11d04b7a3f..5417aeda1a 100644
--- a/package/mesa3d/Config.in
+++ b/package/mesa3d/Config.in
@@ -422,7 +422,8 @@ comment "gbm support needs a dri driver or a gallium driver w/ EGL support."
 config BR2_PACKAGE_MESA3D_OPENGL_GLX
 	bool "OpenGL GLX"
 	depends on BR2_PACKAGE_XORG7
-	select BR2_PACKAGE_HAS_LIBGL
+	select BR2_PACKAGE_HAS_LIBGL if !BR2_PACKAGE_LIBGLVND
+	select BR2_PACKAGE_LIBGLVND_DISPATCH_GL if BR2_PACKAGE_LIBGLVND
 	select BR2_PACKAGE_MESA3D_NEEDS_X11
 	help
 	  Enable GLX graphic acceleration (OpenGL + X11).
@@ -432,7 +433,8 @@ comment "OpenGL GLX support needs X11"
 
 config BR2_PACKAGE_MESA3D_OPENGL_EGL
 	bool "OpenGL EGL"
-	select BR2_PACKAGE_HAS_LIBEGL
+	select BR2_PACKAGE_HAS_LIBEGL if !BR2_PACKAGE_LIBGLVND
+	select BR2_PACKAGE_LIBGLVND_DISPATCH_EGL if BR2_PACKAGE_LIBGLVND
 	select BR2_PACKAGE_HAS_LIBEGL_WAYLAND
 	select BR2_PACKAGE_MESA3D_GBM
 	help
@@ -441,7 +443,8 @@ config BR2_PACKAGE_MESA3D_OPENGL_EGL
 
 config BR2_PACKAGE_MESA3D_OPENGL_ES
 	bool "OpenGL ES"
-	select BR2_PACKAGE_HAS_LIBGLES
+	select BR2_PACKAGE_HAS_LIBGLES if !BR2_PACKAGE_LIBGLVND
+	select BR2_PACKAGE_LIBGLVND_DISPATCH_GLES if BR2_PACKAGE_LIBGLVND
 	help
 	  Use the Khronos OpenGL ES APIs. This is commonly used on
 	  embedded systems and represents a subset of the OpenGL API.
@@ -449,13 +452,13 @@ config BR2_PACKAGE_MESA3D_OPENGL_ES
 endif # BR2_PACKAGE_MESA3D_DRIVER
 
 config BR2_PACKAGE_PROVIDES_LIBGL
-	default "mesa3d" if BR2_PACKAGE_MESA3D_OPENGL_GLX
+	default "mesa3d" if BR2_PACKAGE_MESA3D_OPENGL_GLX && !BR2_PACKAGE_LIBGLVND
 
 config BR2_PACKAGE_PROVIDES_LIBEGL
-	default "mesa3d" if BR2_PACKAGE_MESA3D_OPENGL_EGL
+	default "mesa3d" if BR2_PACKAGE_MESA3D_OPENGL_EGL && !BR2_PACKAGE_LIBGLVND
 
 config BR2_PACKAGE_PROVIDES_LIBGLES
-	default "mesa3d" if BR2_PACKAGE_MESA3D_OPENGL_ES
+	default "mesa3d" if BR2_PACKAGE_MESA3D_OPENGL_ES && !BR2_PACKAGE_LIBGLVND
 
 config BR2_PACKAGE_PROVIDES_LIBOPENCL
 	default "mesa3d" if BR2_PACKAGE_MESA3D_OPENCL
diff --git a/package/mesa3d/mesa3d.mk b/package/mesa3d/mesa3d.mk
index 4a17b2e7a2..d40e6da9c6 100644
--- a/package/mesa3d/mesa3d.mk
+++ b/package/mesa3d/mesa3d.mk
@@ -162,9 +162,9 @@ MESA3D_CONF_OPTS += -Dopengl=true
 # we do not need libva support in mesa3d, therefore disable this option
 MESA3D_CONF_OPTS += -Dgallium-va=false
 
-# libGL is only provided for a full xorg stack
+# libGL is only provided for a full xorg stack, without libglvnd
 ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_GLX),y)
-MESA3D_PROVIDES += libgl
+MESA3D_PROVIDES += $(if $(BR2_PACKAGE_LIBGLVND),,libgl)
 else
 define MESA3D_REMOVE_OPENGL_HEADERS
 	rm -rf $(STAGING_DIR)/usr/include/GL/
@@ -224,7 +224,7 @@ MESA3D_CONF_OPTS += \
 endif
 
 ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_EGL),y)
-MESA3D_PROVIDES += libegl
+MESA3D_PROVIDES += $(if $(BR2_PACKAGE_LIBGLVND),,libegl)
 MESA3D_CONF_OPTS += \
 	-Degl=true
 else
@@ -233,7 +233,7 @@ MESA3D_CONF_OPTS += \
 endif
 
 ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_ES),y)
-MESA3D_PROVIDES += libgles
+MESA3D_PROVIDES += $(if $(BR2_PACKAGE_LIBGLVND),,libgles)
 MESA3D_CONF_OPTS += -Dgles1=true -Dgles2=true
 else
 MESA3D_CONF_OPTS += -Dgles1=false -Dgles2=false
@@ -281,4 +281,11 @@ else
 MESA3D_CONF_OPTS += -Dzstd=false
 endif
 
+ifeq ($(BR2_PACKAGE_LIBGLVND),y)
+MESA3D_DEPENDENCIES += libglvnd
+MESA3D_CONF_OPTS += -Dglvnd=true
+else
+MESA3D_CONF_OPTS += -Dglvnd=false
+endif
+
 $(eval $(meson-package))
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 2/2 v4] package/mesa3d: make it aware of libglvnd and support it when present
  2020-07-27  8:47 ` [Buildroot] [PATCH 2/2 v4] package/mesa3d: make it aware of libglvnd and support it when present Yann E. MORIN
@ 2020-07-27 15:38   ` Thomas Petazzoni
  2020-07-27 17:35     ` Yann E. MORIN
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Petazzoni @ 2020-07-27 15:38 UTC (permalink / raw)
  To: buildroot

On Mon, 27 Jul 2020 10:47:02 +0200
"Yann E. MORIN" <yann.morin.1998@free.fr> wrote:

> From: Jakub Skrzypnik <jskrzypnik@novomatic-tech.com>
> 
> When libglvnd is enabled, mesa3d must be told so, so as it installs its
> libraries with the vendor suffix (e.g. libEGL_mesa.so instead of
> libEGL.so).
> 
> Additionally, the provider (in Buildroot parlance) is libglvnd, not mesa3d.
> 
> Signed-off-by: Jakub Skrzypnik <jskrzypnik@novomatic-tech.com>
> [yann.morin.1998 at free.fr:
>   - don't override the _PROVIDES variable, only assign when needed
> ]
> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
> ---
>  package/mesa3d/Config.in | 15 +++++++++------
>  package/mesa3d/mesa3d.mk | 15 +++++++++++----
>  2 files changed, 20 insertions(+), 10 deletions(-)
> 
> diff --git a/package/mesa3d/Config.in b/package/mesa3d/Config.in
> index 11d04b7a3f..5417aeda1a 100644
> --- a/package/mesa3d/Config.in
> +++ b/package/mesa3d/Config.in
> @@ -422,7 +422,8 @@ comment "gbm support needs a dri driver or a gallium driver w/ EGL support."
>  config BR2_PACKAGE_MESA3D_OPENGL_GLX
>  	bool "OpenGL GLX"
>  	depends on BR2_PACKAGE_XORG7
> -	select BR2_PACKAGE_HAS_LIBGL
> +	select BR2_PACKAGE_HAS_LIBGL if !BR2_PACKAGE_LIBGLVND
> +	select BR2_PACKAGE_LIBGLVND_DISPATCH_GL if BR2_PACKAGE_LIBGLVND

I don't immediately see a good solution for this, but I find that
solution to be quite annoying :-/

Indeed, I understand that once libglvnd is enabled, the GL-provider is
libglvnd, which in the background is using mesa3d. The dance to handle
libglvnd in mesa3d is already not nice, and we would have to have the
same dance in other GL providers that support libglvnd.

OK, here is some vague idea for a possible solution:

 - We introduce an intermediate "layer" between libgl and GL providers.

 - GL provides no longer provide directly libgl, but instead some kind
   of libgl-low, libgl-real (or some better name)

 - libgl is then provided either by libglvnd on top of
   libgl-low/libgl-real, *or* on top of some simple libgl-proxy package
   that does nothing but make libgl depend on libgl-low

I *think* this would perhaps avoid that complexity in mesa3d...
obviously for additional complexity in terms of how the virtual
packages in GL world all work together.

Would this make sense ? Is it over-engineered ?

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 2/2 v4] package/mesa3d: make it aware of libglvnd and support it when present
  2020-07-27 15:38   ` Thomas Petazzoni
@ 2020-07-27 17:35     ` Yann E. MORIN
  2022-01-03 21:20       ` Romain Naour
  0 siblings, 1 reply; 8+ messages in thread
From: Yann E. MORIN @ 2020-07-27 17:35 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2020-07-27 17:38 +0200, Thomas Petazzoni spake thusly:
> On Mon, 27 Jul 2020 10:47:02 +0200
> "Yann E. MORIN" <yann.morin.1998@free.fr> wrote:
> > From: Jakub Skrzypnik <jskrzypnik@novomatic-tech.com>
> > 
> > When libglvnd is enabled, mesa3d must be told so, so as it installs its
> > libraries with the vendor suffix (e.g. libEGL_mesa.so instead of
> > libEGL.so).
> > 
> > Additionally, the provider (in Buildroot parlance) is libglvnd, not mesa3d.
[--SNIP--]
> >  config BR2_PACKAGE_MESA3D_OPENGL_GLX
> >  	bool "OpenGL GLX"
> >  	depends on BR2_PACKAGE_XORG7
> > -	select BR2_PACKAGE_HAS_LIBGL
> > +	select BR2_PACKAGE_HAS_LIBGL if !BR2_PACKAGE_LIBGLVND
> > +	select BR2_PACKAGE_LIBGLVND_DISPATCH_GL if BR2_PACKAGE_LIBGLVND
> 
> I don't immediately see a good solution for this, but I find that
> solution to be quite annoying :-/

At first, I though so too, and I also looked for a better approach,
but...

> Indeed, I understand that once libglvnd is enabled, the GL-provider is
> libglvnd, which in the background is using mesa3d. The dance to handle
> libglvnd in mesa3d is already not nice, and we would have to have the
> same dance in other GL providers that support libglvnd.

Well, it is not _so_ bad. We could maybe make it a bit simpler, with:

    config BR2_PACKAGE_MESA3D_OPENGL_GLX
        bool "OpenGL GLX"
        select BR2_PACKAGE_HAS_LIBGL

We still need to declare emsa3d as providing libgl depending on whether
libglvnd is enabled, but we can make it a bit more "compact":

    if !BR2_PACKAGE_LIBGLVND

    config BR2_PACKAGE_PROVIDES_LIBGL
        default "mesa3d" if BR2_PACKAGE_MESA3D_OPENGL_GLX

    [EGL and GLES too here]

    endif

And in mesa3d.mk too:

    ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_GLX),y)
    MESA3D_PROVIDES += $(if $(BR2_PACKAGE_LIBGLVND),,libgl)
    [...]
    endif

But now, in libglvnd, we don't need any extra symbol, we can just re-use
BR2_PACKAGE_PROVIDES_LIBGL et al.:

    config BR2_PACKAGE_LIBGLVND
        bool "libglvnd"
        select BR2_PACKAGE_XLIB_LIBX11 if BR2_PACKAGE_PROVIDES_LIBGL
        select BR2_PACKAGE_XLIB_LIBXEXT if BR2_PACKAGE_PROVIDES_LIBGL
        select BR2_PACKAGE_XLIB_XORGPROTO if BR2_PACKAGE_PROVIDES_LIBGL
        select BR2_PACKAGE_HAS_LIBGL if BR2_PACKAGE_PROVIDES_LIBGL

    if BR2_PACKAGE_LIBGLVND

    config BR2_PACKAGE_PROVIDES_LIBGL
        default "libglvnd" if BR2_PACKAGE_HAS_LIBGL

    endif

and in libglvnd.mk:

    ifeq ($(BR2_PACKAGE_PROVIDES_LIBGL),y)
    LIBGLVND_DEPENDENCIES += xlib_libXext xorgproto
    LIBGLVND_CONF_OPTS += -Dglx=enabled
    LIBGLVND_PROVIDES += libgl
    else
    LIBGLVND_CONF_OPTS += -Dglx=disabled
    endif

> OK, here is some vague idea for a possible solution:
>  - We introduce an intermediate "layer" between libgl and GL providers.
[--SNIP--]
> I *think* this would perhaps avoid that complexity in mesa3d...
> obviously for additional complexity in terms of how the virtual
> packages in GL world all work together.

You are reinventing libglvnd in between libglvnd and actual providers, no?

Also, remember that individual GL providers will still have to function
as providers without libglvnd, which is not required.

But I would like we progress on the topic, and when we have a second
candidate for libglvnd use, we can revisit the topic and see if we can
over-engineer the thing.

Usually, we wait for three or four cases before trying to solve the
problem in a generic fashion, and so I'd like to do here as well.
Because so far, only two providers are known to work with libglvnd:
mewsa3d and nvidia. ATI might be a third one, but I have no clue about
it. And in the SoC land, there is not much that is libglvnd compatible
so far, if at all.

So, in the short-to-medium term, we'd at best have three providers. Is
that enough to delve into a generic infra so far? Not sure...

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Buildroot] [PATCH 2/2 v4] package/mesa3d: make it aware of libglvnd and support it when present
  2020-07-27 17:35     ` Yann E. MORIN
@ 2022-01-03 21:20       ` Romain Naour
  2022-01-03 21:25         ` Romain Naour
  0 siblings, 1 reply; 8+ messages in thread
From: Romain Naour @ 2022-01-03 21:20 UTC (permalink / raw)
  To: Yann E. MORIN, Thomas Petazzoni; +Cc: Jakub Skrzypnik, buildroot

Hello Yann, Thomas,

Le 27/07/2020 à 19:35, Yann E. MORIN a écrit :
> Thomas, All,
> 
> On 2020-07-27 17:38 +0200, Thomas Petazzoni spake thusly:
>> On Mon, 27 Jul 2020 10:47:02 +0200
>> "Yann E. MORIN" <yann.morin.1998@free.fr> wrote:
>>> From: Jakub Skrzypnik <jskrzypnik@novomatic-tech.com>
>>>
>>> When libglvnd is enabled, mesa3d must be told so, so as it installs its
>>> libraries with the vendor suffix (e.g. libEGL_mesa.so instead of
>>> libEGL.so).
>>>
>>> Additionally, the provider (in Buildroot parlance) is libglvnd, not mesa3d.
> [--SNIP--]
>>>  config BR2_PACKAGE_MESA3D_OPENGL_GLX
>>>  	bool "OpenGL GLX"
>>>  	depends on BR2_PACKAGE_XORG7
>>> -	select BR2_PACKAGE_HAS_LIBGL
>>> +	select BR2_PACKAGE_HAS_LIBGL if !BR2_PACKAGE_LIBGLVND
>>> +	select BR2_PACKAGE_LIBGLVND_DISPATCH_GL if BR2_PACKAGE_LIBGLVND
>>
>> I don't immediately see a good solution for this, but I find that
>> solution to be quite annoying :-/
> 
> At first, I though so too, and I also looked for a better approach,
> but...
> 
>> Indeed, I understand that once libglvnd is enabled, the GL-provider is
>> libglvnd, which in the background is using mesa3d. The dance to handle
>> libglvnd in mesa3d is already not nice, and we would have to have the
>> same dance in other GL providers that support libglvnd.
> 
> Well, it is not _so_ bad. We could maybe make it a bit simpler, with:
> 
>     config BR2_PACKAGE_MESA3D_OPENGL_GLX
>         bool "OpenGL GLX"
>         select BR2_PACKAGE_HAS_LIBGL
> 
> We still need to declare emsa3d as providing libgl depending on whether
> libglvnd is enabled, but we can make it a bit more "compact":
> 
>     if !BR2_PACKAGE_LIBGLVND
> 
>     config BR2_PACKAGE_PROVIDES_LIBGL
>         default "mesa3d" if BR2_PACKAGE_MESA3D_OPENGL_GLX
> 
>     [EGL and GLES too here]
> 
>     endif
> 
> And in mesa3d.mk too:
> 
>     ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_GLX),y)
>     MESA3D_PROVIDES += $(if $(BR2_PACKAGE_LIBGLVND),,libgl)
>     [...]
>     endif
> 
> But now, in libglvnd, we don't need any extra symbol, we can just re-use
> BR2_PACKAGE_PROVIDES_LIBGL et al.:
> 
>     config BR2_PACKAGE_LIBGLVND
>         bool "libglvnd"
>         select BR2_PACKAGE_XLIB_LIBX11 if BR2_PACKAGE_PROVIDES_LIBGL
>         select BR2_PACKAGE_XLIB_LIBXEXT if BR2_PACKAGE_PROVIDES_LIBGL
>         select BR2_PACKAGE_XLIB_XORGPROTO if BR2_PACKAGE_PROVIDES_LIBGL
>         select BR2_PACKAGE_HAS_LIBGL if BR2_PACKAGE_PROVIDES_LIBGL
> 
>     if BR2_PACKAGE_LIBGLVND
> 
>     config BR2_PACKAGE_PROVIDES_LIBGL
>         default "libglvnd" if BR2_PACKAGE_HAS_LIBGL
> 
>     endif
> 
> and in libglvnd.mk:
> 
>     ifeq ($(BR2_PACKAGE_PROVIDES_LIBGL),y)
>     LIBGLVND_DEPENDENCIES += xlib_libXext xorgproto
>     LIBGLVND_CONF_OPTS += -Dglx=enabled
>     LIBGLVND_PROVIDES += libgl
>     else
>     LIBGLVND_CONF_OPTS += -Dglx=disabled
>     endif
> 
>> OK, here is some vague idea for a possible solution:
>>  - We introduce an intermediate "layer" between libgl and GL providers.
> [--SNIP--]
>> I *think* this would perhaps avoid that complexity in mesa3d...
>> obviously for additional complexity in terms of how the virtual
>> packages in GL world all work together.
> 
> You are reinventing libglvnd in between libglvnd and actual providers, no?
> 
> Also, remember that individual GL providers will still have to function
> as providers without libglvnd, which is not required.
> 
> But I would like we progress on the topic, and when we have a second
> candidate for libglvnd use, we can revisit the topic and see if we can
> over-engineer the thing.
> 
> Usually, we wait for three or four cases before trying to solve the
> problem in a generic fashion, and so I'd like to do here as well.
> Because so far, only two providers are known to work with libglvnd:
> mewsa3d and nvidia. ATI might be a third one, but I have no clue about
> it. And in the SoC land, there is not much that is libglvnd compatible
> so far, if at all.
> 
> So, in the short-to-medium term, we'd at best have three providers. Is
> that enough to delve into a generic infra so far? Not sure...

I had an issue with a package (ogre) that now use OPENGL_glx_LIBRARY to find the
"GLVND 'GLX' library"

https://github.com/OGRECave/ogre/commit/aa9ffa7a51e52cb714f1bf5a3a00b9ef9f5a7dc2
https://cmake.org/cmake/help/latest/module/FindOpenGL.html

I guess libglvnd will be required at some point.

Best regards,
Romain


> 
> Regards,
> Yann E. MORIN.
> 

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Buildroot] [PATCH 2/2 v4] package/mesa3d: make it aware of libglvnd and support it when present
  2022-01-03 21:20       ` Romain Naour
@ 2022-01-03 21:25         ` Romain Naour
  0 siblings, 0 replies; 8+ messages in thread
From: Romain Naour @ 2022-01-03 21:25 UTC (permalink / raw)
  To: Yann E. MORIN, Thomas Petazzoni; +Cc: Jakub Skrzypnik, buildroot

Le 03/01/2022 à 22:20, Romain Naour a écrit :
> Hello Yann, Thomas,
> 
> Le 27/07/2020 à 19:35, Yann E. MORIN a écrit :
>> Thomas, All,
>>
>> On 2020-07-27 17:38 +0200, Thomas Petazzoni spake thusly:
>>> On Mon, 27 Jul 2020 10:47:02 +0200
>>> "Yann E. MORIN" <yann.morin.1998@free.fr> wrote:
>>>> From: Jakub Skrzypnik <jskrzypnik@novomatic-tech.com>
>>>>
>>>> When libglvnd is enabled, mesa3d must be told so, so as it installs its
>>>> libraries with the vendor suffix (e.g. libEGL_mesa.so instead of
>>>> libEGL.so).
>>>>
>>>> Additionally, the provider (in Buildroot parlance) is libglvnd, not mesa3d.
>> [--SNIP--]
>>>>  config BR2_PACKAGE_MESA3D_OPENGL_GLX
>>>>  	bool "OpenGL GLX"
>>>>  	depends on BR2_PACKAGE_XORG7
>>>> -	select BR2_PACKAGE_HAS_LIBGL
>>>> +	select BR2_PACKAGE_HAS_LIBGL if !BR2_PACKAGE_LIBGLVND
>>>> +	select BR2_PACKAGE_LIBGLVND_DISPATCH_GL if BR2_PACKAGE_LIBGLVND
>>>
>>> I don't immediately see a good solution for this, but I find that
>>> solution to be quite annoying :-/
>>
>> At first, I though so too, and I also looked for a better approach,
>> but...
>>
>>> Indeed, I understand that once libglvnd is enabled, the GL-provider is
>>> libglvnd, which in the background is using mesa3d. The dance to handle
>>> libglvnd in mesa3d is already not nice, and we would have to have the
>>> same dance in other GL providers that support libglvnd.
>>
>> Well, it is not _so_ bad. We could maybe make it a bit simpler, with:
>>
>>     config BR2_PACKAGE_MESA3D_OPENGL_GLX
>>         bool "OpenGL GLX"
>>         select BR2_PACKAGE_HAS_LIBGL
>>
>> We still need to declare emsa3d as providing libgl depending on whether
>> libglvnd is enabled, but we can make it a bit more "compact":
>>
>>     if !BR2_PACKAGE_LIBGLVND
>>
>>     config BR2_PACKAGE_PROVIDES_LIBGL
>>         default "mesa3d" if BR2_PACKAGE_MESA3D_OPENGL_GLX
>>
>>     [EGL and GLES too here]
>>
>>     endif
>>
>> And in mesa3d.mk too:
>>
>>     ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_GLX),y)
>>     MESA3D_PROVIDES += $(if $(BR2_PACKAGE_LIBGLVND),,libgl)
>>     [...]
>>     endif
>>
>> But now, in libglvnd, we don't need any extra symbol, we can just re-use
>> BR2_PACKAGE_PROVIDES_LIBGL et al.:
>>
>>     config BR2_PACKAGE_LIBGLVND
>>         bool "libglvnd"
>>         select BR2_PACKAGE_XLIB_LIBX11 if BR2_PACKAGE_PROVIDES_LIBGL
>>         select BR2_PACKAGE_XLIB_LIBXEXT if BR2_PACKAGE_PROVIDES_LIBGL
>>         select BR2_PACKAGE_XLIB_XORGPROTO if BR2_PACKAGE_PROVIDES_LIBGL
>>         select BR2_PACKAGE_HAS_LIBGL if BR2_PACKAGE_PROVIDES_LIBGL
>>
>>     if BR2_PACKAGE_LIBGLVND
>>
>>     config BR2_PACKAGE_PROVIDES_LIBGL
>>         default "libglvnd" if BR2_PACKAGE_HAS_LIBGL
>>
>>     endif
>>
>> and in libglvnd.mk:
>>
>>     ifeq ($(BR2_PACKAGE_PROVIDES_LIBGL),y)
>>     LIBGLVND_DEPENDENCIES += xlib_libXext xorgproto
>>     LIBGLVND_CONF_OPTS += -Dglx=enabled
>>     LIBGLVND_PROVIDES += libgl
>>     else
>>     LIBGLVND_CONF_OPTS += -Dglx=disabled
>>     endif
>>
>>> OK, here is some vague idea for a possible solution:
>>>  - We introduce an intermediate "layer" between libgl and GL providers.
>> [--SNIP--]
>>> I *think* this would perhaps avoid that complexity in mesa3d...
>>> obviously for additional complexity in terms of how the virtual
>>> packages in GL world all work together.
>>
>> You are reinventing libglvnd in between libglvnd and actual providers, no?
>>
>> Also, remember that individual GL providers will still have to function
>> as providers without libglvnd, which is not required.
>>
>> But I would like we progress on the topic, and when we have a second
>> candidate for libglvnd use, we can revisit the topic and see if we can
>> over-engineer the thing.
>>
>> Usually, we wait for three or four cases before trying to solve the
>> problem in a generic fashion, and so I'd like to do here as well.
>> Because so far, only two providers are known to work with libglvnd:
>> mewsa3d and nvidia. ATI might be a third one, but I have no clue about
>> it. And in the SoC land, there is not much that is libglvnd compatible
>> so far, if at all.
>>
>> So, in the short-to-medium term, we'd at best have three providers. Is
>> that enough to delve into a generic infra so far? Not sure...
> 
> I had an issue with a package (ogre) that now use OPENGL_glx_LIBRARY to find the
> "GLVND 'GLX' library"
> 
> https://github.com/OGRECave/ogre/commit/aa9ffa7a51e52cb714f1bf5a3a00b9ef9f5a7dc2
> https://cmake.org/cmake/help/latest/module/FindOpenGL.html
> 
> I guess libglvnd will be required at some point.

Actually I did a test using this series as is.

Tested-by: Romain Naour <romain.naour@gmail.com>

Best regards,
Romain


> 
> Best regards,
> Romain
> 
> 
>>
>> Regards,
>> Yann E. MORIN.
>>
> 

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Buildroot] [PATCH 0/2 v4] package/libglvnd: introduce the GL vendor-neutral proxy (branch yem/libglvnd)
  2020-07-27  8:46 [Buildroot] [PATCH 0/2 v4] package/libglvnd: introduce the GL vendor-neutral proxy (branch yem/libglvnd) Yann E. MORIN
  2020-07-27  8:47 ` [Buildroot] [PATCH 1/2 v4] package/libglvnd: new package Yann E. MORIN
  2020-07-27  8:47 ` [Buildroot] [PATCH 2/2 v4] package/mesa3d: make it aware of libglvnd and support it when present Yann E. MORIN
@ 2022-01-09 16:50 ` Arnout Vandecappelle
  2 siblings, 0 replies; 8+ messages in thread
From: Arnout Vandecappelle @ 2022-01-09 16:50 UTC (permalink / raw)
  To: Yann E. MORIN, buildroot; +Cc: Jakub Skrzypnik



On 27/07/2020 10:46, Yann E. MORIN wrote:
> Hello All!
> 
> This is a respin from the original series by Jakub, heavily massaged
> by me (Yann); thanks Jakub for your initial work! :-) What follows is
> Jakub's original cover letter (tweaked to drop the reference to other
> patches not include in this respin):
> 
> Here comes support for GLVND which is a GL Vendor-Neutral disaptches,
> initially proposed by NVidia, currently done within the Freedestop/
> RedHat project team as libglvnd.
> 
> It's useful not only for NVidia (they were first to adopt it though)
> but might be also beneficial for others, for example allowing you to
> deliver an image running on multiple machines with different GPUs and
> their respective OpenGL providers, which happens quite often on x86_64
> and was the major reason to implement it in Buildroot for me.
> 
> On the other hand, if your board has multiple GPUs it also helps a lot
> - for example when you have a "display" unit and "compute/accel"
> graphics units from different vendors. Happens on some ARM boards
> recently and there are already efforts to integrate it in these GL
> stacks.
> 
> The only EXT needed by GL provider is to implement GL_EXT_libglvnd
> which is a dummy extension allowing GL lib to "register" to let it
> receive GL calls.
> 
> In practive it's very simple, the libglvnd delivers its own set of
> "dummy" libraries:
> 
>    - libGL.so
>    - libGLX.so
>    - libOpenGL.so
>    - libEGL.so
> 
> and needs the actual providers to be present as they already are but
> with names like libGLX_nvidia.so.
> 
> It allows developers to link against vendor-neutral dummy libs and
> openGL contexts without thinking about target GPU too much as long as
> it supports desired GL/EGL standard.
> 
> Also delivers GL API headers (GL/gl.h, GL/egl.h, etc.) so removes need
> of mesa3d-headers in GLVND-supported drivers.
> 
> Currently it's supported by all Mesa-compatible drivers and NVidia. For
> simplicity sake, and to ease introduction of libglvnd, only mesa3d is
> converted to be compatible with libglvnd. Other providers, like NVidia,
> can be converted (or added!) in follow-up patches.
> 
> Changes v3 -> v4:
>    - bump to libglvnd 1.3.2
> 
> 
> Regards,
> Yann E. MORIN.
> 
> 
> The following changes since commit 1640b0c1f967e394f87eb7a0ca04ae40aade11b4
> 
>    package/mbpfan: new package (2020-07-27 10:13:06 +0200)
> 
> 
> are available in the git repository at:
> 
>    https://git.busybox.net/~ymorin/git/buildroot
> 
> for you to fetch changes up to c48baa11cd0c06ec5af3fd4989306c3ec581d0e9
> 
>    package/mesa3d: make it aware of libglvnd and support it when present (2020-07-27 10:45:34 +0200)
> 
> 
> ----------------------------------------------------------------
> Jakub Skrzypnik (2):
>        package/libglvnd: new package
>        package/mesa3d: make it aware of libglvnd and support it when present

  Series (finally) applied to master, thanks.

  Jakub, I also added you to DEVELOPERS for the package.

  Regards,
  Arnout

> 
>   package/Config.in              |  1 +
>   package/libglvnd/Config.in     | 42 +++++++++++++++++++++++++++++++++
>   package/libglvnd/libglvnd.hash |  7 ++++++
>   package/libglvnd/libglvnd.mk   | 53 ++++++++++++++++++++++++++++++++++++++++++
>   package/mesa3d/Config.in       | 15 +++++++-----
>   package/mesa3d/mesa3d.mk       | 15 ++++++++----
>   6 files changed, 123 insertions(+), 10 deletions(-)
>   create mode 100644 package/libglvnd/Config.in
>   create mode 100644 package/libglvnd/libglvnd.hash
>   create mode 100644 package/libglvnd/libglvnd.mk
> 
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-01-09 16:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-27  8:46 [Buildroot] [PATCH 0/2 v4] package/libglvnd: introduce the GL vendor-neutral proxy (branch yem/libglvnd) Yann E. MORIN
2020-07-27  8:47 ` [Buildroot] [PATCH 1/2 v4] package/libglvnd: new package Yann E. MORIN
2020-07-27  8:47 ` [Buildroot] [PATCH 2/2 v4] package/mesa3d: make it aware of libglvnd and support it when present Yann E. MORIN
2020-07-27 15:38   ` Thomas Petazzoni
2020-07-27 17:35     ` Yann E. MORIN
2022-01-03 21:20       ` Romain Naour
2022-01-03 21:25         ` Romain Naour
2022-01-09 16:50 ` [Buildroot] [PATCH 0/2 v4] package/libglvnd: introduce the GL vendor-neutral proxy (branch yem/libglvnd) Arnout Vandecappelle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.