diff mbox series

[v2,1/1] package/mesa3d: rework dri3 handling

Message ID 20240314211557.20391-1-bernd@kuhls.net
State Accepted
Headers show
Series [v2,1/1] package/mesa3d: rework dri3 handling | expand

Commit Message

Bernd Kuhls March 14, 2024, 9:15 p.m. UTC
From: Bernd Kuhls <bernd.kuhls@t-online.de>

While fixing a build error

../src/egl/drivers/dri2/platform_x11.c: In function 'dri2_x11_get_msc_rate':
../src/egl/drivers/dri2/platform_x11.c:1229:44:
 error: 'struct dri2_egl_display' has no member named 'screen_resources'

with this defconfig:

BR2_x86_64=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_PACKAGE_MESA3D=y
BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_IRIS=y
BR2_PACKAGE_MESA3D_OPENGL_GLX=y
BR2_PACKAGE_MESA3D_OPENGL_EGL=y
BR2_PACKAGE_MESA3D_OPENGL_ES=y
BR2_PACKAGE_XORG7=y

(crocus and i915 drivers are also affected) it turns out that we can
assume the need for dri3 support when X.org is enabled as a hard depen-
dency even if mesa3d's configure does not throw errors when missing,
like for the Intel drivers.

Before this patch these Config.in options were used:

config BR2_PACKAGE_MESA3D_DRI3
  select BR2_PACKAGE_XLIB_LIBXSHMFENCE
select BR2_PACKAGE_MESA3D_DRI3 if BR2_PACKAGE_XORG7

which can be translated into:

select BR2_PACKAGE_XLIB_LIBXSHMFENCE if BR2_PACKAGE_XORG7

and used at option BR2_PACKAGE_MESA3D_DRIVER.

Configure option -Ddri3=enabled is passed to mesa3d when at least one
driver is enabled along with X.org:
ifeq ($(BR2_PACKAGE_MESA3D_DRIVER)$(BR2_PACKAGE_XORG7),yy)

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
v2: rebased

 package/mesa3d/Config.in | 14 ++------------
 package/mesa3d/mesa3d.mk |  4 +---
 2 files changed, 3 insertions(+), 15 deletions(-)

Comments

Arnout Vandecappelle March 15, 2024, 7:30 p.m. UTC | #1
On 14/03/2024 22:15, Bernd Kuhls wrote:
> From: Bernd Kuhls <bernd.kuhls@t-online.de>

  Could you make sure that your From is set the same as your SoB?

> 
> While fixing a build error
> 
> ../src/egl/drivers/dri2/platform_x11.c: In function 'dri2_x11_get_msc_rate':
> ../src/egl/drivers/dri2/platform_x11.c:1229:44:
>   error: 'struct dri2_egl_display' has no member named 'screen_resources'
> 
> with this defconfig:
> 
> BR2_x86_64=y
> BR2_TOOLCHAIN_BUILDROOT_CXX=y
> BR2_PACKAGE_MESA3D=y
> BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_IRIS=y
> BR2_PACKAGE_MESA3D_OPENGL_GLX=y
> BR2_PACKAGE_MESA3D_OPENGL_EGL=y
> BR2_PACKAGE_MESA3D_OPENGL_ES=y
> BR2_PACKAGE_XORG7=y
> 
> (crocus and i915 drivers are also affected) it turns out that we can
> assume the need for dri3 support when X.org is enabled as a hard depen-
> dency even if mesa3d's configure does not throw errors when missing,
> like for the Intel drivers.
> 
> Before this patch these Config.in options were used:
> 
> config BR2_PACKAGE_MESA3D_DRI3
>    select BR2_PACKAGE_XLIB_LIBXSHMFENCE
> select BR2_PACKAGE_MESA3D_DRI3 if BR2_PACKAGE_XORG7

  THere was another select like that in 
BR2_PACKAGE_MESA3D_VULKAN_DRIVER_BROADCOM. I removed that one as well, and 
applied to master, thanks.

  Regards,
  Arnout

> 
> which can be translated into:
> 
> select BR2_PACKAGE_XLIB_LIBXSHMFENCE if BR2_PACKAGE_XORG7
> 
> and used at option BR2_PACKAGE_MESA3D_DRIVER.
> 
> Configure option -Ddri3=enabled is passed to mesa3d when at least one
> driver is enabled along with X.org:
> ifeq ($(BR2_PACKAGE_MESA3D_DRIVER)$(BR2_PACKAGE_XORG7),yy)
> 
> Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
> ---
> v2: rebased
> 
>   package/mesa3d/Config.in | 14 ++------------
>   package/mesa3d/mesa3d.mk |  4 +---
>   2 files changed, 3 insertions(+), 15 deletions(-)
> 
> diff --git a/package/mesa3d/Config.in b/package/mesa3d/Config.in
> index 39a4f706e2..ca7b9c8178 100644
> --- a/package/mesa3d/Config.in
> +++ b/package/mesa3d/Config.in
> @@ -56,11 +56,7 @@ config BR2_PACKAGE_MESA3D_OPENCL
>   	select BR2_PACKAGE_LIBCLC
>   	select BR2_PACKAGE_HAS_LIBOPENCL
>   
> -# inform the .mk file of gallium, dri, dri3 or vulkan driver selection
> -config BR2_PACKAGE_MESA3D_DRI3
> -	bool
> -	select BR2_PACKAGE_XLIB_LIBXSHMFENCE
> -
> +# inform the .mk file of gallium or vulkan driver selection
>   config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
>   	bool
>   	select BR2_PACKAGE_MESA3D_DRIVER
> @@ -71,6 +67,7 @@ config BR2_PACKAGE_MESA3D_VULKAN_DRIVER
>   
>   config BR2_PACKAGE_MESA3D_DRIVER
>   	bool
> +	select BR2_PACKAGE_XLIB_LIBXSHMFENCE if BR2_PACKAGE_XORG7
>   
>   # Gallium xa state tracker.
>   # Quote from mesa3d meson.build: "XA state tracker requires at least
> @@ -103,7 +100,6 @@ config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_CROCUS
>   config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_ETNAVIV
>   	bool "Gallium Etnaviv driver"
>   	depends on (BR2_TOOLCHAIN_HAS_SYNC_4 && !BR2_RISCV_32) || !BR2_PACKAGE_XORG7 # libxshmfence
> -	select BR2_PACKAGE_MESA3D_DRI3 if BR2_PACKAGE_XORG7
>   	select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
>   	select BR2_PACKAGE_LIBDRM_ETNAVIV
>   	help
> @@ -117,7 +113,6 @@ config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_FREEDRENO
>   	# can't see is just spurious. However, that dependency is about
>   	# the toolchain having sync4 primitives, which is always a given
>   	# for arm/aarch64.
> -	select BR2_PACKAGE_MESA3D_DRI3 if BR2_PACKAGE_XORG7
>   	select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
>   	select BR2_PACKAGE_LIBDRM_FREEDRENO
>   	help
> @@ -141,7 +136,6 @@ config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_IRIS
>   config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_LIMA
>   	bool "Gallium lima driver"
>   	depends on (BR2_TOOLCHAIN_HAS_SYNC_4 && !BR2_RISCV_32) || !BR2_PACKAGE_XORG7 # libxshmfence
> -	select BR2_PACKAGE_MESA3D_DRI3 if BR2_PACKAGE_XORG7
>   	select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
>   	help
>   	  Mesa driver for ARM Mali Utgard GPUs.
> @@ -158,7 +152,6 @@ config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_NOUVEAU
>   config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_PANFROST
>   	bool "Gallium panfrost driver"
>   	depends on (BR2_TOOLCHAIN_HAS_SYNC_4 && !BR2_RISCV_32) || !BR2_PACKAGE_XORG7 # libxshmfence
> -	select BR2_PACKAGE_MESA3D_DRI3 if BR2_PACKAGE_XORG7
>   	select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
>   	help
>   	  Mesa driver for ARM Mali Midgard and Bifrost GPUs.
> @@ -239,7 +232,6 @@ config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_V3D
>   	bool "Gallium v3d driver"
>   	depends on (BR2_arm && BR2_ARM_CPU_HAS_NEON) || BR2_aarch64
>   	depends on BR2_TOOLCHAIN_HAS_SYNC_4 || !BR2_PACKAGE_XORG7 # libxshmfence
> -	select BR2_PACKAGE_MESA3D_DRI3 if BR2_PACKAGE_XORG7
>   	select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
>   	select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_VC4 # runtime
>   	select BR2_PACKAGE_MESA3D_OPENGL_EGL
> @@ -255,7 +247,6 @@ config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_VC4
>   	bool "Gallium vc4 driver"
>   	depends on (BR2_arm && BR2_ARM_CPU_HAS_NEON) || BR2_aarch64
>   	depends on BR2_TOOLCHAIN_HAS_SYNC_4 || !BR2_PACKAGE_XORG7 # libxshmfence
> -	select BR2_PACKAGE_MESA3D_DRI3 if BR2_PACKAGE_XORG7
>   	select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
>   	select BR2_PACKAGE_LIBDRM_VC4
>   	select BR2_PACKAGE_MESA3D_OPENGL_EGL
> @@ -306,7 +297,6 @@ config BR2_PACKAGE_MESA3D_VULKAN_DRIVER_INTEL
>   	depends on BR2_TOOLCHAIN_HAS_SYNC_4 || !BR2_PACKAGE_XORG7 # libxshmfence
>   	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_17 # memfd.h
>   	depends on BR2_TOOLCHAIN_USES_GLIBC # ifunc, static_assert
> -	select BR2_PACKAGE_MESA3D_DRI3 if BR2_PACKAGE_XORG7
>   	select BR2_PACKAGE_MESA3D_VULKAN_DRIVER
>   	help
>   	  Vulkan driver for Intel hardware from Ivy Bridge onward.
> diff --git a/package/mesa3d/mesa3d.mk b/package/mesa3d/mesa3d.mk
> index df0079bf80..71929014c8 100644
> --- a/package/mesa3d/mesa3d.mk
> +++ b/package/mesa3d/mesa3d.mk
> @@ -29,11 +29,9 @@ MESA3D_CONF_OPTS = \
>   	-Dgallium-omx=disabled \
>   	-Dpower8=disabled
>   
> -ifeq ($(BR2_PACKAGE_MESA3D_DRI3),y)
> +ifeq ($(BR2_PACKAGE_MESA3D_DRIVER)$(BR2_PACKAGE_XORG7),yy)
>   MESA3D_CONF_OPTS += -Ddri3=enabled
> -ifeq ($(BR2_PACKAGE_XLIB_LIBXSHMFENCE),y)
>   MESA3D_DEPENDENCIES += xlib_libxshmfence
> -endif
>   else
>   MESA3D_CONF_OPTS += -Ddri3=disabled
>   endif
Peter Korsgaard March 21, 2024, 8:49 p.m. UTC | #2
>>>>> "Arnout" == Arnout Vandecappelle via buildroot <buildroot@buildroot.org> writes:

 > On 14/03/2024 22:15, Bernd Kuhls wrote:
 >> From: Bernd Kuhls <bernd.kuhls@t-online.de>

 >  Could you make sure that your From is set the same as your SoB?

 >> While fixing a build error
 >> ../src/egl/drivers/dri2/platform_x11.c: In function
 >> 'dri2_x11_get_msc_rate':
 >> ../src/egl/drivers/dri2/platform_x11.c:1229:44:
 >> error: 'struct dri2_egl_display' has no member named 'screen_resources'
 >> with this defconfig:
 >> BR2_x86_64=y
 >> BR2_TOOLCHAIN_BUILDROOT_CXX=y
 >> BR2_PACKAGE_MESA3D=y
 >> BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_IRIS=y
 >> BR2_PACKAGE_MESA3D_OPENGL_GLX=y
 >> BR2_PACKAGE_MESA3D_OPENGL_EGL=y
 >> BR2_PACKAGE_MESA3D_OPENGL_ES=y
 >> BR2_PACKAGE_XORG7=y
 >> (crocus and i915 drivers are also affected) it turns out that we can
 >> assume the need for dri3 support when X.org is enabled as a hard depen-
 >> dency even if mesa3d's configure does not throw errors when missing,
 >> like for the Intel drivers.
 >> Before this patch these Config.in options were used:
 >> config BR2_PACKAGE_MESA3D_DRI3
 >> select BR2_PACKAGE_XLIB_LIBXSHMFENCE
 >> select BR2_PACKAGE_MESA3D_DRI3 if BR2_PACKAGE_XORG7

 >  THere was another select like that in
 >  BR2_PACKAGE_MESA3D_VULKAN_DRIVER_BROADCOM. I removed that one as
 >  well, and applied to master, thanks.

Committed to 2024.02.x, thanks.
diff mbox series

Patch

diff --git a/package/mesa3d/Config.in b/package/mesa3d/Config.in
index 39a4f706e2..ca7b9c8178 100644
--- a/package/mesa3d/Config.in
+++ b/package/mesa3d/Config.in
@@ -56,11 +56,7 @@  config BR2_PACKAGE_MESA3D_OPENCL
 	select BR2_PACKAGE_LIBCLC
 	select BR2_PACKAGE_HAS_LIBOPENCL
 
-# inform the .mk file of gallium, dri, dri3 or vulkan driver selection
-config BR2_PACKAGE_MESA3D_DRI3
-	bool
-	select BR2_PACKAGE_XLIB_LIBXSHMFENCE
-
+# inform the .mk file of gallium or vulkan driver selection
 config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
 	bool
 	select BR2_PACKAGE_MESA3D_DRIVER
@@ -71,6 +67,7 @@  config BR2_PACKAGE_MESA3D_VULKAN_DRIVER
 
 config BR2_PACKAGE_MESA3D_DRIVER
 	bool
+	select BR2_PACKAGE_XLIB_LIBXSHMFENCE if BR2_PACKAGE_XORG7
 
 # Gallium xa state tracker.
 # Quote from mesa3d meson.build: "XA state tracker requires at least
@@ -103,7 +100,6 @@  config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_CROCUS
 config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_ETNAVIV
 	bool "Gallium Etnaviv driver"
 	depends on (BR2_TOOLCHAIN_HAS_SYNC_4 && !BR2_RISCV_32) || !BR2_PACKAGE_XORG7 # libxshmfence
-	select BR2_PACKAGE_MESA3D_DRI3 if BR2_PACKAGE_XORG7
 	select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
 	select BR2_PACKAGE_LIBDRM_ETNAVIV
 	help
@@ -117,7 +113,6 @@  config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_FREEDRENO
 	# can't see is just spurious. However, that dependency is about
 	# the toolchain having sync4 primitives, which is always a given
 	# for arm/aarch64.
-	select BR2_PACKAGE_MESA3D_DRI3 if BR2_PACKAGE_XORG7
 	select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
 	select BR2_PACKAGE_LIBDRM_FREEDRENO
 	help
@@ -141,7 +136,6 @@  config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_IRIS
 config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_LIMA
 	bool "Gallium lima driver"
 	depends on (BR2_TOOLCHAIN_HAS_SYNC_4 && !BR2_RISCV_32) || !BR2_PACKAGE_XORG7 # libxshmfence
-	select BR2_PACKAGE_MESA3D_DRI3 if BR2_PACKAGE_XORG7
 	select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
 	help
 	  Mesa driver for ARM Mali Utgard GPUs.
@@ -158,7 +152,6 @@  config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_NOUVEAU
 config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_PANFROST
 	bool "Gallium panfrost driver"
 	depends on (BR2_TOOLCHAIN_HAS_SYNC_4 && !BR2_RISCV_32) || !BR2_PACKAGE_XORG7 # libxshmfence
-	select BR2_PACKAGE_MESA3D_DRI3 if BR2_PACKAGE_XORG7
 	select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
 	help
 	  Mesa driver for ARM Mali Midgard and Bifrost GPUs.
@@ -239,7 +232,6 @@  config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_V3D
 	bool "Gallium v3d driver"
 	depends on (BR2_arm && BR2_ARM_CPU_HAS_NEON) || BR2_aarch64
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4 || !BR2_PACKAGE_XORG7 # libxshmfence
-	select BR2_PACKAGE_MESA3D_DRI3 if BR2_PACKAGE_XORG7
 	select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
 	select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_VC4 # runtime
 	select BR2_PACKAGE_MESA3D_OPENGL_EGL
@@ -255,7 +247,6 @@  config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_VC4
 	bool "Gallium vc4 driver"
 	depends on (BR2_arm && BR2_ARM_CPU_HAS_NEON) || BR2_aarch64
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4 || !BR2_PACKAGE_XORG7 # libxshmfence
-	select BR2_PACKAGE_MESA3D_DRI3 if BR2_PACKAGE_XORG7
 	select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
 	select BR2_PACKAGE_LIBDRM_VC4
 	select BR2_PACKAGE_MESA3D_OPENGL_EGL
@@ -306,7 +297,6 @@  config BR2_PACKAGE_MESA3D_VULKAN_DRIVER_INTEL
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4 || !BR2_PACKAGE_XORG7 # libxshmfence
 	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_17 # memfd.h
 	depends on BR2_TOOLCHAIN_USES_GLIBC # ifunc, static_assert
-	select BR2_PACKAGE_MESA3D_DRI3 if BR2_PACKAGE_XORG7
 	select BR2_PACKAGE_MESA3D_VULKAN_DRIVER
 	help
 	  Vulkan driver for Intel hardware from Ivy Bridge onward.
diff --git a/package/mesa3d/mesa3d.mk b/package/mesa3d/mesa3d.mk
index df0079bf80..71929014c8 100644
--- a/package/mesa3d/mesa3d.mk
+++ b/package/mesa3d/mesa3d.mk
@@ -29,11 +29,9 @@  MESA3D_CONF_OPTS = \
 	-Dgallium-omx=disabled \
 	-Dpower8=disabled
 
-ifeq ($(BR2_PACKAGE_MESA3D_DRI3),y)
+ifeq ($(BR2_PACKAGE_MESA3D_DRIVER)$(BR2_PACKAGE_XORG7),yy)
 MESA3D_CONF_OPTS += -Ddri3=enabled
-ifeq ($(BR2_PACKAGE_XLIB_LIBXSHMFENCE),y)
 MESA3D_DEPENDENCIES += xlib_libxshmfence
-endif
 else
 MESA3D_CONF_OPTS += -Ddri3=disabled
 endif