diff options
| -rw-r--r-- | meta/recipes-graphics/mesa/files/0001-intel-Allow-using-intel_clc-from-the-system.patch | 99 | ||||
| -rw-r--r-- | meta/recipes-graphics/mesa/mesa.inc | 15 |
2 files changed, 112 insertions, 2 deletions
diff --git a/meta/recipes-graphics/mesa/files/0001-intel-Allow-using-intel_clc-from-the-system.patch b/meta/recipes-graphics/mesa/files/0001-intel-Allow-using-intel_clc-from-the-system.patch new file mode 100644 index 0000000000..5eefd02068 --- /dev/null +++ b/meta/recipes-graphics/mesa/files/0001-intel-Allow-using-intel_clc-from-the-system.patch | |||
| @@ -0,0 +1,99 @@ | |||
| 1 | From ac503f5d7bf36f021c576029a64ac1a3199f6b5a Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Matt Turner <mattst88@gmail.com> | ||
| 3 | Date: Thu, 31 Aug 2023 13:16:29 -0400 | ||
| 4 | Subject: [PATCH] intel: Allow using intel_clc from the system | ||
| 5 | |||
| 6 | With -Dintel-clc=system, the build system will search for an `intel_clc` | ||
| 7 | binary and use it instead of building `intel_clc` itself. | ||
| 8 | |||
| 9 | This allows Intel Vulkan ray tracing support to be built when cross | ||
| 10 | compiling without terrible hacks (that would otherwise be necessary due | ||
| 11 | to `intel_clc`'s dependence on SPIRV-LLVM-Translator, libclc, clang, and | ||
| 12 | LLVM). | ||
| 13 | |||
| 14 | Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24983> | ||
| 15 | |||
| 16 | Upstream-Status: Backport [https://gitlab.freedesktop.org/mesa/mesa/-/commit/28c1053c07c177854520f6283fa665f17618adb5] | ||
| 17 | |||
| 18 | --- | ||
| 19 | meson.build | 6 +++--- | ||
| 20 | meson_options.txt | 5 ++++- | ||
| 21 | src/intel/compiler/meson.build | 6 +++++- | ||
| 22 | src/intel/vulkan/grl/meson.build | 2 +- | ||
| 23 | 4 files changed, 13 insertions(+), 6 deletions(-) | ||
| 24 | |||
| 25 | diff --git a/meson.build b/meson.build | ||
| 26 | index 16e86ec..00a6953 100644 | ||
| 27 | --- a/meson.build | ||
| 28 | +++ b/meson.build | ||
| 29 | @@ -259,12 +259,12 @@ endif | ||
| 30 | |||
| 31 | with_microsoft_clc = get_option('microsoft-clc').enabled() | ||
| 32 | if ['x86_64'].contains(host_machine.cpu_family()) | ||
| 33 | - with_intel_clc = get_option('intel-clc').enabled() | ||
| 34 | - with_intel_vk_rt = with_intel_vk and with_intel_clc | ||
| 35 | + with_intel_clc = get_option('intel-clc') == 'enabled' | ||
| 36 | else | ||
| 37 | with_intel_clc = false | ||
| 38 | - with_intel_vk_rt = false | ||
| 39 | endif | ||
| 40 | +with_intel_vk_rt = with_intel_vk and get_option('intel-clc') != 'disabled' | ||
| 41 | + | ||
| 42 | with_clc = with_microsoft_clc or with_intel_clc | ||
| 43 | with_libclc = with_clc | ||
| 44 | with_spirv_to_dxil = get_option('spirv-to-dxil') | ||
| 45 | diff --git a/meson_options.txt b/meson_options.txt | ||
| 46 | index 379aea3..9800531 100644 | ||
| 47 | --- a/meson_options.txt | ||
| 48 | +++ b/meson_options.txt | ||
| 49 | @@ -607,9 +607,12 @@ option( | ||
| 50 | |||
| 51 | option( | ||
| 52 | 'intel-clc', | ||
| 53 | - type : 'feature', | ||
| 54 | + type : 'combo', | ||
| 55 | deprecated: {'true': 'enabled', 'false': 'disabled'}, | ||
| 56 | value : 'disabled', | ||
| 57 | + choices : [ | ||
| 58 | + 'enabled', 'disabled', 'system', | ||
| 59 | + ], | ||
| 60 | description : 'Build the intel-clc compiler (enables Vulkan Intel ' + | ||
| 61 | 'Ray Tracing on supported hardware).' | ||
| 62 | ) | ||
| 63 | diff --git a/src/intel/compiler/meson.build b/src/intel/compiler/meson.build | ||
| 64 | index 9a03d37..774e955 100644 | ||
| 65 | --- a/src/intel/compiler/meson.build | ||
| 66 | +++ b/src/intel/compiler/meson.build | ||
| 67 | @@ -168,7 +168,10 @@ libintel_compiler = static_library( | ||
| 68 | ) | ||
| 69 | |||
| 70 | # For now this tool is only going to be used by Anv | ||
| 71 | -if with_intel_clc | ||
| 72 | +if get_option('intel-clc') == 'system' | ||
| 73 | + prog_intel_clc = find_program('intel_clc', native : true) | ||
| 74 | + dep_prog_intel_clc = [] | ||
| 75 | +elif with_intel_clc | ||
| 76 | prog_intel_clc = executable( | ||
| 77 | 'intel_clc', | ||
| 78 | ['intel_clc.c'], | ||
| 79 | @@ -181,6 +184,7 @@ if with_intel_clc | ||
| 80 | dependencies : [idep_nir, idep_clc, idep_mesautil, idep_intel_dev], | ||
| 81 | native : true, | ||
| 82 | ) | ||
| 83 | + dep_prog_intel_clc = [prog_intel_clc] | ||
| 84 | endif | ||
| 85 | |||
| 86 | if with_tests | ||
| 87 | diff --git a/src/intel/vulkan/grl/meson.build b/src/intel/vulkan/grl/meson.build | ||
| 88 | index c0056b3..02a72f5 100644 | ||
| 89 | --- a/src/intel/vulkan/grl/meson.build | ||
| 90 | +++ b/src/intel/vulkan/grl/meson.build | ||
| 91 | @@ -143,7 +143,7 @@ foreach t : [['125', 'gfx125', 'dg2']] | ||
| 92 | # if fixed there | ||
| 93 | ], | ||
| 94 | env: ['MESA_SHADER_CACHE_DISABLE=true'], | ||
| 95 | - depends : [prog_intel_clc] | ||
| 96 | + depends : dep_prog_intel_clc | ||
| 97 | ) | ||
| 98 | endforeach | ||
| 99 | |||
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc index 79a1d975bf..83535eb472 100644 --- a/meta/recipes-graphics/mesa/mesa.inc +++ b/meta/recipes-graphics/mesa/mesa.inc | |||
| @@ -18,6 +18,7 @@ SRC_URI = "https://mesa.freedesktop.org/archive/mesa-${PV}.tar.xz \ | |||
| 18 | file://0001-meson.build-check-for-all-linux-host_os-combinations.patch \ | 18 | file://0001-meson.build-check-for-all-linux-host_os-combinations.patch \ |
| 19 | file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \ | 19 | file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \ |
| 20 | file://0001-gallium-Fix-build-with-llvm-17.patch \ | 20 | file://0001-gallium-Fix-build-with-llvm-17.patch \ |
| 21 | file://0001-intel-Allow-using-intel_clc-from-the-system.patch \ | ||
| 21 | " | 22 | " |
| 22 | 23 | ||
| 23 | SRC_URI[sha256sum] = "2f6d7381bc10fbd2d6263ad1022785b8b511046c1a904162f8f7da18eea8aed9" | 24 | SRC_URI[sha256sum] = "2f6d7381bc10fbd2d6263ad1022785b8b511046c1a904162f8f7da18eea8aed9" |
| @@ -35,6 +36,7 @@ do_install:append() { | |||
| 35 | } | 36 | } |
| 36 | 37 | ||
| 37 | DEPENDS = "expat makedepend-native flex-native bison-native libxml2-native zlib chrpath-replacement-native python3-mako-native gettext-native" | 38 | DEPENDS = "expat makedepend-native flex-native bison-native libxml2-native zlib chrpath-replacement-native python3-mako-native gettext-native" |
| 39 | DEPENDS:append:class-target = " ${@bb.utils.contains('PACKAGECONFIG', 'opencl', 'mesa-native', '', d)}" | ||
| 38 | EXTRANATIVEPATH += "chrpath-native" | 40 | EXTRANATIVEPATH += "chrpath-native" |
| 39 | PROVIDES = " \ | 41 | PROVIDES = " \ |
| 40 | ${@bb.utils.contains('PACKAGECONFIG', 'opengl', 'virtual/libgl', '', d)} \ | 42 | ${@bb.utils.contains('PACKAGECONFIG', 'opengl', 'virtual/libgl', '', d)} \ |
| @@ -72,6 +74,9 @@ EXTRA_OEMESON = " \ | |||
| 72 | -Dplatforms='${@",".join("${PLATFORMS}".split())}' \ | 74 | -Dplatforms='${@",".join("${PLATFORMS}".split())}' \ |
| 73 | " | 75 | " |
| 74 | 76 | ||
| 77 | EXTRA_OEMESON:append:class-target = " ${@bb.utils.contains('PACKAGECONFIG', 'opencl', '-Dintel-clc=system', '', d)}" | ||
| 78 | EXTRA_OEMESON:append:class-native = " ${@bb.utils.contains('PACKAGECONFIG', 'opencl', '-Dintel-clc=enabled', '', d)}" | ||
| 79 | |||
| 75 | def strip_comma(s): | 80 | def strip_comma(s): |
| 76 | return s.strip(',') | 81 | return s.strip(',') |
| 77 | 82 | ||
| @@ -137,7 +142,7 @@ PACKAGECONFIG[egl] = "-Degl=enabled, -Degl=disabled" | |||
| 137 | 142 | ||
| 138 | # "opencl" requires libclc from meta-clang and spirv-tools from OE-Core | 143 | # "opencl" requires libclc from meta-clang and spirv-tools from OE-Core |
| 139 | OPENCL_NATIVE = "${@bb.utils.contains('PACKAGECONFIG', 'freedreno', '-Dopencl-native=true', '', d)}" | 144 | OPENCL_NATIVE = "${@bb.utils.contains('PACKAGECONFIG', 'freedreno', '-Dopencl-native=true', '', d)}" |
| 140 | PACKAGECONFIG[opencl] = "-Dgallium-opencl=icd -Dopencl-spirv=true ${OPENCL_NATIVE},-Dgallium-opencl=disabled -Dopencl-spirv=false,libclc spirv-tools" | 145 | PACKAGECONFIG[opencl] = "-Dgallium-opencl=icd -Dopencl-spirv=true ${OPENCL_NATIVE},-Dgallium-opencl=disabled -Dopencl-spirv=false,libclc spirv-tools python3-ply-native" |
| 141 | 146 | ||
| 142 | PACKAGECONFIG[broadcom] = "" | 147 | PACKAGECONFIG[broadcom] = "" |
| 143 | PACKAGECONFIG[etnaviv] = "" | 148 | PACKAGECONFIG[etnaviv] = "" |
| @@ -181,7 +186,6 @@ PACKAGECONFIG[gallium] = "-Dgallium-drivers=${@strip_comma('${GALLIUMDRIVERS}')} | |||
| 181 | PACKAGECONFIG[gallium-llvm] = "-Dllvm=enabled -Dshared-llvm=enabled, -Dllvm=disabled, llvm llvm-native elfutils" | 186 | PACKAGECONFIG[gallium-llvm] = "-Dllvm=enabled -Dshared-llvm=enabled, -Dllvm=disabled, llvm llvm-native elfutils" |
| 182 | PACKAGECONFIG[xa] = "-Dgallium-xa=enabled, -Dgallium-xa=disabled" | 187 | PACKAGECONFIG[xa] = "-Dgallium-xa=enabled, -Dgallium-xa=disabled" |
| 183 | PACKAGECONFIG[va] = "-Dgallium-va=enabled,-Dgallium-va=disabled,libva-initial" | 188 | PACKAGECONFIG[va] = "-Dgallium-va=enabled,-Dgallium-va=disabled,libva-initial" |
| 184 | |||
| 185 | PACKAGECONFIG[vdpau] = "-Dgallium-vdpau=enabled,-Dgallium-vdpau=disabled,libvdpau" | 189 | PACKAGECONFIG[vdpau] = "-Dgallium-vdpau=enabled,-Dgallium-vdpau=disabled,libvdpau" |
| 186 | 190 | ||
| 187 | PACKAGECONFIG[lima] = "" | 191 | PACKAGECONFIG[lima] = "" |
| @@ -248,6 +252,13 @@ do_install:append () { | |||
| 248 | rm -f ${D}${libdir}/pkgconfig/wayland-egl.pc | 252 | rm -f ${D}${libdir}/pkgconfig/wayland-egl.pc |
| 249 | } | 253 | } |
| 250 | 254 | ||
| 255 | do_install:append:class-native () { | ||
| 256 | if ${@bb.utils.contains('PACKAGECONFIG', 'opencl', 'true', 'false', d)}; then | ||
| 257 | install -d ${D}${bindir} | ||
| 258 | install -m0755 ${B}/src/intel/compiler/intel_clc ${D}${bindir} | ||
| 259 | fi | ||
| 260 | } | ||
| 261 | |||
| 251 | # For the packages that make up the OpenGL interfaces, inject variables so that | 262 | # For the packages that make up the OpenGL interfaces, inject variables so that |
| 252 | # they don't get Debian-renamed (which would remove the -mesa suffix), and | 263 | # they don't get Debian-renamed (which would remove the -mesa suffix), and |
| 253 | # RPROVIDEs/RCONFLICTs on the generic libgl name. | 264 | # RPROVIDEs/RCONFLICTs on the generic libgl name. |
