[FFmpeg-devel] [PATCH v2 5/5] aarch64: Add Windows runtime detection of the dotprod instructions

Martin Storsjö martin at martin.st
Tue Jun 6 12:32:33 EEST 2023


On Mon, 5 Jun 2023, James Zern wrote:

> On Tue, May 30, 2023 at 5:31 AM Martin Storsjö <martin at martin.st> wrote:
>>
>> For Windows, there's no publicly defined constant for checking for
>> the i8mm extension yet.
>> ---
>>  libavutil/aarch64/cpu.c | 10 ++++++++++
>>  1 file changed, 10 insertions(+)
>>
>> diff --git a/libavutil/aarch64/cpu.c b/libavutil/aarch64/cpu.c
>> index ffb00f6dd2..4b97530240 100644
>> --- a/libavutil/aarch64/cpu.c
>> +++ b/libavutil/aarch64/cpu.c
>> @@ -94,6 +94,16 @@ static int detect_flags(void)
>>      return flags;
>>  }
>>
>> +#elif defined(_WIN32)
>> +#include <windows.h>
>> +
>> +static int detect_flags(void)
>> +{
>> +    int flags = 0;
>> +    if (IsProcessorFeaturePresent(PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE))
>
> I think this requires a recent Windows SDK, is compatibility a concern?

Good catch, thanks! Yes, this requires a fairly recent SDK; it's been 
added to mingw-w64 in 2021, and in the MS WinSDK since 10.0.22000.0. So 
this would indeed have failed in my own fate config with an older MSVC...

It's easy to wrap this up in an #ifdef though, since the identifier is a 
define (both in mingw-w64 and WinSDK).

Other than that, this code is only used for aarch64, so the target 
audience is much smaller than generic windows code, but nevertheless, 
let's not break older toolchains if we don't need to.

I'll amend the patch locally with an ifdef before pushing.

// Martin


More information about the ffmpeg-devel mailing list