@ -38,6 +38,10 @@
# include <string.h>
# include <string.h>
# include "libavutil/avstring.h"
# include "libavutil/avstring.h"
# if HAVE_GETAUXVAL
# include <sys/auxv.h>
# endif
# define AT_HWCAP 16
# define AT_HWCAP 16
/* Relevant HWCAP values from kernel headers */
/* Relevant HWCAP values from kernel headers */
@ -48,6 +52,19 @@
# define HWCAP_VFPv3 (1 << 13)
# define HWCAP_VFPv3 (1 << 13)
# define HWCAP_TLS (1 << 15)
# define HWCAP_TLS (1 << 15)
static int get_auxval ( uint32_t * hwcap )
{
# if HAVE_GETAUXVAL
unsigned long ret = getauxval ( AT_HWCAP ) ;
if ( ret = = 0 )
return - 1 ;
* hwcap = ret ;
return 0 ;
# else
return - 1 ;
# endif
}
static int get_hwcap ( uint32_t * hwcap )
static int get_hwcap ( uint32_t * hwcap )
{
{
struct { uint32_t a_type ; uint32_t a_val ; } auxv ;
struct { uint32_t a_type ; uint32_t a_val ; } auxv ;
@ -106,9 +123,10 @@ int ff_get_cpu_flags_arm(void)
int flags = CORE_CPU_FLAGS ;
int flags = CORE_CPU_FLAGS ;
uint32_t hwcap ;
uint32_t hwcap ;
if ( get_hwcap ( & hwcap ) < 0 )
if ( get_auxval ( & hwcap ) < 0 )
if ( get_cpuinfo ( & hwcap ) < 0 )
if ( get_hwcap ( & hwcap ) < 0 )
return flags ;
if ( get_cpuinfo ( & hwcap ) < 0 )
return flags ;
# define check_cap(cap, flag) do { \
# define check_cap(cap, flag) do { \
if ( hwcap & HWCAP_ # # cap ) \
if ( hwcap & HWCAP_ # # cap ) \