FFmpeg/libavdevice
Rémi Denis-Courmont 378d1b06c3 riscv: probe for Zbb extension at load time
Due to hysterical raisins, most RISC-V Linux distributions target a
RV64GC baseline excluding the Bit-manipulation ISA extensions, most
notably:
- Zba: address generation extension and
- Zbb: basic bit manipulation extension.
Most CPUs that would make sense to run FFmpeg on support Zba and Zbb
(including the current FATE runner), so it makes sense to optimise for
them. In fact a large chunk of existing assembler optimisations relies
on Zba and/or Zbb.

Since we cannot patch shared library code, the next best thing is to
carry a flag initialised at load-time and check it on need basis.
This results in 3 instructions overhead on isolated use, e.g.:
1:  AUIPC rd, %pcrel_hi(ff_rv_zbb_supported)
    LBU   rd, %pcrel_lo(1b)(rd)
    BEQZ  rd, non_Zbb_fallback_code
    // Zbb code here

The C compiler will typically load the flag ahead of time to reducing
latency, and can also keep it around if Zbb is used multiple times in a
single optimisation scope. For this to work, the flag symbol must be
hidden; otherwise the optimisation degrades with a GOT look-up to
support interposition:
1:  AUIPC rd, GOT_OFFSET_HI
    LD    rd, GOT_OFFSET_LO(rd)
    LBU   rd, (rd)
    BEQZ  rd, non_Zbb_fallback_code
    // Zbb code here

This patch adds code to provision the flag in libraries using bit
manipulation functions from libavutil: byte-swap, bit-weight and
counting leading or trailing zeroes.
2024-06-11 20:12:37 +03:00
..
riscv riscv: probe for Zbb extension at load time 2024-06-11 20:12:37 +03:00
tests
.gitignore
alldevices.c avdevice/alldevices: Mark iterators as av_cold 2024-03-17 15:10:05 +01:00
alsa_dec.c avformat/avformat: Add FFInputFormat, hide internals of AVInputFormat 2024-03-07 08:53:31 -03:00
alsa_enc.c avutil: remove deprecated FF_API_PKT_DURATION 2024-03-07 08:53:30 -03:00
alsa.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
alsa.h
android_camera.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
audiotoolbox.m avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
avdevice.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
avdevice.h avdevice: remove FF_API_DEVICE_CAPABILITIES 2023-02-09 15:35:14 +01:00
avdeviceres.rc
avfoundation.m avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
bktr.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
caca.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
ccfifo.c avdevice/decklink_enc: add support for playout of 608 captions in MOV files 2023-05-11 22:06:20 +08:00
decklink_common_c.h avdevice/decklink_enc: add support for SMPTE 2038 VANC packet output 2023-07-02 19:57:45 +02:00
decklink_common.cpp avdevice/decklink_enc: add support for SMPTE 2038 VANC packet output 2023-07-02 19:57:45 +02:00
decklink_common.h avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
decklink_dec_c.c avformat/avformat: Add FFInputFormat, hide internals of AVInputFormat 2024-03-07 08:53:31 -03:00
decklink_dec.cpp avdevice/decklink_dec: add explicit specifier 2023-11-21 08:02:29 +08:00
decklink_dec.h
decklink_enc_c.c all: use designated initializers for AVOption.unit 2024-02-14 14:53:41 +01:00
decklink_enc.cpp avformat/vapoursynth: Add missing inclusion of frame.h 2023-09-10 17:32:11 +02:00
decklink_enc.h
dshow_capture.h configure: Set WIN32_LEAN_AND_MEAN at configure time 2023-08-14 22:57:28 +03:00
dshow_common.c
dshow_crossbar.c
dshow_enummediatypes.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
dshow_enumpins.c
dshow_filter.c
dshow_pin.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
dshow.c avdevice/dshow: fix badly indented line 2024-05-28 03:48:04 +02:00
fbdev_common.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
fbdev_common.h
fbdev_dec.c avformat/avformat: Add FFInputFormat, hide internals of AVInputFormat 2024-03-07 08:53:31 -03:00
fbdev_enc.c Revert "all: Don't set AVClass.item_name to its default value" 2024-01-20 10:34:48 +01:00
file_open.c
gdigrab.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
iec61883.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
internal.h
jack.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
kmsgrab.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
lavfi.c avformat/internal: Move FF_FMT_INIT_CLEANUP to demux.h 2024-03-26 06:36:43 +01:00
libavdevice.v
libcdio.c avformat/avformat: Add FFInputFormat, hide internals of AVInputFormat 2024-03-07 08:53:31 -03:00
libdc1394.c avformat/avformat: Add FFInputFormat, hide internals of AVInputFormat 2024-03-07 08:53:31 -03:00
Makefile avdevice/decklink_enc: add support for playout of 608 captions in MOV files 2023-05-11 22:06:20 +08:00
openal-dec.c avformat/avformat: Add FFInputFormat, hide internals of AVInputFormat 2024-03-07 08:53:31 -03:00
opengl_enc_shaders.h
opengl_enc.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
oss_dec.c avformat/avformat: Add FFInputFormat, hide internals of AVInputFormat 2024-03-07 08:53:31 -03:00
oss_enc.c Revert "all: Don't set AVClass.item_name to its default value" 2024-01-20 10:34:48 +01:00
oss.c avutil/internal: Move avpriv-file API to a header of its own 2022-09-03 15:41:44 +02:00
oss.h
pulse_audio_common.c
pulse_audio_common.h avdevice/pulse_audio_common: Avoid inclusion of avcodec.h 2023-08-05 09:40:06 +02:00
pulse_audio_dec.c avformat/avformat: Add FFInputFormat, hide internals of AVInputFormat 2024-03-07 08:53:31 -03:00
pulse_audio_enc.c avdevice/pulse_audio_enc: Use av_rescale() to avoid integer overflow 2024-06-01 18:01:05 +02:00
reverse.c
sdl2.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
sndio_dec.c avformat/avformat: Add FFInputFormat, hide internals of AVInputFormat 2024-03-07 08:53:31 -03:00
sndio_enc.c Revert "all: Don't set AVClass.item_name to its default value" 2024-01-20 10:34:48 +01:00
sndio.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
sndio.h
timefilter.c
timefilter.h
utils.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
v4l2-common.c
v4l2-common.h
v4l2.c lavd/v4l2: Use proper field type for second parameter of ioctl() with BSD's 2024-05-08 21:33:32 +02:00
v4l2enc.c Revert "all: Don't set AVClass.item_name to its default value" 2024-01-20 10:34:48 +01:00
version_major.h libs: bump major version for all libraries 2024-03-07 11:29:43 -03:00
version.c lib*/version: Use static_assert for static asserts 2024-03-31 00:08:42 +01:00
version.h Bump after 7.0 branch point 2024-03-27 01:04:54 +01:00
vfwcap.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
xcbgrab.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
xv.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00