<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Apr 13, 2017 20:59, "Eric Anholt" <<a href="mailto:eric@anholt.net">eric@anholt.net</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This will allow Raspbian's ARMv6 builds to take advantage of the new NEON<br>
code, and could prevent problems if vc4 ends up getting used on a v7 CPU<br>
without NEON.<br>
---<br>
 src/gallium/drivers/vc4/vc4_<wbr>screen.c |  3 +++<br>
 src/gallium/drivers/vc4/vc4_<wbr>tiling.h | 25 +++++++++++++------------<br>
 2 files changed, 16 insertions(+), 12 deletions(-)<br>
<br>
diff --git a/src/gallium/drivers/vc4/vc4_<wbr>screen.c b/src/gallium/drivers/vc4/vc4_<wbr>screen.c<br>
index 9030c4baf4bb..514af808b916 100644<br>
--- a/src/gallium/drivers/vc4/vc4_<wbr>screen.c<br>
+++ b/src/gallium/drivers/vc4/vc4_<wbr>screen.c<br>
@@ -27,6 +27,7 @@<br>
 #include "pipe/p_screen.h"<br>
 #include "pipe/p_state.h"<br>
<br>
+#include "util/u_cpu_detect.h"<br>
 #include "util/u_debug.h"<br>
 #include "util/u_memory.h"<br>
 #include "util/u_format.h"<br>
@@ -627,6 +628,8 @@ vc4_screen_create(int fd)<br>
         if (!vc4_get_chip_info(screen))<br>
                 goto fail;<br>
<br>
+        util_cpu_detect();<br>
+<br>
         slab_create_parent(&screen-><wbr>transfer_pool, sizeof(struct vc4_transfer), 16);<br>
<br>
         vc4_fence_init(screen);<br>
diff --git a/src/gallium/drivers/vc4/vc4_<wbr>tiling.h b/src/gallium/drivers/vc4/vc4_<wbr>tiling.h<br>
index ba1ad6fb3f7d..31317db7a949 100644<br>
--- a/src/gallium/drivers/vc4/vc4_<wbr>tiling.h<br>
+++ b/src/gallium/drivers/vc4/vc4_<wbr>tiling.h<br>
@@ -27,6 +27,7 @@<br>
 #include <stdbool.h><br>
 #include <stdint.h><br>
 #include "util/macros.h"<br>
+#include "util/u_cpu_detect.h"<br>
<br>
 /** Return the width in pixels of a 64-byte microtile. */<br>
 static inline uint32_t<br>
@@ -83,23 +84,18 @@ void vc4_store_tiled_image(void *dst, uint32_t dst_stride,<br>
                            uint8_t tiling_format, int cpp,<br>
                            const struct pipe_box *box);<br>
<br>
-/* If we're building for ARMv7 (Pi 2+), assume it has NEON.  For Raspbian we<br>
- * should extend this to have some runtime detection of being built for ARMv6<br>
- * on a Pi 2+.<br>
- */<br>
-#if defined(__ARM_ARCH) && __ARM_ARCH == 7<br>
-#define NEON_SUFFIX(x) x ## _neon<br>
-#else<br>
-#define NEON_SUFFIX(x) x ## _base<br>
-#endif<br>
-<br>
 static inline void<br>
 vc4_load_lt_image(void *dst, uint32_t dst_stride,<br>
                   void *src, uint32_t src_stride,<br>
                   int cpp, const struct pipe_box *box)<br>
 {<br>
-        NEON_SUFFIX(vc4_load_lt_image)<wbr>(dst, dst_stride, src, src_stride,<br>
+        if (util_cpu_caps.has_neon) {<br>
+                vc4_load_lt_image_neon(dst, dst_stride, src, src_stride,<br>
+                                       cpp, box);<br>
+        } else {<br>
+                vc4_load_lt_image_base(dst, dst_stride, src, src_stride,<br>
                                        cpp, box);<br>
+        }<br>
 }<br>
<br>
 static inline void<br>
@@ -107,8 +103,13 @@ vc4_store_lt_image(void *dst, uint32_t dst_stride,<br>
                    void *src, uint32_t src_stride,<br>
                    int cpp, const struct pipe_box *box)<br>
 {<br>
-        NEON_SUFFIX(vc4_store_lt_<wbr>image)(dst, dst_stride, src, src_stride,<br>
+        if (util_cpu_caps.has_neon) {<br>
+                vc4_store_lt_image_neon(dst, dst_stride, src, src_stride,<br>
+                                        cpp, box);<br>
+        } else {<br>
+                vc4_store_lt_image_base(dst, dst_stride, src, src_stride,<br>
                                         cpp, box);<br>
+        }<br>
 }<br>
<br>
 #undef NEON_SUFFIX<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">Looks like this line should be deleted also... </div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<font color="#888888">--<br>
2.11.0<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></blockquote></div><br></div></div></div>