@@ -56,6 +56,23 @@ config BR2_PACKAGE_MESA3D_OPENCL
select BR2_PACKAGE_LIBCLC
select BR2_PACKAGE_HAS_LIBOPENCL
+# libclc dependencies are satisfied by
+# BR2_PACKAGE_MESA3D_LLVM
+config BR2_PACKAGE_MESA3D_RUSTICL
+ bool "RustiCL (OpenCL) support"
+ depends on BR2_PACKAGE_MESA3D_LLVM
+ depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
+ depends on BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_PANFROST
+ select BR2_PACKAGE_HOST_RUSTC
+ select BR2_PACKAGE_LLVM_RTTI
+ select BR2_PACKAGE_CLANG
+ select BR2_PACKAGE_LLVM_DUMP
+ select BR2_PACKAGE_LIBCLC
+ select BR2_PACKAGE_SPIRV_TOOLS
+ select BR2_PACKAGE_SPIRV_LLVM_TRANSLATOR
+ select BR2_PACKAGE_HAS_LIBOPENCL
+ select BR2_PACKAGE_OPENCL_ICD_LOADER
+
# inform the .mk file of gallium, dri, dri3 or vulkan driver selection
config BR2_PACKAGE_MESA3D_DRI3
bool
@@ -387,7 +404,7 @@ config BR2_PACKAGE_PROVIDES_LIBGLES
default "mesa3d" if BR2_PACKAGE_MESA3D_OPENGL_ES && !BR2_PACKAGE_LIBGLVND
config BR2_PACKAGE_PROVIDES_LIBOPENCL
- default "mesa3d" if BR2_PACKAGE_MESA3D_OPENCL
+ default "mesa3d" if BR2_PACKAGE_MESA3D_OPENCL || BR2_PACKAGE_MESA3D_RUSTICL
endif # BR2_PACKAGE_MESA3D
@@ -58,16 +58,34 @@ else
MESA3D_CONF_OPTS += -Dllvm=disabled
endif
-# Disable opencl-icd: OpenCL lib will be named libOpenCL instead of
# libMesaOpenCL and CL headers are installed
ifeq ($(BR2_PACKAGE_MESA3D_OPENCL),y)
MESA3D_PROVIDES += libopencl
MESA3D_DEPENDENCIES += clang libclc
+ifeq ($(BR2_PACKAGE_OPENCL_ICD_LOADER),y)
+MESA3D_CONF_OPTS += -Dgallium-opencl=icd
+MESA3D_DEPENDENCIES += opencl-icd-loader
+# Disable opencl-icd: OpenCL lib will be named libOpenCL instead of
+else
MESA3D_CONF_OPTS += -Dgallium-opencl=standalone
+endif
else
MESA3D_CONF_OPTS += -Dgallium-opencl=disabled
endif
+# -Drust_std=2021: known meson bug (https://github.com/mesonbuild/meson/issues/10664)
+# By default devices are disabled in rusticl. If you want to enable a device,
+# you need to set the environment variable RUSTICL_ENABLE to the driver you
+# are using
+# ref: https://docs.mesa3d.org/envvars.html#envvar-RUSTICL_ENABLE
+ifeq ($(BR2_PACKAGE_MESA3D_RUSTICL),y)
+MESA3D_PROVIDES += libopencl
+MESA3D_DEPENDENCIES += host-rustc host-rust-bindgen clang libclc opencl-icd-loader spirv-tools spirv-llvm-translator
+MESA3D_CONF_OPTS += -Dgallium-rusticl=true -Drust_std=2021
+else
+MESA3D_CONF_OPTS += -Dgallium-rusticl=false
+endif
+
ifeq ($(BR2_PACKAGE_MESA3D_NEEDS_ELFUTILS),y)
MESA3D_DEPENDENCIES += elfutils
endif