1From e3b47c1b84964c62b3e1fa782f1ffa4be0ae62f9 Mon Sep 17 00:00:00 2001
2From: Peter Seiderer <ps.report@gmx.net>
3Date: Mon, 9 Mar 2020 13:01:14 +0100
4Subject: [PATCH] vc4: add meson option to disable optional neon support
5
6Not all toolchains are able to compile the runtime
7optional vc4 neon support, so add an meson option
8to force disabling it at compile time.
9
10[Upstream: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4114]
11Signed-off-by: Peter Seiderer <ps.report@gmx.net>
12Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
13[rebased for 20.2.0, 20.3.0 & 21.1.0]
14---
15 meson_options.txt                    | 7 +++++++
16 src/gallium/drivers/vc4/meson.build  | 4 ++--
17 src/gallium/drivers/vc4/vc4_tiling.h | 4 ++--
18 3 files changed, 11 insertions(+), 4 deletions(-)
19
20diff --git a/meson_options.txt b/meson_options.txt
21index a39596a6f19..0f6b6c62b55 100644
22--- a/meson_options.txt
23+++ b/meson_options.txt
24@@ -123,6 +123,13 @@ option(
25   choices : ['auto', 'true', 'false', 'enabled', 'disabled'],
26   description : 'enable gallium va frontend.',
27 )
28+option(
29+  'gallium-vc4-neon',
30+  type : 'combo',
31+  value : 'auto',
32+  choices : ['auto', 'disabled'],
33+  description : 'enable gallium vc4 optional neon support.',
34+)
35 option(
36   'va-libs-path',
37   type : 'string',
38diff --git a/src/gallium/drivers/vc4/meson.build b/src/gallium/drivers/vc4/meson.build
39index 5ce5af5f6b4..e3f7d8d62ae 100644
40--- a/src/gallium/drivers/vc4/meson.build
41+++ b/src/gallium/drivers/vc4/meson.build
42@@ -84,7 +84,7 @@ files_libvc4 = files(
43 vc4_c_args = []
44
45 libvc4_neon = []
46-if host_machine.cpu_family() == 'arm'
47+if host_machine.cpu_family() == 'arm' and get_option('gallium-vc4-neon') != 'disabled'
48   libvc4_neon = static_library(
49     'vc4_neon',
50     'vc4_tiling_lt_neon.c',
51@@ -93,7 +93,7 @@ if host_machine.cpu_family() == 'arm'
52     ],
53     c_args : '-mfpu=neon',
54   )
55-  vc4_c_args += '-DUSE_ARM_ASM'
56+  vc4_c_args += '-DVC4_TILING_LT_NEON'
57 endif
58
59 if dep_simpenrose.found()
60diff --git a/src/gallium/drivers/vc4/vc4_tiling.h b/src/gallium/drivers/vc4/vc4_tiling.h
61index 66767e7f1f8..7446f1c3d0c 100644
62--- a/src/gallium/drivers/vc4/vc4_tiling.h
63+++ b/src/gallium/drivers/vc4/vc4_tiling.h
64@@ -89,7 +89,7 @@ vc4_load_lt_image(void *dst, uint32_t dst_stride,
65                   void *src, uint32_t src_stride,
66                   int cpp, const struct pipe_box *box)
67 {
68-#ifdef USE_ARM_ASM
69+#ifdef VC4_TILING_LT_NEON
70         if (util_get_cpu_caps()->has_neon) {
71                 vc4_load_lt_image_neon(dst, dst_stride, src, src_stride,
72                                        cpp, box);
73@@ -105,7 +105,7 @@ vc4_store_lt_image(void *dst, uint32_t dst_stride,
74                    void *src, uint32_t src_stride,
75                    int cpp, const struct pipe_box *box)
76 {
77-#ifdef USE_ARM_ASM
78+#ifdef VC4_TILING_LT_NEON
79         if (util_get_cpu_caps()->has_neon) {
80                 vc4_store_lt_image_neon(dst, dst_stride, src, src_stride,
81                                         cpp, box);
82--
832.25.1
84
85