Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR: 264942 Submitted by: Robert Clausecker
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- babl/babl-cpuaccel.c.orig 2022-06-28 12:20:06 UTC | ||
+++ babl/babl-cpuaccel.c | ||
@@ -556,33 +556,19 @@ arch_accel (void) | ||
#include <fcntl.h> | ||
#include <string.h> | ||
#include <elf.h> | ||
+#include <sys/auxv.h> | ||
|
||
#define HAVE_ACCEL 1 | ||
|
||
static guint32 | ||
arch_accel (void) | ||
{ | ||
- /* TODO : add or hardcode the other ways it can be on arm, where | ||
- * this info comes from the system and not from running cpu | ||
- * instructions | ||
- */ | ||
- int has_neon = 0; | ||
- int fd = open ("/proc/self/auxv", O_RDONLY); | ||
- Elf32_auxv_t auxv; | ||
- if (fd >= 0) | ||
- { | ||
- while (read (fd, &auxv, sizeof (Elf32_auxv_t)) == sizeof (Elf32_auxv_t)) | ||
- { | ||
- if (auxv.a_type == AT_HWCAP) | ||
- { | ||
- if (auxv.a_un.a_val & 4096) | ||
- has_neon = 1; | ||
- } | ||
- } | ||
- close (fd); | ||
- } | ||
- return has_neon?BABL_CPU_ACCEL_ARM_NEON:0; | ||
-} | ||
+ unsigned long hwcap = 0; | ||
+ | ||
+ elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap); | ||
+ | ||
+ return hwcap & HWCAP_NEON ? BABL_CPU_ACCEL_ARM_NEON : 0; | ||
+} | ||
|
||
#endif /* ARCH_ARM */ | ||
|