diff mbox series

[v6,07/10] package/mesa3d: add a new option to enable GLX support

Message ID 20190804185417.6562-7-bernd.kuhls@t-online.de
State Superseded
Headers show
Series [v6,01/10] package/python3-mako: new package | expand

Commit Message

Bernd Kuhls Aug. 4, 2019, 6:54 p.m. UTC
From: Romain Naour <romain.naour@smile.fr>

When switching to meson build system, enabling GLX support
require at least one DRI or Gallium dirver.

So add a dependency on BR2_PACKAGE_MESA3D_DRIVER for
BR2_PACKAGE_MESA3D_OPENGL_GLX option.

quoting the meson build system:
"dri based GLX requires at least one DRI driver." [1]
"Even when building just gallium drivers the user probably wants dri." [2]

[1] https://cgit.freedesktop.org/mesa/mesa/tree/meson.build?h=19.0#n340
[2] https://cgit.freedesktop.org/mesa/mesa/tree/meson.build?h=19.0#n266

Signed-off-by: Romain Naour <romain.naour@smile.fr>
[Bernd: moved x11 dependencies from glx condition to xorg7 condition to
 fix build error with enabled egl without glx
 BR2_PACKAGE_HAS_LIBGL needs to depend on BR2_PACKAGE_MESA3D_OPENGL_GLX]

Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
v6: no changes
v5: fixed libgl dependency (Bernd)
v4: fixed EGL build error (Bernd)

 package/mesa3d/Config.in | 16 ++++++++++++++--
 package/mesa3d/mesa3d.mk | 20 ++++++++++----------
 2 files changed, 24 insertions(+), 12 deletions(-)

Comments

Erico Nunes Aug. 10, 2019, 11 p.m. UTC | #1
Hi,

On Sun, Aug 4, 2019 at 8:55 PM Bernd Kuhls <bernd.kuhls@t-online.de> wrote:
>
> From: Romain Naour <romain.naour@smile.fr>
>
> When switching to meson build system, enabling GLX support
> require at least one DRI or Gallium dirver.
>
> So add a dependency on BR2_PACKAGE_MESA3D_DRIVER for
> BR2_PACKAGE_MESA3D_OPENGL_GLX option.
>
> quoting the meson build system:
> "dri based GLX requires at least one DRI driver." [1]
> "Even when building just gallium drivers the user probably wants dri." [2]
>
> [1] https://cgit.freedesktop.org/mesa/mesa/tree/meson.build?h=19.0#n340
> [2] https://cgit.freedesktop.org/mesa/mesa/tree/meson.build?h=19.0#n266
>
> Signed-off-by: Romain Naour <romain.naour@smile.fr>
> [Bernd: moved x11 dependencies from glx condition to xorg7 condition to
>  fix build error with enabled egl without glx
>  BR2_PACKAGE_HAS_LIBGL needs to depend on BR2_PACKAGE_MESA3D_OPENGL_GLX]
>
> Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
I think there is an issue with this patch on v6. If I enable mesa and
xorg, I hit:

package/mesa3d/mesa3d.mk:250: *** Configuration error: both "mesa3d"
and  are selected as providers for virtual package "libgl". Only one
provider can be selected at a time. Please fix your configuration.
Stop.

I can reproduce this with a simple config like:

BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_ENABLE_NEON=y
BR2_ARM_ENABLE_VFP=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_PACKAGE_MESA3D=y
BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_SWRAST=y
BR2_PACKAGE_MESA3D_OPENGL_EGL=y
BR2_PACKAGE_MESA3D_OPENGL_ES=y
BR2_PACKAGE_XORG7=y

Erico
Bernd Kuhls Aug. 11, 2019, 7:12 a.m. UTC | #2
Am Sun, 11 Aug 2019 01:00:33 +0200 schrieb Erico Nunes:

> package/mesa3d/mesa3d.mk:250: *** Configuration error: both "mesa3d"
> and  are selected as providers for virtual package "libgl". Only one
> provider can be selected at a time. Please fix your configuration.
> Stop.
> 
> I can reproduce this with a simple config like:
> 
> BR2_arm=y
> BR2_cortex_a9=y
> BR2_ARM_ENABLE_NEON=y
> BR2_ARM_ENABLE_VFP=y
> BR2_TOOLCHAIN_EXTERNAL=y
> BR2_PACKAGE_MESA3D=y
> BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_SWRAST=y
> BR2_PACKAGE_MESA3D_OPENGL_EGL=y
> BR2_PACKAGE_MESA3D_OPENGL_ES=y
> BR2_PACKAGE_XORG7=y

Hi Enrico,

$ grep LIBGL .config
BR2_PACKAGE_PROVIDES_LIBGLES="mesa3d"
BR2_PACKAGE_HAS_LIBGLES=y
# BR2_PACKAGE_LIBGLIB2 is not set
# BR2_PACKAGE_LIBGLOB is not set

$ grep mesa3d .config
BR2_PACKAGE_PROVIDES_LIBEGL="mesa3d"
BR2_PACKAGE_PROVIDES_LIBGLES="mesa3d"

$ grep PROVIDES .config | grep -v _HOST_
BR2_PACKAGE_PROVIDES_TOOLCHAIN_EXTERNAL="toolchain-external-arm-arm"
BR2_PACKAGE_PROVIDES_SKELETON="skeleton-init-sysv"
BR2_PACKAGE_PROVIDES_LIBEGL="mesa3d"
BR2_PACKAGE_PROVIDES_LIBGLES="mesa3d"
BR2_PACKAGE_PROVIDES_ZLIB="libzlib"

I do not understand why the error occurs, libgl was not selected by any 
package. It seems some core component of buildroot is broken w.r.t. 
detection of virtual packages...

Regards, Bernd
Romain Naour Aug. 11, 2019, 10:02 a.m. UTC | #3
Hi Erico, Bernd, All,

Le 11/08/2019 à 09:12, Bernd Kuhls a écrit :
> Am Sun, 11 Aug 2019 01:00:33 +0200 schrieb Erico Nunes:
> 
>> package/mesa3d/mesa3d.mk:250: *** Configuration error: both "mesa3d"
>> and  are selected as providers for virtual package "libgl". Only one
>> provider can be selected at a time. Please fix your configuration.
>> Stop.
>>
>> I can reproduce this with a simple config like:
>>
>> BR2_arm=y
>> BR2_cortex_a9=y
>> BR2_ARM_ENABLE_NEON=y
>> BR2_ARM_ENABLE_VFP=y
>> BR2_TOOLCHAIN_EXTERNAL=y
>> BR2_PACKAGE_MESA3D=y
>> BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_SWRAST=y
>> BR2_PACKAGE_MESA3D_OPENGL_EGL=y
>> BR2_PACKAGE_MESA3D_OPENGL_ES=y
>> BR2_PACKAGE_XORG7=y
> 
> Hi Enrico,
> 
> $ grep LIBGL .config
> BR2_PACKAGE_PROVIDES_LIBGLES="mesa3d"
> BR2_PACKAGE_HAS_LIBGLES=y
> # BR2_PACKAGE_LIBGLIB2 is not set
> # BR2_PACKAGE_LIBGLOB is not set
> 
> $ grep mesa3d .config
> BR2_PACKAGE_PROVIDES_LIBEGL="mesa3d"
> BR2_PACKAGE_PROVIDES_LIBGLES="mesa3d"
> 
> $ grep PROVIDES .config | grep -v _HOST_
> BR2_PACKAGE_PROVIDES_TOOLCHAIN_EXTERNAL="toolchain-external-arm-arm"
> BR2_PACKAGE_PROVIDES_SKELETON="skeleton-init-sysv"
> BR2_PACKAGE_PROVIDES_LIBEGL="mesa3d"
> BR2_PACKAGE_PROVIDES_LIBGLES="mesa3d"
> BR2_PACKAGE_PROVIDES_ZLIB="libzlib"
> 
> I do not understand why the error occurs, libgl was not selected by any 
> package. It seems some core component of buildroot is broken w.r.t. 
> detection of virtual packages...

Thanks for reporting the issue,

Indeed this patch trigger the issue, I think we need to replace
BR2_PACKAGE_XORG7 by BR2_PACKAGE_MESA3D_OPENGL_GLX before making mesa3d a libgl
provider:

https://git.buildroot.net/buildroot/tree/package/mesa3d/mesa3d.mk#n174

Before this series, enabling xorg package meant enabling the glx support in
mesa3d. So we probably want to replace all BR2_PACKAGE_XORG7 by
BR2_PACKAGE_MESA3D_OPENGL_GLX in mesa3d.mk.

I'm not sure if enabling x11 plateform (MESA3D_PLATFORMS += x11) without GLX
support can work.

Best regards,
Romain

> 
> Regards, Bernd
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>
Bernd Kuhls Aug. 11, 2019, 10:42 a.m. UTC | #4
Am Sun, 11 Aug 2019 12:02:37 +0200 schrieb Romain Naour:

> Indeed this patch trigger the issue, I think we need to replace
> BR2_PACKAGE_XORG7 by BR2_PACKAGE_MESA3D_OPENGL_GLX before making mesa3d
> a libgl provider:
> 
> https://git.buildroot.net/buildroot/tree/package/mesa3d/mesa3d.mk#n174

Hi Romain,

done, sent v7 including bump to 19.1.4 and lima driver:
http://patchwork.ozlabs.org/project/buildroot/list/?series=124414

Regards, Bernd
Romain Naour Aug. 11, 2019, 11:24 a.m. UTC | #5
Hi Bernd,

Le 11/08/2019 à 12:42, Bernd Kuhls a écrit :
> Am Sun, 11 Aug 2019 12:02:37 +0200 schrieb Romain Naour:
> 
>> Indeed this patch trigger the issue, I think we need to replace
>> BR2_PACKAGE_XORG7 by BR2_PACKAGE_MESA3D_OPENGL_GLX before making mesa3d
>> a libgl provider:
>>
>> https://git.buildroot.net/buildroot/tree/package/mesa3d/mesa3d.mk#n174
> 
> Hi Romain,
> 
> done, sent v7 including bump to 19.1.4 and lima driver:
> http://patchwork.ozlabs.org/project/buildroot/list/?series=124414

Actually the Lima driver is not the only new driver in newer mesa3d release.
There is also panfrost driver.

Actually I already theses patches locally but since the mesa package version is
stuck due to autotools -> meson switch I didn't sent theses patches in this series.

Lima and panfrost are Gallium drivers that can be used as kmsro.

Best regards,
Romain

> 
> Regards, Bernd
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>
Erico Nunes Aug. 11, 2019, 12:11 p.m. UTC | #6
On Sun, Aug 11, 2019 at 1:24 PM Romain Naour <romain.naour@gmail.com> wrote:
>
> Hi Bernd,
>
> Le 11/08/2019 à 12:42, Bernd Kuhls a écrit :
> > Am Sun, 11 Aug 2019 12:02:37 +0200 schrieb Romain Naour:
> >
> >> Indeed this patch trigger the issue, I think we need to replace
> >> BR2_PACKAGE_XORG7 by BR2_PACKAGE_MESA3D_OPENGL_GLX before making mesa3d
> >> a libgl provider:
> >>
> >> https://git.buildroot.net/buildroot/tree/package/mesa3d/mesa3d.mk#n174
> >
> > Hi Romain,
> >
> > done, sent v7 including bump to 19.1.4 and lima driver:
> > http://patchwork.ozlabs.org/project/buildroot/list/?series=124414

Thanks for debugging and fixing it.

> Actually the Lima driver is not the only new driver in newer mesa3d release.
> There is also panfrost driver.
>
> Actually I already theses patches locally but since the mesa package version is
> stuck due to autotools -> meson switch I didn't sent theses patches in this series.

Yes, I had an early version of this patchset applied locally for lima
development, as it requires meson. I have been waiting for this to be
merged so we can finally have lima (and panfrost) in Buildroot.

Cheers

Erico
Bernd Kuhls Aug. 11, 2019, 12:59 p.m. UTC | #7
Am Sun, 11 Aug 2019 13:24:34 +0200 schrieb Romain Naour:

> Lima and panfrost are Gallium drivers that can be used as kmsro.

Hi Romain,

sent v8 for the -next branch:
http://patchwork.ozlabs.org/project/buildroot/list/?series=124438

including the panfrost driver and selecting ksmro for lima.

I will prepare a rebased Kodi 18-bump series (not as RFC ;)) soon, maybe 
it can be included in the -next branch to iron out problems until 2019.11?

Regards, Bernd
Bernd Kuhls Aug. 11, 2019, 1:28 p.m. UTC | #8
Am Sun, 11 Aug 2019 14:59:43 +0200 schrieb Bernd Kuhls:

> Am Sun, 11 Aug 2019 13:24:34 +0200 schrieb Romain Naour:
> 
>> Lima and panfrost are Gallium drivers that can be used as kmsro.
> 
> Hi Romain,
> 
> sent v8 for the -next branch:
> http://patchwork.ozlabs.org/project/buildroot/list/?series=124438
> 
> including the panfrost driver and selecting ksmro for lima.
> 
> I will prepare a rebased Kodi 18-bump series (not as RFC ;)) soon, maybe
> it can be included in the -next branch to iron out problems until
> 2019.11?

Hi,

sent v9, mesa glx was broken, reworked x11 dependencies again:
http://patchwork.ozlabs.org/project/buildroot/list/?series=124441

For those of you who would like to test kodi18 you can use this branch
based on buildroot master including mesa3d 19.1 bump v9 and kodi18  
including gbm support: https://github.com/bkuhls/buildroot/tree/kodi18

Regards, Bernd
diff mbox series

Patch

diff --git a/package/mesa3d/Config.in b/package/mesa3d/Config.in
index eba218efb2..6d95fec57f 100644
--- a/package/mesa3d/Config.in
+++ b/package/mesa3d/Config.in
@@ -6,7 +6,7 @@  menuconfig BR2_PACKAGE_MESA3D
 	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
 	select BR2_PACKAGE_LIBDRM
 	select BR2_PACKAGE_EXPAT
-	select BR2_PACKAGE_HAS_LIBGL if BR2_PACKAGE_XORG7
+	select BR2_PACKAGE_HAS_LIBGL if BR2_PACKAGE_MESA3D_OPENGL_GLX
 	select BR2_PACKAGE_WAYLAND_PROTOCOLS if BR2_PACKAGE_WAYLAND
 	select BR2_PACKAGE_XORGPROTO if BR2_PACKAGE_XORG7
 	select BR2_PACKAGE_XLIB_LIBX11 if BR2_PACKAGE_XORG7
@@ -281,6 +281,18 @@  comment "OSMesa classic requires dri (classic) swrast"
 
 if BR2_PACKAGE_MESA3D_DRIVER
 
+comment "OpenGL API Support"
+
+config BR2_PACKAGE_MESA3D_OPENGL_GLX
+	bool "OpenGL GLX"
+	depends on BR2_PACKAGE_XORG7
+	help
+	  Enable GLX graphic acceleration (OpenGL + X11).
+	  GLX support needs X11 and at least one DRI or Gallium driver.
+
+comment "OpenGL GLX support needs X11"
+	depends on !BR2_PACKAGE_XORG7
+
 comment "Additional API Support"
 
 config BR2_PACKAGE_MESA3D_OPENGL_EGL
@@ -301,7 +313,7 @@  config BR2_PACKAGE_MESA3D_OPENGL_ES
 endif # BR2_PACKAGE_MESA3D_DRIVER
 
 config BR2_PACKAGE_PROVIDES_LIBGL
-	default "mesa3d" if BR2_PACKAGE_XORG7
+	default "mesa3d" if BR2_PACKAGE_MESA3D_OPENGL_GLX
 
 config BR2_PACKAGE_PROVIDES_LIBEGL
 	default "mesa3d" if BR2_PACKAGE_MESA3D_OPENGL_EGL
diff --git a/package/mesa3d/mesa3d.mk b/package/mesa3d/mesa3d.mk
index caa38771e6..648a99adfd 100644
--- a/package/mesa3d/mesa3d.mk
+++ b/package/mesa3d/mesa3d.mk
@@ -72,16 +72,7 @@  MESA3D_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -mno-compact-eh"
 MESA3D_CONF_ENV += CXXFLAGS="$(TARGET_CXXFLAGS) -mno-compact-eh"
 endif
 
-ifeq ($(BR2_PACKAGE_XORG7),y)
-MESA3D_DEPENDENCIES += \
-	xlib_libX11 \
-	xlib_libXext \
-	xlib_libXdamage \
-	xlib_libXfixes \
-	xlib_libXrandr \
-	xlib_libXxf86vm \
-	xorgproto \
-	libxcb
+ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_GLX),y)
 MESA3D_CONF_OPTS += --enable-glx --disable-mangling
 ifeq ($(BR2_PACKAGE_MESA3D_NEEDS_XA),y)
 MESA3D_CONF_OPTS += --enable-xa
@@ -196,6 +187,15 @@  MESA3D_DEPENDENCIES += wayland wayland-protocols
 MESA3D_PLATFORMS += wayland
 endif
 ifeq ($(BR2_PACKAGE_XORG7),y)
+MESA3D_DEPENDENCIES += \
+	xlib_libX11 \
+	xlib_libXext \
+	xlib_libXdamage \
+	xlib_libXfixes \
+	xlib_libXrandr \
+	xlib_libXxf86vm \
+	xorgproto \
+	libxcb
 MESA3D_PLATFORMS += x11
 endif