Message ID | 20231024122258.210941-1-martin@martin.st |
---|---|
State | Accepted |
Commit | f05948ada435d95fed3cc9279cec0ccef8a10a2c |
Headers | show |
Series | [FFmpeg-devel,1/2] aarch64: Simplify the linux runtime cpu detection code | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
On Tue, Oct 24, 2023, 08:23 Martin Storsjö <martin@martin.st> wrote: > Skip doing the whole getauxval(AT_HWCAP) if HWCAP_CPUID isn't > defined. > --- > libavutil/aarch64/cpu.c | 6 +----- > 1 file changed, 1 insertion(+), 5 deletions(-) > > diff --git a/libavutil/aarch64/cpu.c b/libavutil/aarch64/cpu.c > index bd780e8591..2b50c426bc 100644 > --- a/libavutil/aarch64/cpu.c > +++ b/libavutil/aarch64/cpu.c > @@ -30,11 +30,9 @@ > static int detect_flags(void) > { > int flags = 0; > - unsigned long hwcap; > - > - hwcap = getauxval(AT_HWCAP); > > #if defined(HWCAP_CPUID) > + unsigned long hwcap = getauxval(AT_HWCAP); > // We can check for DOTPROD and I8MM using HWCAP_ASIMDDP and > // HWCAP2_I8MM too, avoiding to read the CPUID registers (which > triggers > // a trap, handled by the kernel). However the HWCAP_* defines for > these > @@ -53,8 +51,6 @@ static int detect_flags(void) > if (((tmp >> 52) & 0xf) == 0x1) > flags |= AV_CPU_FLAG_I8MM; > } > -#else > - (void)hwcap; > #endif > > return flags; > -- > 2.34.1 > > _______________________________________________ > 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". > Good call, and LGTM. -- Sean McGovern >
On Tue, Oct 24, 2023 at 8:40 AM Sean McGovern <gseanmcg@gmail.com> wrote: > > > > On Tue, Oct 24, 2023, 08:23 Martin Storsjö <martin@martin.st> wrote: >> >> Skip doing the whole getauxval(AT_HWCAP) if HWCAP_CPUID isn't >> defined. >> --- >> libavutil/aarch64/cpu.c | 6 +----- >> 1 file changed, 1 insertion(+), 5 deletions(-) >> >> diff --git a/libavutil/aarch64/cpu.c b/libavutil/aarch64/cpu.c >> index bd780e8591..2b50c426bc 100644 >> --- a/libavutil/aarch64/cpu.c >> +++ b/libavutil/aarch64/cpu.c >> @@ -30,11 +30,9 @@ >> static int detect_flags(void) >> { >> int flags = 0; >> - unsigned long hwcap; >> - >> - hwcap = getauxval(AT_HWCAP); >> >> #if defined(HWCAP_CPUID) >> + unsigned long hwcap = getauxval(AT_HWCAP); >> // We can check for DOTPROD and I8MM using HWCAP_ASIMDDP and >> // HWCAP2_I8MM too, avoiding to read the CPUID registers (which triggers >> // a trap, handled by the kernel). However the HWCAP_* defines for these >> @@ -53,8 +51,6 @@ static int detect_flags(void) >> if (((tmp >> 52) & 0xf) == 0x1) >> flags |= AV_CPU_FLAG_I8MM; >> } >> -#else >> - (void)hwcap; >> #endif >> >> return flags; >> -- >> 2.34.1 >> >> _______________________________________________ >> 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". > > > Good call, and LGTM. > > -- Sean McGovern Ooops! I don't have c= so maybe someone who does could push this -- and the 2nd patch in this set needs a pair of eyes more familiar with compiler bugs. -- Sean McG
On Thu, Oct 26, 2023 at 5:40 PM Sean McGovern <gseanmcg@gmail.com> wrote: > > On Tue, Oct 24, 2023 at 8:40 AM Sean McGovern <gseanmcg@gmail.com> wrote: > > > > > > > > On Tue, Oct 24, 2023, 08:23 Martin Storsjö <martin@martin.st> wrote: > >> > >> Skip doing the whole getauxval(AT_HWCAP) if HWCAP_CPUID isn't > >> defined. > >> --- > >> libavutil/aarch64/cpu.c | 6 +----- > >> 1 file changed, 1 insertion(+), 5 deletions(-) > >> > >> diff --git a/libavutil/aarch64/cpu.c b/libavutil/aarch64/cpu.c > >> index bd780e8591..2b50c426bc 100644 > >> --- a/libavutil/aarch64/cpu.c > >> +++ b/libavutil/aarch64/cpu.c > >> @@ -30,11 +30,9 @@ > >> static int detect_flags(void) > >> { > >> int flags = 0; > >> - unsigned long hwcap; > >> - > >> - hwcap = getauxval(AT_HWCAP); > >> > >> #if defined(HWCAP_CPUID) > >> + unsigned long hwcap = getauxval(AT_HWCAP); > >> // We can check for DOTPROD and I8MM using HWCAP_ASIMDDP and > >> // HWCAP2_I8MM too, avoiding to read the CPUID registers (which triggers > >> // a trap, handled by the kernel). However the HWCAP_* defines for these > >> @@ -53,8 +51,6 @@ static int detect_flags(void) > >> if (((tmp >> 52) & 0xf) == 0x1) > >> flags |= AV_CPU_FLAG_I8MM; > >> } > >> -#else > >> - (void)hwcap; > >> #endif > >> > >> return flags; > >> -- > >> 2.34.1 > >> > >> _______________________________________________ > >> 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". > > > > > > Good call, and LGTM. > > > > -- Sean McGovern > > Ooops! I don't have c= so maybe someone who does could push this -- > and the 2nd patch in this set needs a pair of eyes more familiar with > compiler bugs. > > -- Sean McG Looks like I missed the push notification on patch #2. -- Sean McG.
On Tue, 24 Oct 2023, Sean McGovern wrote: > On Tue, Oct 24, 2023, 08:23 Martin Storsjö <martin@martin.st> wrote: > >> Skip doing the whole getauxval(AT_HWCAP) if HWCAP_CPUID isn't >> defined. >> --- >> libavutil/aarch64/cpu.c | 6 +----- >> 1 file changed, 1 insertion(+), 5 deletions(-) >> >> diff --git a/libavutil/aarch64/cpu.c b/libavutil/aarch64/cpu.c >> index bd780e8591..2b50c426bc 100644 >> --- a/libavutil/aarch64/cpu.c >> +++ b/libavutil/aarch64/cpu.c >> @@ -30,11 +30,9 @@ >> static int detect_flags(void) >> { >> int flags = 0; >> - unsigned long hwcap; >> - >> - hwcap = getauxval(AT_HWCAP); >> >> #if defined(HWCAP_CPUID) >> + unsigned long hwcap = getauxval(AT_HWCAP); >> // We can check for DOTPROD and I8MM using HWCAP_ASIMDDP and >> // HWCAP2_I8MM too, avoiding to read the CPUID registers (which >> triggers >> // a trap, handled by the kernel). However the HWCAP_* defines for >> these >> @@ -53,8 +51,6 @@ static int detect_flags(void) >> if (((tmp >> 52) & 0xf) == 0x1) >> flags |= AV_CPU_FLAG_I8MM; >> } >> -#else >> - (void)hwcap; >> #endif >> >> return flags; >> -- >> 2.34.1 >> >> _______________________________________________ >> 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". >> > > Good call, and LGTM. Thanks, will push now. // Martin
diff --git a/libavutil/aarch64/cpu.c b/libavutil/aarch64/cpu.c index bd780e8591..2b50c426bc 100644 --- a/libavutil/aarch64/cpu.c +++ b/libavutil/aarch64/cpu.c @@ -30,11 +30,9 @@ static int detect_flags(void) { int flags = 0; - unsigned long hwcap; - - hwcap = getauxval(AT_HWCAP); #if defined(HWCAP_CPUID) + unsigned long hwcap = getauxval(AT_HWCAP); // We can check for DOTPROD and I8MM using HWCAP_ASIMDDP and // HWCAP2_I8MM too, avoiding to read the CPUID registers (which triggers // a trap, handled by the kernel). However the HWCAP_* defines for these @@ -53,8 +51,6 @@ static int detect_flags(void) if (((tmp >> 52) & 0xf) == 0x1) flags |= AV_CPU_FLAG_I8MM; } -#else - (void)hwcap; #endif return flags;