From 6a9e4be7f01935259f4221fa0a58187ec5d095f3 Mon Sep 17 00:00:00 2001 From: Bernd Kuhls Date: Thu, 14 Mar 2024 22:15:57 +0100 Subject: [PATCH] package/mesa3d: rework dri3 handling 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 Signed-off-by: Arnout Vandecappelle (cherry picked from commit e2f87b3c15c100a411d277589ba8de1de564efd4) Signed-off-by: Peter Korsgaard --- package/mesa3d/Config.in | 15 ++------------- package/mesa3d/mesa3d.mk | 4 +--- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/package/mesa3d/Config.in b/package/mesa3d/Config.in index 39a4f706e2..459051b2db 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 @@ -295,7 +286,6 @@ config BR2_PACKAGE_MESA3D_VULKAN_DRIVER_BROADCOM bool "Vulkan broadcom driver" depends on BR2_arm || BR2_aarch64 depends on BR2_TOOLCHAIN_HAS_SYNC_4 # dri3/libxshmfence - select BR2_PACKAGE_MESA3D_DRI3 if BR2_PACKAGE_XORG7 select BR2_PACKAGE_MESA3D_VULKAN_DRIVER help Vulkan broadcom driver. @@ -306,7 +296,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 29c67b77b9..bdb7ea9a6c 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