From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id E877C4A7E6 for ; Wed, 10 Apr 2024 07:39:03 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CD97E68D06F; Wed, 10 Apr 2024 10:38:59 +0300 (EEST) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A71F068C496 for ; Wed, 10 Apr 2024 10:38:52 +0300 (EEST) Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-516d68d7a8bso4421987e87.1 for ; Wed, 10 Apr 2024 00:38:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=martin-st.20230601.gappssmtp.com; s=20230601; t=1712734732; x=1713339532; darn=ffmpeg.org; h=mime-version:references:message-id:in-reply-to:subject:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=06pdqG34RJPnqEARnrY/cuA3NQHpedcHPr3vUcD91nE=; b=NjtPXmoCKTnguDyxjjPznAN6kxNxOoXckUhBF1vK/SCd4tesp7Q+8fx4n1qTHDQakU WMcH4GJX0TLU6KnhL/8rewDpoVGyIQEC3Q8mPA0yqQTbwQkI9GyR2aS7gLMmtmrLNe+H WaWDYK7onEFA6aYyzNN8HKXHzvdeCzqcs9Tkzt33+CnrV4bzVWTOXFzx8hBxsaoNvndb tkjX+oq+Lqqv0KosjP9OeHFzsf7viqs2hxmmDgZ2rfxNI43K1FLoCTgPKwUjEhaQbXBT Zg9djAxseOF4AzLVv6PAgTFrPbiAK/QO4xEdf6/UkwPxF0T+sYnRzviODRnASqYvxF69 pfrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712734732; x=1713339532; h=mime-version:references:message-id:in-reply-to:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=06pdqG34RJPnqEARnrY/cuA3NQHpedcHPr3vUcD91nE=; b=HyNcCe+h/s9Weqs+G2sKRcBmB9dINeE4KBU6dMWT/AxmRHJZ4fI2/FiaxAsYOAlS5E +MqfHUjF+0TeQ6uapnpkN3NUlGPB2MZe013BQEtpLkMKmLqZST0FJ2csfUhivStb951V D6dM2NVcxvX6O31Y8BKxtkE53E4b6TTA35kzWLMuXsTYH0tFznn0CN/yxseLepMvItuv ScByBuv5wVbN7uM5ttbgcoexw16e1idsCJ7f4tnn5yDXqr9wY20arQDX58KM6ODy9V8o p9eZYxHFh3IkJCzPXGbFb6cVhY9DyUOw2YCINOzlI5gII3+mi3hlYCIDfrA4aXWRjAP5 X4ew== X-Gm-Message-State: AOJu0Ywybzhi7TJ/Pl09VukJTmA7t9pb495g5ME/+yowT5ZHIc7+frbY z4TcCEn7dTZO2ZjHNAuBDG18vLXuXbwexJ+ZLRmNGZvUqscRBrypwdXv7y/bJgpZ7IOpJ996jDO 6eg== X-Google-Smtp-Source: AGHT+IGSbk2M4TnR6FBbcJcSQgBIfxjiNgCTZyCUVtQcgnkMnENBMtn7WZcWdik81Rt6dQdl9EiHWg== X-Received: by 2002:a05:6512:4db:b0:516:ef63:b7e9 with SMTP id w27-20020a05651204db00b00516ef63b7e9mr610736lfq.13.1712734731476; Wed, 10 Apr 2024 00:38:51 -0700 (PDT) Received: from tunnel335574-pt.tunnel.tserv24.sto1.ipv6.he.net (tunnel335574-pt.tunnel.tserv24.sto1.ipv6.he.net. [2001:470:27:11::2]) by smtp.gmail.com with ESMTPSA id o13-20020a198c0d000000b00516d2386639sm1805597lfd.286.2024.04.10.00.38.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 00:38:51 -0700 (PDT) Date: Wed, 10 Apr 2024 10:38:45 +0300 (EEST) From: =?ISO-8859-15?Q?Martin_Storsj=F6?= To: ffmpeg-devel@ffmpeg.org In-Reply-To: <20240312082719.1884075-1-martin@martin.st> Message-ID: <68a13f38-568a-665b-c4bb-e2117f496d8@martin.st> References: <20240312082719.1884075-1-martin@martin.st> MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [FFmpeg-devel] [PATCH] aarch64: Factorize code for CPU feature detection on Apple platforms X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-15"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Tue, 12 Mar 2024, Martin Storsj=F6 wrote: > --- > libavutil/aarch64/cpu.c | 25 +++++++++++++------------ > 1 file changed, 13 insertions(+), 12 deletions(-) > > diff --git a/libavutil/aarch64/cpu.c b/libavutil/aarch64/cpu.c > index 7a05391343..196bdaf6b0 100644 > --- a/libavutil/aarch64/cpu.c > +++ b/libavutil/aarch64/cpu.c > @@ -45,22 +45,23 @@ static int detect_flags(void) > #elif defined(__APPLE__) && HAVE_SYSCTLBYNAME > #include > > +static int have_feature(const char *feature) { > + uint32_t value =3D 0; > + size_t size =3D sizeof(value); > + if (!sysctlbyname(feature, &value, &size, NULL, 0)) > + return value; > + return 0; > +} > + > static int detect_flags(void) > { > - uint32_t value =3D 0; > - size_t size; > int flags =3D 0; > > - size =3D sizeof(value); > - if (!sysctlbyname("hw.optional.arm.FEAT_DotProd", &value, &size, NUL= L, 0)) { > - if (value) > - flags |=3D AV_CPU_FLAG_DOTPROD; > - } > - size =3D sizeof(value); > - if (!sysctlbyname("hw.optional.arm.FEAT_I8MM", &value, &size, NULL, = 0)) { > - if (value) > - flags |=3D AV_CPU_FLAG_I8MM; > - } > + if (have_feature("hw.optional.arm.FEAT_DotProd")) > + flags |=3D AV_CPU_FLAG_DOTPROD; > + if (have_feature("hw.optional.arm.FEAT_I8MM")) > + flags |=3D AV_CPU_FLAG_I8MM; > + > return flags; > } Will apply. // 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".