package/mesa3d: add missing dependencies for imagination driver

The build of the following basic configuration enabling the
imagination Vulkan driver

BR2_aarch64=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_AARCH64_GLIBC_STABLE=y
BR2_PACKAGE_MESA3D=y
BR2_PACKAGE_MESA3D_VULKAN_DRIVER_IMAGINATION=y

fails with:

meson.build:847:3: ERROR: Feature llvm cannot be disabled: CLC requires LLVM

Adding just LLVM as a dependency is not enough, as then libclc is
needed, then LLVMSPIRVLib, then clangBasic, then the pco_clc tool.

In fact, like the Panfrost driver, building the Imagination driver
requires building host tools using host-mesa3d. To fix this we:

- Make the BR2_PACKAGE_MESA3D_OPENCL option selectable

- Make sure that BR2_PACKAGE_MESA3D_VULKAN_DRIVER_IMAGINATION depends
  on BR2_PACKAGE_MESA3D_LLVM and select
  BR2_PACKAGE_MESA3D_NEEDS_PRECOMP_COMPILER (the latter being needed to
  build host-mesa3d)

- Make sure the host-mesa3d builds imagination
  tools (-Dtools=imagination) and install
  pco_clc (HOST_MESA3D_INSTALL_PCO_CLC). This requires introducing
  HOST_MESA3D_TOOLS as a list of tools to build, which then gets used
  to construct the -Dtools argument, as we can now have both
  "panfrost" and "imagination" in this list.

With all this, the defconfig above builds successfully.

This has been broken since Buildroot commit
5e818c16a3, which introduced the vulkan
driver support.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
Thomas Petazzoni
2025-12-15 22:02:34 +01:00
committed by Julien Olivain
parent b9f030668c
commit e1d159c5d5
2 changed files with 21 additions and 4 deletions

View File

@@ -58,6 +58,7 @@ menuconfig BR2_PACKAGE_MESA3D_OPENCL
BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_RADEONSI || \
BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_IRIS || \
BR2_PACKAGE_MESA3D_VULKAN_DRIVER_INTEL || \
BR2_PACKAGE_MESA3D_VULKAN_DRIVER_IMAGINATION || \
(BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS && \
BR2_PACKAGE_MESA3D_RUSTICL_SUPPORTED_DRIVER)
select BR2_PACKAGE_LLVM_RTTI
@@ -336,10 +337,15 @@ config BR2_PACKAGE_MESA3D_VULKAN_DRIVER_IMAGINATION
bool "Vulkan imagination driver"
depends on BR2_arm || BR2_aarch64
depends on BR2_TOOLCHAIN_HAS_SYNC_4 || !BR2_PACKAGE_XORG7 # libxshmfence
depends on BR2_PACKAGE_MESA3D_LLVM
select BR2_PACKAGE_MESA3D_NEEDS_PRECOMP_COMPILER
select BR2_PACKAGE_MESA3D_VULKAN_DRIVER
help
Vulkan imagination driver.
comment "imagination vulkan needs llvm"
depends on !BR2_PACKAGE_MESA3D_LLVM
config BR2_PACKAGE_MESA3D_VULKAN_DRIVER_INTEL
bool "Vulkan Intel driver"
depends on BR2_TOOLCHAIN_HAS_SYNC_4 || !BR2_PACKAGE_XORG7 # libxshmfence

View File

@@ -284,9 +284,18 @@ else
MESA3D_CONF_OPTS += -Dglvnd=disabled
endif
ifeq ($(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_PANFROST),y)
HOST_MESA3D_TOOLS += panfrost
endif
ifeq ($(BR2_PACKAGE_MESA3D_VULKAN_DRIVER_IMAGINATION),y)
HOST_MESA3D_TOOLS += imagination
endif
HOST_MESA3D_CONF_OPTS = \
-Dglvnd=disabled \
-Dgallium-drivers=$(subst $(space),$(comma),$(HOST_MESA3D_GALLIUM_DRIVERS-y)) \
-Dtools=$(subst $(space),$(comma),$(HOST_MESA3D_TOOLS)) \
-Dinstall-mesa-clc=true \
-Dmesa-clc=enabled \
-Dplatforms= \
@@ -294,10 +303,6 @@ HOST_MESA3D_CONF_OPTS = \
-Dglx=disabled \
-Dvulkan-drivers=""
ifeq ($(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_PANFROST),y)
HOST_MESA3D_CONF_OPTS += -Dtools=panfrost
endif
HOST_MESA3D_DEPENDENCIES = \
host-libclc \
host-libdrm \
@@ -310,10 +315,16 @@ HOST_MESA3D_INSTALL_PANFROST_COMPILE = \
$(INSTALL) -D -m 0755 $(@D)/buildroot-build/src/panfrost/clc/panfrost_compile $(HOST_DIR)/bin/panfrost_compile
endif
ifeq ($(BR2_PACKAGE_MESA3D_VULKAN_DRIVER_IMAGINATION),y)
HOST_MESA3D_INSTALL_PCO_CLC = \
$(INSTALL) -D -m 0755 $(@D)/buildroot-build/src/imagination/pco/uscgen/pco_clc $(HOST_DIR)/bin/pco_clc
endif
define HOST_MESA3D_INSTALL_CMDS
$(INSTALL) -D -m 0755 $(@D)/buildroot-build/src/compiler/clc/mesa_clc $(HOST_DIR)/bin/mesa_clc
$(INSTALL) -D -m 0755 $(@D)/buildroot-build/src/compiler/spirv/vtn_bindgen2 $(HOST_DIR)/bin/vtn_bindgen2
$(HOST_MESA3D_INSTALL_PANFROST_COMPILE)
$(HOST_MESA3D_INSTALL_PCO_CLC)
endef
$(eval $(meson-package))