View | Details | Raw Unified | Return to bug 265092
Collapse All | Expand All

(-)b/graphics/gegl/files/patch-gegl_gegl-cpuaccel.c (-1 / +41 lines)
Added Link Here
0
- 
1
--- gegl/gegl-cpuaccel.c.orig	2022-07-07 02:35:48 UTC
2
+++ gegl/gegl-cpuaccel.c
3
@@ -552,32 +552,18 @@ arch_accel (void)
4
 #include <fcntl.h>
5
 #include <string.h>
6
 #include <elf.h>
7
+#include <sys/auxv.h>
8
 
9
 #define HAVE_ACCEL 1
10
 
11
 static guint32
12
 arch_accel (void)
13
 {
14
-  /* TODO : add or hardcode the other ways it can be on arm, where
15
-   *        this info comes from the system and not from running cpu
16
-   *        instructions
17
-   */
18
-  int has_neon = 0;
19
-  int fd = open ("/proc/self/auxv", O_RDONLY);
20
-  Elf32_auxv_t auxv;
21
-  if (fd >= 0)
22
-  {
23
-    while (read (fd, &auxv, sizeof (Elf32_auxv_t)) == sizeof (Elf32_auxv_t))
24
-    {
25
-      if (auxv.a_type == AT_HWCAP)
26
-      {
27
-        if (auxv.a_un.a_val & 4096)
28
-          has_neon = 1;
29
-      }
30
-    }
31
-    close (fd);
32
-  }
33
-  return has_neon?GEGL_CPU_ACCEL_ARM_NEON:0;
34
+	unsigned long hwcap = 0;
35
+
36
+	elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap);
37
+
38
+	return hwcap & HWCAP_NEON ? GEGL_CPU_ACCEL_ARM_NEON : 0;
39
 }
40
 
41
 #endif /* ARCH_ARM  */

Return to bug 265092