From patchwork Tue Jul 30 14:07:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nathan E. Egge" X-Patchwork-Id: 50817 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:b88e:0:b0:489:2eb3:e4c4 with SMTP id p14csp468338vqn; Tue, 30 Jul 2024 07:09:03 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVleOR5W66086vSijWU0ILrmaGwZM9iOzn/tBYpWHblQGun6AoujkO5UjIBIwumcdtr6V1RdPleJpEKFKaYqxeJ5sntj86xwGhpvw== X-Google-Smtp-Source: AGHT+IEpYljN1l7XZzBLCcMFE3bBzIykZ+WQ3a6bXMUJaWLgaoprhCbnsL5qarEehMmKyisq859k X-Received: by 2002:a2e:be22:0:b0:2ef:1c0a:9b94 with SMTP id 38308e7fff4ca-2f12edfddc0mr80241711fa.16.1722348543067; Tue, 30 Jul 2024 07:09:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722348542; cv=none; d=google.com; s=arc-20160816; b=ynfekYrlFyJ3nLcL3vglhC3ZlrTTIKMKokFgT4x72ohwJAIY35hSX1XkTkXMvV0oha FohWXjFhS+/NZcluZNpmZ0OhYqj1G9PlQJrPGPtigueR8ZoqAqMSDYNxq+JvHRMO+lss e28yEDz2TJBoI6rGIFR5GzNbuPQvoIPsnzcDu77HqcSqNvIO+NXtRi5ebYwqKJ6jG8vT 3KjaGdke+oaHcNGhzlwJB77Ib9Vei54fDUxi+IKtnqGemzWVQUagX4LGyECHcYVyafWV oBbc7meI3j0YW4ofofuA/CauklFSVLzWUx+Fe7A3CvZdI5sG5XB2EmORYzCG60jYO6nS Pe/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=ANAEVUKunChRo7vdXfn7PdR/55iFl5EqnSgUh8Qs2D8=; fh=TODjjcnpj5nBXiuj6eH/UWpjG3lYe0u7hmMnTCRmegc=; b=hMoSL/fZ3AHC2p5UimeM8hlD4pPGQokidNWZ9axoiYxcwoH90m/TubvDQou0C7UY/v AbjFoLfYHBD4cww+tz/3j55UMDuTrNh24BWtC9i/WlHQR//o+tsMbzCYhSWDGtiACRvS 2AMSZ24TbkY+wePewVBrPjAnBCFHRT3itZVIYW6mV5soED0DFUIqQByFW7WF1qDXT4GJ MocJvhZYWjVAFHuvRLfTj/yjW1+c8XebrqMaqq8b0Z5fGAB/6FiNhn1uI2E6hY+h5Ovz Xk37/uMUKc7ShmfltUFK743StZxGkPBg3uWcS9308bfW7oe2uFbbLVTR/wfWypTiYhSn x2sA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 4fb4d7f45d1cf-5ac6339cbeesi8101823a12.70.2024.07.30.07.09.02; Tue, 30 Jul 2024 07:09:02 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B628068D784; Tue, 30 Jul 2024 17:08:58 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mailfish.xiph.org (mailfish.xiph.osuosl.org [140.211.166.35]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4883B68D65B for ; Tue, 30 Jul 2024 17:08:51 +0300 (EEST) Received: from localhost.localdomain (c-24-126-94-29.hsd1.va.comcast.net [24.126.94.29]) by mailfish.xiph.org (Postfix) with ESMTPSA id AFF049F81F; Tue, 30 Jul 2024 14:08:49 +0000 (UTC) From: "Nathan E. Egge" To: ffmpeg-devel@ffmpeg.org Date: Tue, 30 Jul 2024 14:07:52 +0000 Message-ID: <20240730140751.5114-2-unlord@xiph.org> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavu/riscv: Fallback to getauxval() for cpu flags 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 Cc: "Nathan E. Egge" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: GWOHIqN8hAaF Signed-off-by: Nathan E. Egge --- libavutil/riscv/cpu.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libavutil/riscv/cpu.c b/libavutil/riscv/cpu.c index e035f4b024..13b939b9d9 100644 --- a/libavutil/riscv/cpu.c +++ b/libavutil/riscv/cpu.c @@ -90,7 +90,8 @@ int ff_get_cpu_flags_riscv(void) default: } } -#elif HAVE_GETAUXVAL +#endif +#if HAVE_GETAUXVAL { const unsigned long hwcap = getauxval(AT_HWCAP); @@ -100,14 +101,16 @@ int ff_get_cpu_flags_riscv(void) ret |= AV_CPU_FLAG_RVF; if (hwcap & HWCAP_RV('D')) ret |= AV_CPU_FLAG_RVD; - if (hwcap & HWCAP_RV('B')) - ret |= AV_CPU_FLAG_RVB_ADDR | AV_CPU_FLAG_RVB_BASIC | - AV_CPU_FLAG_RVB; /* The V extension implies all Zve* functional subsets */ if (hwcap & HWCAP_RV('V')) ret |= AV_CPU_FLAG_RVV_I32 | AV_CPU_FLAG_RVV_I64 | AV_CPU_FLAG_RVV_F32 | AV_CPU_FLAG_RVV_F64; + + /* The V extension implies Zb* on all existing hardware */ + if (hwcap & (HWCAP_RV('B') | HWCAP_RV('V'))) + ret |= AV_CPU_FLAG_RVB_ADDR | AV_CPU_FLAG_RVB_BASIC | + AV_CPU_FLAG_RVB; } #endif