* [FFmpeg-devel] aarch64: Implement support for elf_aux_info(3) on FreeBSD and OpenBSD
@ 2024-07-26 10:58 Brad Smith
2024-07-26 11:56 ` Rémi Denis-Courmont
0 siblings, 1 reply; 5+ messages in thread
From: Brad Smith @ 2024-07-26 10:58 UTC (permalink / raw)
To: ffmpeg-devel
aarch64: Implement support for elf_aux_info(3) on FreeBSD and OpenBSD
FreeBSD 12.0+, OpenBSD -current and what will be OpenBSD 7.6 support
elf_aux_info(3).
Signed-off-by: Brad Smith <brad@comstyle.com>
---
configure | 2 ++
libavutil/aarch64/cpu.c | 23 ++++++++++++++++++++++-
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/configure b/configure
index f6f5c29fea..e80b549582 100755
--- a/configure
+++ b/configure
@@ -2366,6 +2366,7 @@ SYSTEM_FUNCS="
clock_gettime
closesocket
CommandLineToArgvW
+ elf_aux_info
fcntl
getaddrinfo
getauxval
@@ -6565,6 +6566,7 @@ check_func_headers mach/mach_time.h mach_absolute_time
check_func_headers stdlib.h getenv
check_func_headers sys/stat.h lstat
check_func_headers sys/auxv.h getauxval
+check_func_headers sys/auxv.h elf_aux_info
check_func_headers sys/sysctl.h sysctlbyname
check_func_headers windows.h GetModuleHandle
diff --git a/libavutil/aarch64/cpu.c b/libavutil/aarch64/cpu.c
index cfa9306663..05272b4db4 100644
--- a/libavutil/aarch64/cpu.c
+++ b/libavutil/aarch64/cpu.c
@@ -42,6 +42,27 @@ static int detect_flags(void)
return flags;
}
+#elif (defined(__FreeBSD__) || defined(__OpenBSD__)) && HAVE_ELF_AUX_INFO
+#include <stdint.h>
+#include <sys/auxv.h>
+
+static int detect_flags(void)
+{
+ int flags = 0;
+
+ unsigned long hwcap = 0;
+ elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap);
+ unsigned long hwcap2 = 0;
+ elf_aux_info(AT_HWCAP2, &hwcap2, sizeof hwcap2);
+
+ if (hwcap & HWCAP_ASIMDDP)
+ flags |= AV_CPU_FLAG_DOTPROD;
+ if (hwcap2 & HWCAP2_I8MM)
+ flags |= AV_CPU_FLAG_I8MM;
+
+ return flags;
+}
+
#elif defined(__APPLE__) && HAVE_SYSCTLBYNAME
#include <sys/sysctl.h>
@@ -65,7 +86,7 @@ static int detect_flags(void)
return flags;
}
-#elif defined(__OpenBSD__)
+#elif defined(__OpenBSD__) && !HAVE_ELF_AUX_INFO
#include <machine/armreg.h>
#include <machine/cpu.h>
#include <sys/types.h>
--
2.45.2
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] aarch64: Implement support for elf_aux_info(3) on FreeBSD and OpenBSD
2024-07-26 10:58 [FFmpeg-devel] aarch64: Implement support for elf_aux_info(3) on FreeBSD and OpenBSD Brad Smith
@ 2024-07-26 11:56 ` Rémi Denis-Courmont
2024-07-28 4:37 ` Brad Smith
0 siblings, 1 reply; 5+ messages in thread
From: Rémi Denis-Courmont @ 2024-07-26 11:56 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Le 26 juillet 2024 13:58:34 GMT+03:00, Brad Smith <brad-at-comstyle.com@ffmpeg.org> a écrit :
>aarch64: Implement support for elf_aux_info(3) on FreeBSD and OpenBSD
>
>FreeBSD 12.0+, OpenBSD -current and what will be OpenBSD 7.6 support
>elf_aux_info(3).
>
>Signed-off-by: Brad Smith <brad@comstyle.com>
>---
> configure | 2 ++
> libavutil/aarch64/cpu.c | 23 ++++++++++++++++++++++-
> 2 files changed, 24 insertions(+), 1 deletion(-)
>
>diff --git a/configure b/configure
>index f6f5c29fea..e80b549582 100755
>--- a/configure
>+++ b/configure
>@@ -2366,6 +2366,7 @@ SYSTEM_FUNCS="
> clock_gettime
> closesocket
> CommandLineToArgvW
>+ elf_aux_info
> fcntl
> getaddrinfo
> getauxval
>@@ -6565,6 +6566,7 @@ check_func_headers mach/mach_time.h mach_absolute_time
> check_func_headers stdlib.h getenv
> check_func_headers sys/stat.h lstat
> check_func_headers sys/auxv.h getauxval
>+check_func_headers sys/auxv.h elf_aux_info
> check_func_headers sys/sysctl.h sysctlbyname
>
> check_func_headers windows.h GetModuleHandle
>diff --git a/libavutil/aarch64/cpu.c b/libavutil/aarch64/cpu.c
>index cfa9306663..05272b4db4 100644
>--- a/libavutil/aarch64/cpu.c
>+++ b/libavutil/aarch64/cpu.c
>@@ -42,6 +42,27 @@ static int detect_flags(void)
> return flags;
> }
>
>+#elif (defined(__FreeBSD__) || defined(__OpenBSD__)) && HAVE_ELF_AUX_INFO
>+#include <stdint.h>
>+#include <sys/auxv.h>
>+
>+static int detect_flags(void)
>+{
>+ int flags = 0;
>+
>+ unsigned long hwcap = 0;
>+ elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap);
>+ unsigned long hwcap2 = 0;
>+ elf_aux_info(AT_HWCAP2, &hwcap2, sizeof hwcap2);
>+
>+ if (hwcap & HWCAP_ASIMDDP)
>+ flags |= AV_CPU_FLAG_DOTPROD;
>+ if (hwcap2 & HWCAP2_I8MM)
>+ flags |= AV_CPU_FLAG_I8MM;
>+
>+ return flags;
>+}
>+
Can't getauxval() be implemented with elf_aux_info(), or vice versa? It seems that otherwise the code should be identical to that from Linux.
> #elif defined(__APPLE__) && HAVE_SYSCTLBYNAME
> #include <sys/sysctl.h>
>
>@@ -65,7 +86,7 @@ static int detect_flags(void)
> return flags;
> }
>
>-#elif defined(__OpenBSD__)
>+#elif defined(__OpenBSD__) && !HAVE_ELF_AUX_INFO
> #include <machine/armreg.h>
> #include <machine/cpu.h>
> #include <sys/types.h>
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] aarch64: Implement support for elf_aux_info(3) on FreeBSD and OpenBSD
2024-07-26 11:56 ` Rémi Denis-Courmont
@ 2024-07-28 4:37 ` Brad Smith
2024-07-28 7:29 ` Rémi Denis-Courmont
0 siblings, 1 reply; 5+ messages in thread
From: Brad Smith @ 2024-07-28 4:37 UTC (permalink / raw)
To: FFmpeg development discussions and patches, Rémi Denis-Courmont
On 2024-07-26 7:56 a.m., Rémi Denis-Courmont wrote:
>
> Le 26 juillet 2024 13:58:34 GMT+03:00, Brad Smith <brad-at-comstyle.com@ffmpeg.org> a écrit :
>> aarch64: Implement support for elf_aux_info(3) on FreeBSD and OpenBSD
>>
>> FreeBSD 12.0+, OpenBSD -current and what will be OpenBSD 7.6 support
>> elf_aux_info(3).
>>
>> Signed-off-by: Brad Smith <brad@comstyle.com>
>> ---
>> configure | 2 ++
>> libavutil/aarch64/cpu.c | 23 ++++++++++++++++++++++-
>> 2 files changed, 24 insertions(+), 1 deletion(-)
>>
>> diff --git a/configure b/configure
>> index f6f5c29fea..e80b549582 100755
>> --- a/configure
>> +++ b/configure
>> @@ -2366,6 +2366,7 @@ SYSTEM_FUNCS="
>> clock_gettime
>> closesocket
>> CommandLineToArgvW
>> + elf_aux_info
>> fcntl
>> getaddrinfo
>> getauxval
>> @@ -6565,6 +6566,7 @@ check_func_headers mach/mach_time.h mach_absolute_time
>> check_func_headers stdlib.h getenv
>> check_func_headers sys/stat.h lstat
>> check_func_headers sys/auxv.h getauxval
>> +check_func_headers sys/auxv.h elf_aux_info
>> check_func_headers sys/sysctl.h sysctlbyname
>>
>> check_func_headers windows.h GetModuleHandle
>> diff --git a/libavutil/aarch64/cpu.c b/libavutil/aarch64/cpu.c
>> index cfa9306663..05272b4db4 100644
>> --- a/libavutil/aarch64/cpu.c
>> +++ b/libavutil/aarch64/cpu.c
>> @@ -42,6 +42,27 @@ static int detect_flags(void)
>> return flags;
>> }
>>
>> +#elif (defined(__FreeBSD__) || defined(__OpenBSD__)) && HAVE_ELF_AUX_INFO
>> +#include <stdint.h>
>> +#include <sys/auxv.h>
>> +
>> +static int detect_flags(void)
>> +{
>> + int flags = 0;
>> +
>> + unsigned long hwcap = 0;
>> + elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap);
>> + unsigned long hwcap2 = 0;
>> + elf_aux_info(AT_HWCAP2, &hwcap2, sizeof hwcap2);
>> +
>> + if (hwcap & HWCAP_ASIMDDP)
>> + flags |= AV_CPU_FLAG_DOTPROD;
>> + if (hwcap2 & HWCAP2_I8MM)
>> + flags |= AV_CPU_FLAG_I8MM;
>> +
>> + return flags;
>> +}
>> +
> Can't getauxval() be implemented with elf_aux_info(), or vice versa? It seems that otherwise the code should be identical to that from Linux.
QEMU has qemu_getauxval() for example as a wrapper. I will be using this
elsewhere for arm, ppc and riscv.
I could split this up, but I am not sure where to place such a function.
>> #elif defined(__APPLE__) && HAVE_SYSCTLBYNAME
>> #include <sys/sysctl.h>
>>
>> @@ -65,7 +86,7 @@ static int detect_flags(void)
>> return flags;
>> }
>>
>> -#elif defined(__OpenBSD__)
>> +#elif defined(__OpenBSD__) && !HAVE_ELF_AUX_INFO
>> #include <machine/armreg.h>
>> #include <machine/cpu.h>
>> #include <sys/types.h>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] aarch64: Implement support for elf_aux_info(3) on FreeBSD and OpenBSD
2024-07-28 4:37 ` Brad Smith
@ 2024-07-28 7:29 ` Rémi Denis-Courmont
2024-07-28 11:41 ` Martin Storsjö
0 siblings, 1 reply; 5+ messages in thread
From: Rémi Denis-Courmont @ 2024-07-28 7:29 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Le 28 juillet 2024 07:37:51 GMT+03:00, Brad Smith <brad-at-comstyle.com@ffmpeg.org> a écrit :
>On 2024-07-26 7:56 a.m., Rémi Denis-Courmont wrote:
>>
>> Le 26 juillet 2024 13:58:34 GMT+03:00, Brad Smith <brad-at-comstyle.com@ffmpeg.org> a écrit :
>>> aarch64: Implement support for elf_aux_info(3) on FreeBSD and OpenBSD
>>>
>>> FreeBSD 12.0+, OpenBSD -current and what will be OpenBSD 7.6 support
>>> elf_aux_info(3).
>>>
>>> Signed-off-by: Brad Smith <brad@comstyle.com>
>>> ---
>>> configure | 2 ++
>>> libavutil/aarch64/cpu.c | 23 ++++++++++++++++++++++-
>>> 2 files changed, 24 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/configure b/configure
>>> index f6f5c29fea..e80b549582 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -2366,6 +2366,7 @@ SYSTEM_FUNCS="
>>> clock_gettime
>>> closesocket
>>> CommandLineToArgvW
>>> + elf_aux_info
>>> fcntl
>>> getaddrinfo
>>> getauxval
>>> @@ -6565,6 +6566,7 @@ check_func_headers mach/mach_time.h mach_absolute_time
>>> check_func_headers stdlib.h getenv
>>> check_func_headers sys/stat.h lstat
>>> check_func_headers sys/auxv.h getauxval
>>> +check_func_headers sys/auxv.h elf_aux_info
>>> check_func_headers sys/sysctl.h sysctlbyname
>>>
>>> check_func_headers windows.h GetModuleHandle
>>> diff --git a/libavutil/aarch64/cpu.c b/libavutil/aarch64/cpu.c
>>> index cfa9306663..05272b4db4 100644
>>> --- a/libavutil/aarch64/cpu.c
>>> +++ b/libavutil/aarch64/cpu.c
>>> @@ -42,6 +42,27 @@ static int detect_flags(void)
>>> return flags;
>>> }
>>>
>>> +#elif (defined(__FreeBSD__) || defined(__OpenBSD__)) && HAVE_ELF_AUX_INFO
>>> +#include <stdint.h>
>>> +#include <sys/auxv.h>
>>> +
>>> +static int detect_flags(void)
>>> +{
>>> + int flags = 0;
>>> +
>>> + unsigned long hwcap = 0;
>>> + elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap);
>>> + unsigned long hwcap2 = 0;
>>> + elf_aux_info(AT_HWCAP2, &hwcap2, sizeof hwcap2);
>>> +
>>> + if (hwcap & HWCAP_ASIMDDP)
>>> + flags |= AV_CPU_FLAG_DOTPROD;
>>> + if (hwcap2 & HWCAP2_I8MM)
>>> + flags |= AV_CPU_FLAG_I8MM;
>>> +
>>> + return flags;
>>> +}
>>> +
>> Can't getauxval() be implemented with elf_aux_info(), or vice versa? It seems that otherwise the code should be identical to that from Linux.
>
>QEMU has qemu_getauxval() for example as a wrapper. I will be using this elsewhere for arm, ppc and riscv.
>
>I could split this up, but I am not sure where to place such a function.
I don't personally have a strong opinion on the details, I just don't fancy unnecessary duplication.
>
>>> #elif defined(__APPLE__) && HAVE_SYSCTLBYNAME
>>> #include <sys/sysctl.h>
>>>
>>> @@ -65,7 +86,7 @@ static int detect_flags(void)
>>> return flags;
>>> }
>>>
>>> -#elif defined(__OpenBSD__)
>>> +#elif defined(__OpenBSD__) && !HAVE_ELF_AUX_INFO
>>> #include <machine/armreg.h>
>>> #include <machine/cpu.h>
>>> #include <sys/types.h>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>_______________________________________________
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>To unsubscribe, visit link above, or email
>ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] aarch64: Implement support for elf_aux_info(3) on FreeBSD and OpenBSD
2024-07-28 7:29 ` Rémi Denis-Courmont
@ 2024-07-28 11:41 ` Martin Storsjö
0 siblings, 0 replies; 5+ messages in thread
From: Martin Storsjö @ 2024-07-28 11:41 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Sun, 28 Jul 2024, Rémi Denis-Courmont wrote:
> Le 28 juillet 2024 07:37:51 GMT+03:00, Brad Smith <brad-at-comstyle.com@ffmpeg.org> a écrit :
>> On 2024-07-26 7:56 a.m., Rémi Denis-Courmont wrote:
>>>
>>> Le 26 juillet 2024 13:58:34 GMT+03:00, Brad Smith <brad-at-comstyle.com@ffmpeg.org> a écrit :
>>>> aarch64: Implement support for elf_aux_info(3) on FreeBSD and OpenBSD
>>>>
>>>> FreeBSD 12.0+, OpenBSD -current and what will be OpenBSD 7.6 support
>>>> elf_aux_info(3).
>>>>
>>>> Signed-off-by: Brad Smith <brad@comstyle.com>
>>>> ---
>>>> configure | 2 ++
>>>> libavutil/aarch64/cpu.c | 23 ++++++++++++++++++++++-
>>>> 2 files changed, 24 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/configure b/configure
>>>> index f6f5c29fea..e80b549582 100755
>>>> --- a/configure
>>>> +++ b/configure
>>>> @@ -2366,6 +2366,7 @@ SYSTEM_FUNCS="
>>>> clock_gettime
>>>> closesocket
>>>> CommandLineToArgvW
>>>> + elf_aux_info
>>>> fcntl
>>>> getaddrinfo
>>>> getauxval
>>>> @@ -6565,6 +6566,7 @@ check_func_headers mach/mach_time.h mach_absolute_time
>>>> check_func_headers stdlib.h getenv
>>>> check_func_headers sys/stat.h lstat
>>>> check_func_headers sys/auxv.h getauxval
>>>> +check_func_headers sys/auxv.h elf_aux_info
>>>> check_func_headers sys/sysctl.h sysctlbyname
>>>>
>>>> check_func_headers windows.h GetModuleHandle
>>>> diff --git a/libavutil/aarch64/cpu.c b/libavutil/aarch64/cpu.c
>>>> index cfa9306663..05272b4db4 100644
>>>> --- a/libavutil/aarch64/cpu.c
>>>> +++ b/libavutil/aarch64/cpu.c
>>>> @@ -42,6 +42,27 @@ static int detect_flags(void)
>>>> return flags;
>>>> }
>>>>
>>>> +#elif (defined(__FreeBSD__) || defined(__OpenBSD__)) && HAVE_ELF_AUX_INFO
>>>> +#include <stdint.h>
>>>> +#include <sys/auxv.h>
>>>> +
>>>> +static int detect_flags(void)
>>>> +{
>>>> + int flags = 0;
>>>> +
>>>> + unsigned long hwcap = 0;
>>>> + elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap);
>>>> + unsigned long hwcap2 = 0;
>>>> + elf_aux_info(AT_HWCAP2, &hwcap2, sizeof hwcap2);
>>>> +
>>>> + if (hwcap & HWCAP_ASIMDDP)
>>>> + flags |= AV_CPU_FLAG_DOTPROD;
>>>> + if (hwcap2 & HWCAP2_I8MM)
>>>> + flags |= AV_CPU_FLAG_I8MM;
>>>> +
>>>> + return flags;
>>>> +}
>>>> +
>>> Can't getauxval() be implemented with elf_aux_info(), or vice versa? It seems that otherwise the code should be identical to that from Linux.
>>
>> QEMU has qemu_getauxval() for example as a wrapper. I will be using this elsewhere for arm, ppc and riscv.
>>
>> I could split this up, but I am not sure where to place such a function.
>
> I don't personally have a strong opinion on the details, I just don't fancy unnecessary duplication.
I don't have a very strong opinion on it either, but if it's reasonable to
make this a static inline function in a header, it could e.g. be in the
compat directory, or just as a private header in libavutil.
// Martin
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-07-28 11:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-26 10:58 [FFmpeg-devel] aarch64: Implement support for elf_aux_info(3) on FreeBSD and OpenBSD Brad Smith
2024-07-26 11:56 ` Rémi Denis-Courmont
2024-07-28 4:37 ` Brad Smith
2024-07-28 7:29 ` Rémi Denis-Courmont
2024-07-28 11:41 ` Martin Storsjö
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git