Skip to contentSkip to conversation

Try to clean up proprietary OpenGL drivers

RFC New Jérôme Pouiller 3 participants 10 messages Jan 21, 2015 – Apr 5, 2015 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

cover Try to clean up proprietary OpenGL drivers

Until now, xorg-xserver depends on mesa3d to compile with GLX/DRI support. However, there was problem with proprietary OpenGL drivers. These ones depends on GLX/DRI support (so, they depends on mesa3d) and overwrite files provided by mesa3d (so, they conflict with mesa3d).

Thanks to opengl-registry, it is possible to change proprietary OpenGL drivers in real LibGL provider and compile GLX/DRI support using proprietary drivers instead of mesa3d.

Notice this series aim to highlight the problem described above. It does not aim to be upstreamed. It apply on top of Yann series about nvidia driver and my series about imx6 gpu driver.

J?r?me Pouiller (4):
nvidia-driver: Add gl.pc
gpu-viv-bin-mx6q: is a libgl provider
opengl-registry: Also provide DRI interface
xorg-server: Depends on libgl to enable DRI/GLX

 package/freescale-imx/gpu-viv-bin-mx6q/Config.in   |    5 +
 package/freescale-imx/gpu-viv-bin-mx6q/gl.pc       |   10 +
 .../gpu-viv-bin-mx6q/gpu-viv-bin-mx6q.mk           |    5 +-
 package/nvidia-driver/gl.pc                        |   11 +
 package/nvidia-driver/nvidia-driver.mk             |    1 +
 .../opengl/khronos-registry/opengl-registry/dri.pc |   11 +
 .../opengl-registry/dri_interface.h                | 1464 ++++++++++++++++++++
 .../opengl-registry/opengl-registry.mk             |    4 +
 package/x11r7/xdriver_xf86-video-imx-viv/Config.in |    2 -
 .../xserver_xorg-server/xserver_xorg-server.mk     |    7 +-
 10 files changed, 1514 insertions(+), 6 deletions(-)
 create mode 100644 package/freescale-imx/gpu-viv-bin-mx6q/gl.pc
 create mode 100644 package/nvidia-driver/gl.pc
 create mode 100644 package/opengl/khronos-registry/opengl-registry/dri.pc
 create mode 100644 package/opengl/khronos-registry/opengl-registry/dri_interface.h
Signature · 1 line
1.9.1
#1 lore raw

RFC 1/4 nvidia-driver: Add gl.pc

In order to compile xserver, libgl provider have to provide gl.pc file.

---
 package/nvidia-driver/gl.pc            | 11 +++++++++++
 package/nvidia-driver/nvidia-driver.mk |  1 +
 2 files changed, 12 insertions(+)
 create mode 100644 package/nvidia-driver/gl.pc
package/nvidia-driver/gl.pc new file +11 -0
new file mode 100644
index 0000000..d822763
@@ -0,0 +1,11 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: gl
+Description: Nvidia OpenGL library
+Version: 10.4.2
+Libs: -L${libdir} -lGL -lm -lXext -lX11 -ldl
+Cflags: -I${includedir}  -DMESA_EGL_NO_X11_HEADERS
+glx_tls: no
package/nvidia-driver/nvidia-driver.mk +1 -0
index 8ebc503..3b8b2ae 100644
@@ -96,6 +96,7 @@ define NVIDIA_DRIVER_INSTALL_STAGING_CMDS
 	$(SED) 's:__GENERATED_BY__:Buildroot:' $(STAGING_DIR)/usr/lib/libGL.la
 	$(SED) 's:__LIBGL_PATH__:/usr/lib:' $(STAGING_DIR)/usr/lib/libGL.la
 	$(SED) 's:-L[^[:space:]]\+::' $(STAGING_DIR)/usr/lib/libGL.la
+	$(INSTALL) -D -m 0644 package/nvidia-driver/gl.pc $(STAGING_DIR)/usr/lib/pkgconfig/gl.pc
 endef
 
 # For target, install libraries and X.org modules
Signature · 1 line
1.9.1
#2 lore raw

RFC 2/4 gpu-viv-bin-mx6q: is a libgl provider

In reply to Jérôme Pouiller

With help of opengl-registry package, we can declare gpu-viv-bin-mx6q as libgl_provider.

---
 package/freescale-imx/gpu-viv-bin-mx6q/Config.in           |  5 +++++
 package/freescale-imx/gpu-viv-bin-mx6q/gl.pc               | 10 ++++++++++
 package/freescale-imx/gpu-viv-bin-mx6q/gpu-viv-bin-mx6q.mk |  5 +++--
 package/x11r7/xdriver_xf86-video-imx-viv/Config.in         |  2 --
 4 files changed, 18 insertions(+), 4 deletions(-)
 create mode 100644 package/freescale-imx/gpu-viv-bin-mx6q/gl.pc
package/freescale-imx/gpu-viv-bin-mx6q/Config.in +5 -0
index 6135d40..2e29865 100644
@@ -4,9 +4,11 @@ comment "gpu-viv-bin-mx6q needs an (e)glibc toolchain"
 
 config BR2_PACKAGE_GPU_VIV_BIN_MX6Q
 	bool "gpu-viv-bin-mx6q"
+	select BR2_PACKAGE_HAS_LIBGL
 	select BR2_PACKAGE_HAS_LIBEGL
 	select BR2_PACKAGE_HAS_LIBGLES
 	select BR2_PACKAGE_HAS_LIBOPENVG
+	select BR2_PACKAGE_OPENGL_REGISTRY
 	depends on BR2_arm # Only relevant for i.MX6
 	# Library binaries are linked against libc.so.6
 	depends on BR2_TOOLCHAIN_USES_GLIBC
@@ -57,6 +59,9 @@ config BR2_PACKAGE_GPU_VIV_BIN_MX6Q_OUTPUT
 	default "dfb" if BR2_PACKAGE_GPU_VIV_BIN_MX6Q_OUTPUT_DIRECTFB
 	default "fb" if BR2_PACKAGE_GPU_VIV_BIN_MX6Q_OUTPUT_FB
 
+config BR2_PACKAGE_PROVIDES_LIBGL
+	default "gpu-viv-bin-mx6q"
+
 config BR2_PACKAGE_PROVIDES_LIBEGL
 	default "gpu-viv-bin-mx6q"
 
package/freescale-imx/gpu-viv-bin-mx6q/gl.pc new file +10 -0
new file mode 100644
index 0000000..1b3c3b8
@@ -0,0 +1,10 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: gl
+Description: Freescale gpu-viv-bin-mx6q implementation of GL
+Version: 9.2.0
+Libs: -L${libdir} -lGAL -lGL
+Cflags: -I${includedir}/
package/freescale-imx/gpu-viv-bin-mx6q/gpu-viv-bin-mx6q.mk +3 -2
index e07e5ca..5d15a39 100644
@@ -19,7 +19,8 @@ GPU_VIV_BIN_MX6Q_LICENSE = Freescale Semiconductor Software License Agreement
 GPU_VIV_BIN_MX6Q_LICENSE_FILES = EULA
 GPU_VIV_BIN_MX6Q_REDISTRIBUTE = NO
 
-GPU_VIV_BIN_MX6Q_PROVIDES = libegl libgles libopenvg
+GPU_VIV_BIN_MX6Q_DEPENDENCIES = opengl-registry
+GPU_VIV_BIN_MX6Q_PROVIDES = libgl libegl libgles libopenvg
 GPU_VIV_BIN_MX6Q_LIB_TARGET = $(call qstrip,$(BR2_PACKAGE_GPU_VIV_BIN_MX6Q_OUTPUT))
 
 define GPU_VIV_BIN_MX6Q_EXTRACT_CMDS
@@ -52,7 +53,7 @@ define GPU_VIV_BIN_MX6Q_INSTALL_STAGING_CMDS
 			#define EGL_API_FB \n\
 			#endif' $(STAGING_DIR)/usr/include/EGL/eglvivante.h; \
 	fi
-	for lib in egl glesv2 vg; do \
+	for lib in egl glesv2 vg gl; do \
 		$(INSTALL) -m 0644 -D \
 			package/freescale-imx/gpu-viv-bin-mx6q/$${lib}.pc \
 			$(STAGING_DIR)/usr/lib/pkgconfig/$${lib}.pc; \
package/x11r7/xdriver_xf86-video-imx-viv/Config.in +0 -2
index 8926a50..79db1c5 100644
@@ -1,8 +1,6 @@
 config BR2_PACKAGE_XDRIVER_XF86_VIDEO_IMX_VIV
 	bool "xf86-video-imx-viv"
 	depends on BR2_PACKAGE_GPU_VIV_BIN_MX6Q_OUTPUT_X11
-	select BR2_PACKAGE_MESA3D # Needed in order to compile xorg with glx/dri
-	select BR2_PACKAGE_MESA3D_DRI_DRIVER
 	select BR2_PACKAGE_LIBDRM
 	select BR2_PACKAGE_XPROTO_XPROTO
 	select BR2_PACKAGE_XPROTO_XF86DRIPROTO
Signature · 1 line
1.9.1
#3 lore raw

RFC 2/4 gpu-viv-bin-mx6q: is a libgl provider

Dear J?r?me Pouiller,

package/freescale-imx/gpu-viv-bin-mx6q/gpu-viv-bin-mx6q.mk GPU_VIV_BIN_MX6Q_LICENSE = Freescale Semiconductor Software License Agreement · line 24

Quoted 4 lines · J?r?me Pouiller
package/freescale-imx/gpu-viv-bin-mx6q/gpu-viv-bin-mx6q.mk +2 -1
-GPU_VIV_BIN_MX6Q_PROVIDES = libegl libgles libopenvg
+GPU_VIV_BIN_MX6Q_DEPENDENCIES = opengl-registry
+GPU_VIV_BIN_MX6Q_PROVIDES = libgl libegl libgles libopenvg
 GPU_VIV_BIN_MX6Q_LIB_TARGET = $(call qstrip,$(BR2_PACKAGE_GPU_VIV_BIN_MX6Q_OUTPUT))

In the end, opengl-registry was never added, we preferred using the mesa3d headers instead, through the mesa3d-headers package.

Can you respin this patch and resend a new version accordingly?

In the mean time, I've marked your patch as Changes Requested in patchwork.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#4 lore raw

RFC 2/4 gpu-viv-bin-mx6q: is a libgl provider

Hello Thomas,

Quoted 12 lines · On Saturday 04 April 2015 18:48:03 Thomas Petazzoni wrote:

Dear J?r?me Pouiller,

package/freescale-imx/gpu-viv-bin-mx6q/gpu-viv-bin-mx6q.mk GPU_VIV_BIN_MX6Q_LICENSE = Freescale Semiconductor Software License Agreement · line 24

Quoted 4 lines · J?r?me Pouiller
package/freescale-imx/gpu-viv-bin-mx6q/gpu-viv-bin-mx6q.mk +2 -1
-GPU_VIV_BIN_MX6Q_PROVIDES = libegl libgles libopenvg
+GPU_VIV_BIN_MX6Q_DEPENDENCIES = opengl-registry
+GPU_VIV_BIN_MX6Q_PROVIDES = libgl libegl libgles libopenvg
 GPU_VIV_BIN_MX6Q_LIB_TARGET = $(call qstrip,$(BR2_PACKAGE_GPU_VIV_BIN_MX6Q_OUTPUT))

In the end, opengl-registry was never added, we preferred using the mesa3d headers instead, through the mesa3d-headers package.

Quoted 1 line

Can you respin this patch and resend a new version accordingly?

This task is in my todo list for some months. I increase its priority.

Signature · 3 lines
J?r?me Pouiller, Sysmic
Embedded Linux specialist
http://www.sysmic.fr
#5 lore raw

RFC 2/4 gpu-viv-bin-mx6q: is a libgl provider

Dear J?r?me Pouiller,

Quoted 2 lines · J?r?me Pouiller
Quoted 1 line

Can you respin this patch and resend a new version accordingly?

This task is in my todo list for some months. I increase its priority.

Great, thanks!

For your patches that haven't been merged yet, do not hesitate to resend them regularly, at least after a new release is made.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#6 lore raw

RFC 3/4 opengl-registry: Also provide DRI interface

In reply to Jérôme Pouiller

xserver need dri_interface.h. This file is normally provided by mesa3d. In order to compiler xserver with another libgl provider, we need to provide this file somewhere. For simplicity, we choose to place it in opengl-registry package even if file does not come from Khronos.

---
 .../opengl/khronos-registry/opengl-registry/dri.pc |   11 +
 .../opengl-registry/dri_interface.h                | 1464 ++++++++++++++++++++
 .../opengl-registry/opengl-registry.mk             |    4 +
 3 files changed, 1479 insertions(+)
 create mode 100644 package/opengl/khronos-registry/opengl-registry/dri.pc
 create mode 100644 package/opengl/khronos-registry/opengl-registry/dri_interface.h
package/opengl/khronos-registry/opengl-registry/dri.pc new file +11 -0
new file mode 100644
index 0000000..6fff498
@@ -0,0 +1,11 @@
+prefix=/usr
+exec_prefix=/usr
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+dridriverdir=${libdir}/dri
+
+Name: dri
+Description: Direct Rendering Infrastructure
+Version: 10.3.2
+Requires.private:
+Cflags: -I${includedir}
package/opengl/khronos-registry/opengl-registry/dri_interface.h new file +1464 -0

1,464 lines not on this page · raw message

package/opengl/khronos-registry/opengl-registry/opengl-registry.mk +4 -0
index 0616789..4e301f1 100644
@@ -76,6 +76,10 @@ OPENGL_REGISTRY_POST_BUILD_HOOKS += OPENGL_REGISTRY_FIX_GLX_H
 define OPENGL_REGISTRY_INSTALL_STAGING_CMDS
 	$(INSTALL) -D -m 0644 package/opengl/khronos-registry/opengl-registry/gl.h \
 		   $(STAGING_DIR)/usr/include/GL/gl.h
+	$(INSTALL) -D -m 0644 package/opengl/khronos-registry/opengl-registry/dri_interface.h \
+		$(STAGING_DIR)/usr/include/GL/internal/dri_interface.h
+	$(INSTALL) -D -m 0644 package/opengl/khronos-registry/opengl-registry/dri.pc \
+		$(STAGING_DIR)/usr/lib/pkgconfig/dri.pc
 	for d in $(OPENGL_REGISTRY_DIRS); do \
 		for h in $(@D)/$${d}/*.h; do \
 			$(INSTALL) -D -m 0644 $${h} $(STAGING_DIR)/usr/include/$${d}/$${h##*/} \
Signature · 1 line
1.9.1
#7 lore raw

RFC 4/4 xorg-server: Depends on libgl to enable DRI/GLX

In reply to Jérôme Pouiller

xorg-server should be able to compile DRI/GLX interface using any libGL provider (not only mesa3d). If a libGL provider break xorg-server DRI/GLX interface, it should be fixed.

---
 package/x11r7/xserver_xorg-server/xserver_xorg-server.mk | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
package/x11r7/xserver_xorg-server/xserver_xorg-server.mk +5 -2
index 5baa515..3240284 100644
@@ -105,9 +105,12 @@ else # modular
 XSERVER_XORG_SERVER_CONF_OPTS += --disable-kdrive --disable-xfbdev
 endif
 
-ifeq ($(BR2_PACKAGE_MESA3D_DRI_DRIVER),y)
+
+ifeq ($(BR2_PACKAGE_HAS_LIBGL),y)
+# Note: --enable-glx use DRI interface (provided by GL/internal/dri_interface.h)
+# in any case. So enable GLX without DRI just fail.
 XSERVER_XORG_SERVER_CONF_OPTS += --enable-dri --enable-glx
-XSERVER_XORG_SERVER_DEPENDENCIES += mesa3d xproto_xf86driproto
+XSERVER_XORG_SERVER_DEPENDENCIES += libgl xproto_xf86driproto
 else
 XSERVER_XORG_SERVER_CONF_OPTS += --disable-dri --disable-glx
 endif
Signature · 1 line
1.9.1
#8 lore raw

cover Try to clean up proprietary OpenGL drivers

In reply to Jérôme Pouiller

J?r?me, All,

On 2015-01-21 12:23 +0100, J?r?me Pouiller spake thusly:

Quoted 13 lines

Until now, xorg-xserver depends on mesa3d to compile with GLX/DRI support. However, there was problem with proprietary OpenGL drivers. These ones depends on GLX/DRI support (so, they depends on mesa3d) and overwrite files provided by mesa3d (so, they conflict with mesa3d).

Thanks to opengl-registry, it is possible to change proprietary OpenGL drivers in real LibGL provider and compile GLX/DRI support using proprietary drivers instead of mesa3d.

Notice this series aim to highlight the problem described above. It does not aim to be upstreamed. It apply on top of Yann series about nvidia driver and my series about imx6 gpu driver.

Quoted 5 lines

J?r?me Pouiller (4):
nvidia-driver: Add gl.pc
gpu-viv-bin-mx6q: is a libgl provider
opengl-registry: Also provide DRI interface
xorg-server: Depends on libgl to enable DRI/GLX

So, I have some comments about this series.

First, I have included your patch to add gl.pc to nvidia-driver. Thanks! :-)

Second, the imx6 stuff does not apply since your series has not yet been applied. I'll leave it to you to cary thos two patches. ;-)

Finally, I am not too fond of bundling the dri header, neither in the OpenGL registry package, nor in any other package.

I know I bundled the gl.h header, but I did so on the assumption that was the only header we'd have to carry. Turns out I was wrong, and we need another header. That's unfortunate. :-(

I would really like to see a proper solution for that, but I have no good idea... :-/

The only I can come up with is to change the mesa3d package to only install those missing headers, and have the registry depend on it. But I do not find this option very nice...

An alternative would be to provide a prompt-less, stripped mesa3d package that woudl install only headers; package that we may call something like mesa3d-headers and that the registry would select. However, I do not find this to be much any more appealing that the alternatives... :-(

I'm open for comments...

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#9 lore raw

cover Try to clean up proprietary OpenGL drivers

J?r?me, All,

On 2015-01-23 11:57 +0100, Yann E. MORIN spake thusly:

Quoted 19 lines

On 2015-01-21 12:23 +0100, J?r?me Pouiller spake thusly:

Quoted 18 lines

Until now, xorg-xserver depends on mesa3d to compile with GLX/DRI support. However, there was problem with proprietary OpenGL drivers. These ones depends on GLX/DRI support (so, they depends on mesa3d) and overwrite files provided by mesa3d (so, they conflict with mesa3d).

Thanks to opengl-registry, it is possible to change proprietary OpenGL drivers in real LibGL provider and compile GLX/DRI support using proprietary drivers instead of mesa3d.

Notice this series aim to highlight the problem described above. It does not aim to be upstreamed. It apply on top of Yann series about nvidia driver and my series about imx6 gpu driver.

J?r?me Pouiller (4):
nvidia-driver: Add gl.pc
gpu-viv-bin-mx6q: is a libgl provider
opengl-registry: Also provide DRI interface
xorg-server: Depends on libgl to enable DRI/GLX

[--SNIP--]

Quoted 2 lines

Finally, I am not too fond of bundling the dri header, neither in the OpenGL registry package, nor in any other package.

[--SNIP--]

Quoted 2 lines

An alternative would be to provide a prompt-less, stripped mesa3d package that woudl install only headers; [...]

So, I've pushed an updated series that does exactly that: add a mesa3d-headers package, which is responsible for providing gl.h (un-bundled from a previous series), dir_interface.h and dri.pc.

Thanks for the input! :-)

Regards,
Yann E. MORIN.

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