mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-03-01 01:40:29 -05:00
spa/support: implement RISCV V CPU detection
This commit is contained in:
parent
e2991f6398
commit
8166b9c580
5 changed files with 60 additions and 1 deletions
29
spa/plugins/support/cpu-riscv.c
Normal file
29
spa/plugins/support/cpu-riscv.c
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/* Spa */
|
||||
/* SPDX-FileCopyrightText: Copyright (c) 2023 Institue of Software Chinese Academy of Sciences (ISCAS). */
|
||||
/* SPDX-License-Identifier: MIT */
|
||||
|
||||
#ifdef HAVE_SYS_AUXV_H
|
||||
#include <sys/auxv.h>
|
||||
#define HWCAP_RV(letter) (1ul << ((letter) - 'A'))
|
||||
#endif
|
||||
|
||||
static int
|
||||
riscv_init(struct impl *impl)
|
||||
{
|
||||
uint32_t flags = 0;
|
||||
|
||||
#ifdef HAVE_SYS_AUXV_H
|
||||
const unsigned long hwcap = getauxval(AT_HWCAP);
|
||||
if (hwcap & HWCAP_RV('V'))
|
||||
flags |= SPA_CPU_FLAG_RISCV_V;
|
||||
#endif
|
||||
|
||||
impl->flags = flags;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int riscv_zero_denormals(void *object, bool enable)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue