Skip to content

Commit 8966466

Browse files
committed
Bug 1875883 - Update dav1d to a6878be7e07114f5a2915ad46300700f0db55197 r=media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D200241
1 parent 80236c4 commit 8966466

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+19328
-1499
lines changed

media/libdav1d/moz.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ origin:
2020

2121
# Human-readable identifier for this version/release
2222
# Generally "version NNN", "tag SSS", "bookmark SSS"
23-
release: 746ab8b4f3021d7263c64d6b5d6f1e2c281c7acc (2023-12-19T13:15:43.000+01:00).
23+
release: a6878be7e07114f5a2915ad46300700f0db55197 (2024-01-31T06:04:21.000-05:00).
2424

2525
# Revision to pull in
2626
# Must be a long or short commit SHA (long preferred)
27-
revision: 746ab8b4f3021d7263c64d6b5d6f1e2c281c7acc
27+
revision: a6878be7e07114f5a2915ad46300700f0db55197
2828

2929
# The package's license, where possible using the mnemonic from
3030
# https://spdx.org/licenses/

media/libdav1d/vcs_version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
/* auto-generated, do not edit */
2-
#define DAV1D_VERSION "746ab8b4f3021d7263c64d6b5d6f1e2c281c7acc"
2+
#define DAV1D_VERSION "a6878be7e07114f5a2915ad46300700f0db55197"

third_party/dav1d/include/common/attributes.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
#define ALIGN_64_VAL 64
6161
#define ALIGN_32_VAL 32
6262
#define ALIGN_16_VAL 16
63-
#elif ARCH_X86_32 || ARCH_ARM || ARCH_AARCH64 || ARCH_PPC64LE
63+
#elif ARCH_AARCH64 || ARCH_ARM || ARCH_LOONGARCH || ARCH_PPC64LE || ARCH_X86_32
6464
/* ARM doesn't benefit from anything more than 16-byte alignment. */
6565
#define ALIGN_64_VAL 16
6666
#define ALIGN_32_VAL 16

third_party/dav1d/meson.build

+17-5
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,13 @@ endforeach
6262

6363
# ASM option
6464
is_asm_enabled = (get_option('enable_asm') == true and
65-
(host_machine.cpu_family() == 'x86' or
66-
(host_machine.cpu_family() == 'x86_64' and cc.get_define('__ILP32__').strip() == '') or
67-
host_machine.cpu_family() == 'aarch64' or
65+
(host_machine.cpu_family() == 'aarch64' or
6866
host_machine.cpu_family().startswith('arm') or
69-
host_machine.cpu() == 'ppc64le'))
67+
host_machine.cpu() == 'ppc64le' or
68+
host_machine.cpu_family().startswith('riscv') or
69+
host_machine.cpu_family().startswith('loongarch') or
70+
host_machine.cpu_family() == 'x86' or
71+
(host_machine.cpu_family() == 'x86_64' and cc.get_define('__ILP32__').strip() == '')))
7072
cdata.set10('HAVE_ASM', is_asm_enabled)
7173

7274
if is_asm_enabled and get_option('b_sanitize') == 'memory'
@@ -232,7 +234,9 @@ endif
232234

233235
if (host_machine.cpu_family() == 'aarch64' or
234236
host_machine.cpu_family().startswith('arm') or
235-
host_machine.cpu() == 'ppc64le')
237+
host_machine.cpu_family().startswith('loongarch') or
238+
host_machine.cpu() == 'ppc64le' or
239+
host_machine.cpu_family().startswith('riscv'))
236240
if cc.has_function('getauxval', prefix : '#include <sys/auxv.h>', args : test_args)
237241
cdata.set('HAVE_GETAUXVAL', 1)
238242
endif
@@ -379,6 +383,14 @@ endif
379383

380384
cdata.set10('ARCH_PPC64LE', host_machine.cpu() == 'ppc64le')
381385

386+
cdata.set10('ARCH_RISCV', host_machine.cpu_family().startswith('riscv'))
387+
cdata.set10('ARCH_RV32', host_machine.cpu_family() == 'riscv32')
388+
cdata.set10('ARCH_RV64', host_machine.cpu_family() == 'riscv64')
389+
390+
cdata.set10('ARCH_LOONGARCH', host_machine.cpu_family().startswith('loongarch'))
391+
cdata.set10('ARCH_LOONGARCH32', host_machine.cpu_family() == 'loongarch32')
392+
cdata.set10('ARCH_LOONGARCH64', host_machine.cpu_family() == 'loongarch64')
393+
382394
# meson's cc.symbols_have_underscore_prefix() is unfortunately unrelieably
383395
# when additional flags like '-fprofile-instr-generate' are passed via CFLAGS
384396
# see following meson issue https://github.com/mesonbuild/meson/issues/5482

third_party/dav1d/meson_options.txt

+5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ option('enable_tests',
2525
value: true,
2626
description: 'Build dav1d tests')
2727

28+
option('enable_seek_stress',
29+
type: 'boolean',
30+
value: false,
31+
description: 'Build seek_stress test tool')
32+
2833
option('enable_docs',
2934
type: 'boolean',
3035
value: false,

third_party/dav1d/src/cpu.c

+4
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,12 @@ COLD void dav1d_init_cpu(void) {
5656
// memory sanitizer is inherently incompatible with asm
5757
#if ARCH_AARCH64 || ARCH_ARM
5858
dav1d_cpu_flags = dav1d_get_cpu_flags_arm();
59+
#elif ARCH_LOONGARCH
60+
dav1d_cpu_flags = dav1d_get_cpu_flags_loongarch();
5961
#elif ARCH_PPC64LE
6062
dav1d_cpu_flags = dav1d_get_cpu_flags_ppc();
63+
#elif ARCH_RISCV
64+
dav1d_cpu_flags = dav1d_get_cpu_flags_riscv();
6165
#elif ARCH_X86
6266
dav1d_cpu_flags = dav1d_get_cpu_flags_x86();
6367
#endif

third_party/dav1d/src/cpu.h

+8
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,12 @@
3737

3838
#if ARCH_AARCH64 || ARCH_ARM
3939
#include "src/arm/cpu.h"
40+
#elif ARCH_LOONGARCH
41+
#include "src/loongarch/cpu.h"
4042
#elif ARCH_PPC64LE
4143
#include "src/ppc/cpu.h"
44+
#elif ARCH_RISCV
45+
#include "src/riscv/cpu.h"
4246
#elif ARCH_X86
4347
#include "src/x86/cpu.h"
4448
#endif
@@ -64,6 +68,10 @@ static ALWAYS_INLINE unsigned dav1d_get_cpu_flags(void) {
6468
#if defined(__VSX__)
6569
flags |= DAV1D_PPC_CPU_FLAG_VSX;
6670
#endif
71+
#elif ARCH_RISCV
72+
#if defined(__riscv_v)
73+
flags |= DAV1D_RISCV_CPU_FLAG_V;
74+
#endif
6775
#elif ARCH_X86
6876
#if defined(__AVX512F__) && defined(__AVX512CD__) && \
6977
defined(__AVX512BW__) && defined(__AVX512DQ__) && \

third_party/dav1d/src/itx_tmpl.c

+10
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ static void inv_txfm_add_wht_wht_4x4_c(pixel *dst, const ptrdiff_t stride,
183183
#if HAVE_ASM
184184
#if ARCH_AARCH64 || ARCH_ARM
185185
#include "src/arm/itx.h"
186+
#elif ARCH_LOONGARCH64
187+
#include "src/loongarch/itx.h"
188+
#elif ARCH_RISCV
189+
#include "src/riscv/itx.h"
186190
#elif ARCH_X86
187191
#include "src/x86/itx.h"
188192
#endif
@@ -257,6 +261,12 @@ COLD void bitfn(dav1d_itx_dsp_init)(Dav1dInvTxfmDSPContext *const c, int bpc) {
257261
#if ARCH_AARCH64 || ARCH_ARM
258262
itx_dsp_init_arm(c, bpc);
259263
#endif
264+
#if ARCH_LOONGARCH64
265+
itx_dsp_init_loongarch(c, bpc);
266+
#endif
267+
#if ARCH_RISCV
268+
itx_dsp_init_riscv(c, bpc);
269+
#endif
260270
#if ARCH_X86
261271
itx_dsp_init_x86(c, bpc);
262272
#endif

third_party/dav1d/src/loongarch/cpu.c

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright © 2023, VideoLAN and dav1d authors
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are met:
7+
*
8+
* 1. Redistributions of source code must retain the above copyright notice, this
9+
* list of conditions and the following disclaimer.
10+
*
11+
* 2. Redistributions in binary form must reproduce the above copyright notice,
12+
* this list of conditions and the following disclaimer in the documentation
13+
* and/or other materials provided with the distribution.
14+
*
15+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
19+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25+
*/
26+
27+
#include "config.h"
28+
#include "common/attributes.h"
29+
#include "src/loongarch/cpu.h"
30+
31+
#if defined(HAVE_GETAUXVAL)
32+
#include <sys/auxv.h>
33+
34+
#define LA_HWCAP_LSX ( 1 << 4 )
35+
#define LA_HWCAP_LASX ( 1 << 5 )
36+
#endif
37+
38+
COLD unsigned dav1d_get_cpu_flags_loongarch(void) {
39+
unsigned flags = 0;
40+
#if defined(HAVE_GETAUXVAL)
41+
unsigned long hw_cap = getauxval(AT_HWCAP);
42+
flags |= (hw_cap & LA_HWCAP_LSX) ? DAV1D_LOONGARCH_CPU_FLAG_LSX : 0;
43+
flags |= (hw_cap & LA_HWCAP_LASX) ? DAV1D_LOONGARCH_CPU_FLAG_LASX : 0;
44+
#endif
45+
46+
return flags;
47+
}

third_party/dav1d/src/loongarch/cpu.h

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright © 2023, VideoLAN and dav1d authors
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are met:
7+
*
8+
* 1. Redistributions of source code must retain the above copyright notice, this
9+
* list of conditions and the following disclaimer.
10+
*
11+
* 2. Redistributions in binary form must reproduce the above copyright notice,
12+
* this list of conditions and the following disclaimer in the documentation
13+
* and/or other materials provided with the distribution.
14+
*
15+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
19+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25+
*/
26+
27+
#ifndef DAV1D_SRC_LOONGARCH_CPU_H
28+
#define DAV1D_SRC_LOONGARCH_CPU_H
29+
30+
enum CpuFlags {
31+
DAV1D_LOONGARCH_CPU_FLAG_LSX = 1 << 0,
32+
DAV1D_LOONGARCH_CPU_FLAG_LASX = 1 << 1,
33+
};
34+
35+
unsigned dav1d_get_cpu_flags_loongarch(void);
36+
37+
#endif /* DAV1D_SRC_LOONGARCH_CPU_H */

0 commit comments

Comments
 (0)