Browse Source

add patch for dav1d

Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
Rebecca Chang Swee Fun 1 year ago
parent
commit
448573566d
1 changed files with 88 additions and 0 deletions
  1. 88 0
      third_party/0004-third_party-dav1d-enable-riscv64-build.patch

+ 88 - 0
third_party/0004-third_party-dav1d-enable-riscv64-build.patch

@@ -0,0 +1,88 @@
+From d9c99a9bfab6bc33850ad2d3c90219cce73c4170 Mon Sep 17 00:00:00 2001
+From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
+Date: Thu, 9 Jun 2022 04:09:14 +0000
+Subject: [PATCH] third_party/dav1d: enable riscv64 build
+
+Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
+Change-Id: I52af220f329c52f6e5bb55c08980ee77ab8fe88e
+---
+ third_party/dav1d/BUILD.gn                    |  2 +
+ .../dav1d/config/linux-noasm/riscv64/config.h | 40 +++++++++++++++++++
+ third_party/dav1d/generate_configs.py         |  1 +
+ 3 files changed, 43 insertions(+)
+ create mode 100644 third_party/dav1d/config/linux-noasm/riscv64/config.h
+
+diff --git a/third_party/dav1d/BUILD.gn b/third_party/dav1d/BUILD.gn
+index 82c828c68fb4f..bb14440154ec2 100644
+--- a/third_party/dav1d/BUILD.gn
++++ b/third_party/dav1d/BUILD.gn
+@@ -17,6 +17,8 @@ if (is_win) {
+   assert(current_cpu == "x64" && (is_linux || is_chromeos),
+          "Only Linux X64 MSAN is supported")
+   platform_config_root = "config/linux-noasm/$current_cpu"
++} else if (current_cpu == "riscv64") {
++  platform_config_root = "config/linux-noasm/$current_cpu"
+ } else {
+   # Linux configuration files seem to work on Mac, so just reuse them.
+   platform_config_root = "config/linux/$current_cpu"
+diff --git a/third_party/dav1d/config/linux-noasm/riscv64/config.h b/third_party/dav1d/config/linux-noasm/riscv64/config.h
+new file mode 100644
+index 0000000000000..04e9f42fc1ed6
+--- /dev/null
++++ b/third_party/dav1d/config/linux-noasm/riscv64/config.h
+@@ -0,0 +1,40 @@
++/*
++ * Autogenerated by the Meson build system.
++ * Do not edit, your changes will be lost.
++ */
++
++#pragma once
++
++#define ARCH_AARCH64 0
++
++#define ARCH_ARM 0
++
++#define ARCH_PPC64LE 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_ASM 0
++
++#define HAVE_CLOCK_GETTIME 1
++
++#define HAVE_DLSYM 1
++
++#define HAVE_POSIX_MEMALIGN 1
++
++// #define HAVE_PTHREAD_GETAFFINITY_NP 1 -- Controlled by Chomium
++
++#define HAVE_UNISTD_H 1
++
++// #define STACK_ALIGNMENT 32 -- Stack alignment is controlled by Chromium
+diff --git a/third_party/dav1d/generate_configs.py b/third_party/dav1d/generate_configs.py
+index 609b11e47a726..3cc497235a82f 100755
+--- a/third_party/dav1d/generate_configs.py
++++ b/third_party/dav1d/generate_configs.py
+@@ -194,6 +194,7 @@ def main():
+ 
+     GenerateConfig('config/linux/x64', linux_env)
+     GenerateConfig('config/linux-noasm/x64', linux_env, ['-Denable_asm=false'])
++    GenerateConfig('config/linux-noasm/riscv64', linux_env, ['-Denable_asm=false'])
+ 
+     GenerateConfig('config/linux/x86', linux_env,
+                    ['--cross-file', '../crossfiles/linux32.crossfile'])
+-- 
+2.25.1
+