Skip to content

Commit

Permalink
Fix dav1d Windows arm64 + roll dav1d ace3855a6..589e96a1f (29 commits)
Browse files Browse the repository at this point in the history
Adds support for Windows ARM64 by cloning the x64 config and turning it
into a arm64 one. Unfortunately meson (the build system dav1d uses)
doesn't support clang-cl + arm64, so this is the best we can do for now.

Also removes the need for wine when generating Windows configurations,
since we don't care about running the tests anyways. Fixes typo in the
win64 config which didn't matter too.

https://chromium.googlesource.com/external/github.com/videolan/dav1d.git/+log/ace3855a6037..589e96a1f2cf

$ git log ace3855a6..589e96a1f --date=short --no-merges --format='%ad %ae %s'
2019-04-18 liwei Add SSSE3 implementation for the {16, 32, 64}x64 and 64 x{16, 32} blocks in itx
2019-04-16 rsbultje Over-allocate level array by 3-bytes
2019-03-30 martin arm64: loopfilter: Implement NEON loop filters
2019-02-24 martin arm64: looprestoration: Add a NEON implementation of SGR
2019-04-16 martin msac: Add a cast to indicate intended narrowing from size_t to unsigned
2019-04-11 gramner x86-64: Add msac_decode_symbol_adapt SSE2 asm
2019-04-10 xuefeng Add SSSE3 implementation for ipred_paeth
2019-04-08 martin arm: Add a _neon suffix to all internal functions
2019-04-08 martin arm: Fix typos in comments
2019-04-03 martin arm: Consistently use 8/24 columns indentation for assembly
2019-04-04 xuefeng Add SSSE3 implementation for ipred_cfl_ac_444
2019-03-28 gramner CI: Check for newline at end of file
2019-03-21 victorien.lecouviour.tuffet x86: cdef_dir: optimize best cost finding for SSE
2019-03-19 victorien.lecouviour.tuffet x86: cdef_filter: use 8-bit arithmetic for SSE
2019-03-12 victorien.lecouviour.tuffet x86: cdef_filter: use a better constant for SSE4
2019-03-26 victorien.lecouviour.tuffet x86: cdef_filter: fix macro case (lower to upper)
2019-03-25 liwei Add SSSE3 implementation for the 16x32,32x16 and 32x32 blocks in itx
2019-03-25 gramner build: Split x86 asm files per bitdepth
2019-03-24 martin Only define DAV1D_API to dllexport when building dav1d itself
2019-03-24 gramner Simplify C for inverse transforms
2019-03-20 gramner x86: Add minor CDEF AVX2 optimizations
2019-03-15 liwei Add SSSE3 implementation for the 8x32 and 32x8 blocks in itx
2019-03-18 xuefeng Add SSSE3 implementation for ipred_cfl_ac_420 and ipred_cfl_ac_422
2019-03-16 jamrial decode: add a frame tile data buffer size check
2019-03-16 jamrial decode: don't realloc the tile data buffer when it needs to be enlarged
2019-03-13 janne-vlc tools/dav1d/md5: bswap big endian high bit depth pixel data
2019-02-27 janne-vlc tools/dav1d: make the md5 muxer endian-aware
2019-03-13 jb On the road to 0.2.2
2019-03-09 jamrial build: use the project version as product version in the windows resource file

Created with:
  roll-dep src/third_party/dav1d/libdav1d

BUG=938190,941022
R=chcunningham

Change-Id: Id0e4545219009e18b1bb0011ae616301ed50a98d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1574199
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Commit-Queue: Chrome Cunningham <chcunningham@chromium.org>
Auto-Submit: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Chrome Cunningham <chcunningham@chromium.org>
Cr-Commit-Position: refs/heads/master@{#652417}
  • Loading branch information
dalecurtis authored and Commit Bot committed Apr 19, 2019
1 parent fda4463 commit 53a914e
Show file tree
Hide file tree
Showing 15 changed files with 83 additions and 25 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ deps = {
Var('chromium_git') + '/angle/angle.git' + '@' + Var('angle_revision'),

'src/third_party/dav1d/libdav1d':
Var('chromium_git') + '/external/github.com/videolan/dav1d.git' + '@' + 'ace3855a60379a76624bc01d74bae7fc40233c54',
Var('chromium_git') + '/external/github.com/videolan/dav1d.git' + '@' + '589e96a1f2cff8e803c79eec48509fa4a792f1d9',

'src/third_party/dawn':
Var('dawn_git') + '/dawn.git' + '@' + Var('dawn_revision'),
Expand Down
11 changes: 2 additions & 9 deletions media/media_options.gni
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,8 @@ declare_args() {
# are combined and we could override more logging than expected.
enable_logging_override = !use_jumbo_build && is_chromecast

if (is_win && target_cpu == "arm64") {
# TODO: Enable dav1d for Windows ARM64. https://crbug.com/941022
enable_dav1d_decoder = false
} else if (is_fuchsia) {
# TODO: Fix media_unittests for fuchsia X64. https://crbug.com/930300
enable_dav1d_decoder = false
} else {
enable_dav1d_decoder = !is_android && !is_ios
}
# TODO(crbug.com/930300): Fix media_unittests for fuchsia X64.
enable_dav1d_decoder = !is_android && !is_ios && !is_fuchsia
}

declare_args() {
Expand Down
6 changes: 3 additions & 3 deletions third_party/dav1d/README.chromium
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Name: dav1d is an AV1 decoder :)
Short Name: dav1d
URL: https://code.videolan.org/videolan/dav1d
Version: dce4e788614bf8c2e353b7157e7b59b34b177779
Version: 589e96a1f2cff8e803c79eec48509fa4a792f1d9
License: 2-Clause BSD
License File: LICENSE
Security Critical: yes
Expand All @@ -19,8 +19,8 @@ and source listing.

First have clang (//third_party/llvm-build/Release+Asserts/bin), clang-cl
(https://chromium.googlesource.com/chromium/src/+/lkgr/docs/win_cross.md),
meson (https://github.com/mesonbuild/meson/releases), and wine
(https://www.winehq.org/) in your path. Then you can run ./generate_configs.py
and meson (https://github.com/mesonbuild/meson/releases) in your path. Then you
can run ./generate_configs.py

Next you should update the dav1d_generated.gni file, to that run the
./generate_sources.py command.
Expand Down
2 changes: 2 additions & 0 deletions third_party/dav1d/config/linux-noasm/x64/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

// #define CONFIG_LOG 1 -- Logging is controlled by Chromium

#define ENDIANNESS_BIG 0

#define HAVE_ASM 0

#define HAVE_POSIX_MEMALIGN 1
Expand Down
2 changes: 2 additions & 0 deletions third_party/dav1d/config/linux/arm/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

// #define CONFIG_LOG 1 -- Logging is controlled by Chromium

#define ENDIANNESS_BIG 0

#define HAVE_ASM 1

#define HAVE_AS_FUNC 0
Expand Down
2 changes: 2 additions & 0 deletions third_party/dav1d/config/linux/arm64/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

// #define CONFIG_LOG 1 -- Logging is controlled by Chromium

#define ENDIANNESS_BIG 0

#define HAVE_ASM 1

#define HAVE_AS_FUNC 0
Expand Down
2 changes: 2 additions & 0 deletions third_party/dav1d/config/linux/x64/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

// #define CONFIG_LOG 1 -- Logging is controlled by Chromium

#define ENDIANNESS_BIG 0

#define HAVE_ASM 1

#define HAVE_POSIX_MEMALIGN 1
Expand Down
2 changes: 2 additions & 0 deletions third_party/dav1d/config/linux/x86/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

// #define CONFIG_LOG 1 -- Logging is controlled by Chromium

#define ENDIANNESS_BIG 0

#define HAVE_ASM 1

#define HAVE_POSIX_MEMALIGN 1
Expand Down
32 changes: 32 additions & 0 deletions third_party/dav1d/config/win/arm64/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Autogenerated by the Meson build system.
* Do not edit, your changes will be lost.
*/

#pragma once

#define ARCH_AARCH64 1

#define ARCH_ARM 0

#define ARCH_X86 0

#define ARCH_X86_32 0

#define ARCH_X86_64 0

#define CONFIG_16BPC 1

#define CONFIG_8BPC 1

// #define CONFIG_LOG 1 -- Logging is controlled by Chromium

#define ENDIANNESS_BIG 0

#define HAVE_ALIGNED_MALLOC 1

#define HAVE_ASM 1

#define HAVE_IO_H 1

// #define STACK_ALIGNMENT 16 -- Stack alignment is controlled by Chromium
2 changes: 2 additions & 0 deletions third_party/dav1d/config/win/x64/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

// #define CONFIG_LOG 1 -- Logging is controlled by Chromium

#define ENDIANNESS_BIG 0

#define HAVE_ALIGNED_MALLOC 1

#define HAVE_ASM 1
Expand Down
2 changes: 2 additions & 0 deletions third_party/dav1d/config/win/x86/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

// #define CONFIG_LOG 1 -- Logging is controlled by Chromium

#define ENDIANNESS_BIG 0

#define HAVE_ALIGNED_MALLOC 1

#define HAVE_ASM 1
Expand Down
2 changes: 0 additions & 2 deletions third_party/dav1d/crossfiles/win32.crossfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
[binaries]
c = 'clang-cl'
ar = 'llvm-ar'
exe_wrapper = 'wine'

[properties]
needs_exe_wrapper = true
c_args = ['-m32', '-fuse-ld=lld',]


Expand Down
4 changes: 1 addition & 3 deletions third_party/dav1d/crossfiles/win64.crossfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
[binaries]
c = 'clang-cl'
ar = 'llvm-ar'
exe_wrapper = 'wine'

[properties]
needs_exe_wrapper = true
c_args = ['-fuse-ld=lld',]

[host_machine]
system = 'win'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'
cpp_winlibs = ['adsg']
cpp_winlibs = []
5 changes: 4 additions & 1 deletion third_party/dav1d/dav1d_generated.gni
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

x86_asm_sources = [
"libdav1d/src/x86/cdef.asm",
"libdav1d/src/x86/cdef_ssse3.asm",
"libdav1d/src/x86/cdef_sse.asm",
"libdav1d/src/x86/cpuid.asm",
"libdav1d/src/x86/ipred.asm",
"libdav1d/src/x86/ipred_ssse3.asm",
Expand All @@ -17,6 +17,7 @@ x86_asm_sources = [
"libdav1d/src/x86/looprestoration_ssse3.asm",
"libdav1d/src/x86/mc.asm",
"libdav1d/src/x86/mc_ssse3.asm",
"libdav1d/src/x86/msac.asm",
]

x86_template_sources = [
Expand All @@ -36,13 +37,15 @@ arm32_asm_sources = [

arm64_asm_sources = [
"libdav1d/src/arm/64/cdef.S",
"libdav1d/src/arm/64/loopfilter.S",
"libdav1d/src/arm/64/looprestoration.S",
"libdav1d/src/arm/64/mc.S",
"libdav1d/src/arm/64/util.S",
]

arm_template_sources = [
"libdav1d/src/arm/cdef_init_tmpl.c",
"libdav1d/src/arm/loopfilter_init_tmpl.c",
"libdav1d/src/arm/looprestoration_init_tmpl.c",
"libdav1d/src/arm/mc_init_tmpl.c",
]
Expand Down
32 changes: 26 additions & 6 deletions third_party/dav1d/generate_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,21 @@ def GenerateConfig(config_dir, env, special_args=[]):
CopyConfigsAndCleanup(temp_dir, config_dir)


def GenerateWindowsArm64Config(src_dir):
win_arm64_dir = 'config/win/arm64'
if not os.path.exists(win_arm64_dir):
os.makedirs(win_arm64_dir)

shutil.copy(os.path.join(src_dir, 'config.h'), win_arm64_dir)

# Flip flags such that it looks like an arm64 configuration.
RewriteFile(
os.path.join(win_arm64_dir, 'config.h'),
[(r'#define ARCH_X86 1', r'#define ARCH_X86 0'),
(r'#define ARCH_X86_64 1', r'#define ARCH_X86_64 0'),
(r'#define ARCH_AARCH64 0', r'#define ARCH_AARCH64 1')])


def main():
linux_env = os.environ
linux_env['CC'] = 'clang'
Expand All @@ -153,14 +168,19 @@ def main():
['--cross-file', '../crossfiles/arm64.crossfile'])

win_x86_env = SetupWindowsCrossCompileToolchain('x86')
GenerateConfig(
'config/win/x86', win_x86_env,
['--cross-file', '../crossfiles/win32.crossfile'] + WINDOWS_BUILD_ARGS)
GenerateConfig('config/win/x86', win_x86_env,
['--cross-file', '../crossfiles/win32.crossfile'] +
WINDOWS_BUILD_ARGS)

win_x64_dir = 'config/win/x64'
win_x64_env = SetupWindowsCrossCompileToolchain('x64')
GenerateConfig(
'config/win/x64', win_x64_env,
['--cross-file', '../crossfiles/win64.crossfile'] + WINDOWS_BUILD_ARGS)
GenerateConfig(win_x64_dir, win_x64_env,
['--cross-file', '../crossfiles/win64.crossfile'] +
WINDOWS_BUILD_ARGS)

# Sadly meson doesn't support arm64 + clang-cl, so we need to create the
# Windows arm64 config from the Windows x64 config.
GenerateWindowsArm64Config(win_x64_dir)


if __name__ == '__main__':
Expand Down

0 comments on commit 53a914e

Please sign in to comment.