[FFmpeg-devel] [PATCH] libavutil/riscv: Make use of elf_aux_info() on FreeBSD / OpenBSD riscv

Rémi Denis-Courmont remi at remlab.net
Mon Nov 18 20:28:24 EET 2024


Le maanantaina 18. marraskuuta 2024, 4.02.39 EET Brad Smith a écrit :
> libavutil/riscv: Make use of elf_aux_info() on FreeBSD / OpenBSD riscv
> 
> FreeBSD/OpenBSD riscv have elf_aux_info().

Does OpenBSD use the same HWCAP encoding as Linux and FreeBSD?

On real contemporary commercial hardware, there are two CPU configurations that 
affect FFmpeg, on top of the baseline RV64GC/RVA20:
- StarFive JH7110: Zba and Zbb,
- Canaan K230 and SpacemiT K1: Zba, Zbb, Zbs and V (or RVA22 + V).

The first one simply can't be handled with this encoding scheme which leaves no 
room for extension without single letter designation.

The second one won't be detected properly unless the kernel understands that B 
is equivalent to Zba, Zbb and Zbs (or the device tree is manually patched). It 
seems that at least FreeBSD fails there: https://reviews.freebsd.org/D46277

> Signed-off-by: Brad Smith <brad at comstyle.com>
> ---
>  libavutil/riscv/cpu.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavutil/riscv/cpu.c b/libavutil/riscv/cpu.c
> index 4ec6d6c826..163e4fc14a 100644
> --- a/libavutil/riscv/cpu.c
> +++ b/libavutil/riscv/cpu.c
> @@ -25,7 +25,7 @@
>  #include "libavutil/log.h"
>  #include "config.h"
> 
> -#if HAVE_GETAUXVAL
> +#if HAVE_GETAUXVAL || HAVE_ELF_AUX_INFO
>  #include <sys/auxv.h>
>  #define HWCAP_RV(letter) (1ul << ((letter) - 'A'))
>  #endif
> @@ -84,7 +84,7 @@ int ff_get_cpu_flags_riscv(void)
>              default:
>          }
>      }
> -#elif HAVE_GETAUXVAL
> +#elif HAVE_GETAUXVAL || HAVE_ELF_AUX_INFO
>      {
>          const unsigned long hwcap = ff_getauxval(AT_HWCAP);


-- 
Rémi Denis-Courmont
http://www.remlab.net/





More information about the ffmpeg-devel mailing list