summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-graphics/mesa')
-rw-r--r--meta/recipes-graphics/mesa/files/0004-Revert-mesa-Enable-asm-unconditionally-now-that-gen_.patch147
-rw-r--r--meta/recipes-graphics/mesa/mesa.inc4
2 files changed, 0 insertions, 151 deletions
diff --git a/meta/recipes-graphics/mesa/files/0004-Revert-mesa-Enable-asm-unconditionally-now-that-gen_.patch b/meta/recipes-graphics/mesa/files/0004-Revert-mesa-Enable-asm-unconditionally-now-that-gen_.patch
deleted file mode 100644
index 833742359f..0000000000
--- a/meta/recipes-graphics/mesa/files/0004-Revert-mesa-Enable-asm-unconditionally-now-that-gen_.patch
+++ /dev/null
@@ -1,147 +0,0 @@
1From 43d9e40db7357f27e91002b2bb7688b6775ebb43 Mon Sep 17 00:00:00 2001
2From: Alistair Francis <alistair@alistair23.me>
3Date: Thu, 14 Nov 2019 09:06:02 -0800
4Subject: [PATCH] Revert "mesa: Enable asm unconditionally, now that
5 gen_matypes is gone."
6
7This reverts commit 20294dceebc23236e33b22578245f7e6f41b6997.
8
9Upstream-Status: Inappropriate [configuration]
10Signed-off-by: Alistair Francis <alistair@alistair23.me>
11
12---
13 meson.build | 94 ++++++++++++++++++++++++++++++-----------------
14 meson_options.txt | 6 +++
15 2 files changed, 67 insertions(+), 33 deletions(-)
16
17diff --git a/meson.build b/meson.build
18index e7dc599..e2fc934 100644
19--- a/meson.build
20+++ b/meson.build
21@@ -52,6 +52,7 @@ pre_args = [
22 with_vulkan_icd_dir = get_option('vulkan-icd-dir')
23 with_tests = get_option('build-tests')
24 with_aco_tests = get_option('build-aco-tests')
25+with_asm = get_option('asm')
26 with_glx_read_only_text = get_option('glx-read-only-text')
27 with_glx_direct = get_option('glx-direct')
28 with_osmesa = get_option('osmesa')
29@@ -1154,41 +1155,68 @@ dep_ws2_32 = cc.find_library('ws2_32', required : with_platform_windows)
30
31 # TODO: shared/static? Is this even worth doing?
32
33+# When cross compiling we generally need to turn off the use of assembly,
34+# because mesa's assembly relies on building an executable for the host system,
35+# and running it to get information about struct sizes. There is at least one
36+# case of cross compiling where we can use asm, and that's x86_64 -> x86 when
37+# host OS == build OS, since in that case the build machine can run the host's
38+# binaries.
39+if with_asm and meson.is_cross_build()
40+ if build_machine.system() != host_machine.system()
41+ # TODO: It may be possible to do this with an exe_wrapper (like wine).
42+ message('Cross compiling from one OS to another, disabling assembly.')
43+ with_asm = false
44+ elif not (build_machine.cpu_family().startswith('x86') and host_machine.cpu_family() == 'x86')
45+ # FIXME: Gentoo always sets -m32 for x86_64 -> x86 builds, resulting in an
46+ # x86 -> x86 cross compile. We use startswith rather than == to handle this
47+ # case.
48+ # TODO: There may be other cases where the 64 bit version of the
49+ # architecture can run 32 bit binaries (aarch64 and armv7 for example)
50+ message('''
51+ Cross compiling to different architectures, and the host cannot run
52+ the build machine's binaries. Disabling assembly.
53+ ''')
54+ with_asm = false
55+ endif
56+endif
57+
58 with_asm_arch = ''
59-if host_machine.cpu_family() == 'x86'
60- if system_has_kms_drm or host_machine.system() == 'gnu'
61- with_asm_arch = 'x86'
62- pre_args += ['-DUSE_X86_ASM', '-DUSE_MMX_ASM', '-DUSE_3DNOW_ASM',
63- '-DUSE_SSE_ASM']
64-
65- if with_glx_read_only_text
66- pre_args += ['-DGLX_X86_READONLY_TEXT']
67+if with_asm
68+ if host_machine.cpu_family() == 'x86'
69+ if system_has_kms_drm or host_machine.system() == 'gnu'
70+ with_asm_arch = 'x86'
71+ pre_args += ['-DUSE_X86_ASM', '-DUSE_MMX_ASM', '-DUSE_3DNOW_ASM',
72+ '-DUSE_SSE_ASM']
73+
74+ if with_glx_read_only_text
75+ pre_args += ['-DGLX_X86_READONLY_TEXT']
76+ endif
77+ endif
78+ elif host_machine.cpu_family() == 'x86_64'
79+ if system_has_kms_drm
80+ with_asm_arch = 'x86_64'
81+ pre_args += ['-DUSE_X86_64_ASM']
82+ endif
83+ elif host_machine.cpu_family() == 'arm'
84+ if system_has_kms_drm
85+ with_asm_arch = 'arm'
86+ pre_args += ['-DUSE_ARM_ASM']
87+ endif
88+ elif host_machine.cpu_family() == 'aarch64'
89+ if system_has_kms_drm
90+ with_asm_arch = 'aarch64'
91+ pre_args += ['-DUSE_AARCH64_ASM']
92+ endif
93+ elif host_machine.cpu_family() == 'sparc64'
94+ if system_has_kms_drm
95+ with_asm_arch = 'sparc'
96+ pre_args += ['-DUSE_SPARC_ASM']
97+ endif
98+ elif host_machine.cpu_family().startswith('ppc64') and host_machine.endian() == 'little'
99+ if system_has_kms_drm
100+ with_asm_arch = 'ppc64le'
101+ pre_args += ['-DUSE_PPC64LE_ASM']
102 endif
103- endif
104-elif host_machine.cpu_family() == 'x86_64'
105- if system_has_kms_drm
106- with_asm_arch = 'x86_64'
107- pre_args += ['-DUSE_X86_64_ASM']
108- endif
109-elif host_machine.cpu_family() == 'arm'
110- if system_has_kms_drm
111- with_asm_arch = 'arm'
112- pre_args += ['-DUSE_ARM_ASM']
113- endif
114-elif host_machine.cpu_family() == 'aarch64'
115- if system_has_kms_drm
116- with_asm_arch = 'aarch64'
117- pre_args += ['-DUSE_AARCH64_ASM']
118- endif
119-elif host_machine.cpu_family() == 'sparc64'
120- if system_has_kms_drm
121- with_asm_arch = 'sparc'
122- pre_args += ['-DUSE_SPARC_ASM']
123- endif
124-elif host_machine.cpu_family().startswith('ppc64') and host_machine.endian() == 'little'
125- if system_has_kms_drm
126- with_asm_arch = 'ppc64le'
127- pre_args += ['-DUSE_PPC64LE_ASM']
128 endif
129 endif
130
131diff --git a/meson_options.txt b/meson_options.txt
132index 147cccb..562b059 100644
133--- a/meson_options.txt
134+++ b/meson_options.txt
135@@ -254,6 +254,12 @@ option(
136 value : false,
137 description : 'Enable GLVND support.'
138 )
139+option(
140+ 'asm',
141+ type : 'boolean',
142+ value : true,
143+ description : 'Build assembly code if possible'
144+)
145 option(
146 'glx-read-only-text',
147 type : 'boolean',
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index 7956d95fc1..dba23f586f 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -17,7 +17,6 @@ PE = "2"
17SRC_URI = "https://mesa.freedesktop.org/archive/mesa-${PV}.tar.xz \ 17SRC_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://0002-meson.build-make-TLS-ELF-optional.patch \ 19 file://0002-meson.build-make-TLS-ELF-optional.patch \
20 file://0004-Revert-mesa-Enable-asm-unconditionally-now-that-gen_.patch \
21 file://0005-vc4-use-intmax_t-for-formatted-output-of-timespec-me.patch \ 20 file://0005-vc4-use-intmax_t-for-formatted-output-of-timespec-me.patch \
22 file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \ 21 file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \
23 file://0001-futex.h-Define-__NR_futex-if-it-does-not-exist.patch \ 22 file://0001-futex.h-Define-__NR_futex-if-it-does-not-exist.patch \
@@ -178,9 +177,6 @@ PACKAGECONFIG[osmesa] = "-Dosmesa=${OSMESA},-Dosmesa=none"
178 177
179PACKAGECONFIG[unwind] = "-Dlibunwind=true,-Dlibunwind=false,libunwind" 178PACKAGECONFIG[unwind] = "-Dlibunwind=true,-Dlibunwind=false,libunwind"
180 179
181# mesa tries to run cross-built gen_matypes on build machine to get struct size information
182EXTRA_OEMESON_append = " -Dasm=false"
183
184# llvmpipe is slow if compiled with -fomit-frame-pointer (e.g. -O2) 180# llvmpipe is slow if compiled with -fomit-frame-pointer (e.g. -O2)
185FULL_OPTIMIZATION_append = " -fno-omit-frame-pointer" 181FULL_OPTIMIZATION_append = " -fno-omit-frame-pointer"
186 182