From 8b4aa7cef9538729e1945778b65c46e6ae42f711 Mon Sep 17 00:00:00 2001 From: Prashanth Swaminathan Date: Wed, 3 May 2023 16:01:20 -0700 Subject: [PATCH] Add RVV files to Android and GN builds Include row_rvv.cc source file and support for riscv64 builds in Android and GN builds. Adds GN build flag to disable RISC-V vector operations. Switches dynamic linker to 64-bit by default, with exceptions for 32-bit targets as defined in //build/config/android/abi.gni. Bug: b/280364043 Test: Verified local build via Android and GN. Change-Id: I1bbd36f16aafa16d4bfd117de03354be79743a9d Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/4501727 Reviewed-by: Mirko Bonadei Commit-Queue: Prashanth Swaminathan Reviewed-by: Frank Barchard --- Android.bp | 1 + BUILD.gn | 19 ++++++++++++------- libyuv.gni | 1 + 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Android.bp b/Android.bp index 361562870..9811a7b3d 100644 --- a/Android.bp +++ b/Android.bp @@ -62,6 +62,7 @@ cc_library { "source/row_msa.cc", "source/row_neon.cc", "source/row_neon64.cc", + "source/row_rvv.cc", "source/scale.cc", "source/scale_any.cc", "source/scale_argb.cc", diff --git a/BUILD.gn b/BUILD.gn index f92a55298..adaae9d85 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -22,15 +22,19 @@ declare_args() { config("libyuv_config") { include_dirs = [ "include" ] - if (is_android && current_cpu == "arm64") { - ldflags = [ "-Wl,--dynamic-linker,/system/bin/linker64" ] + if (is_android) { + if (target_cpu == "arm" || target_cpu == "x86" || target_cpu == "mipsel") { + ldflags = [ "-Wl,--dynamic-linker,/system/bin/linker" ] + } else { + ldflags = [ "-Wl,--dynamic-linker,/system/bin/linker64" ] + } } - if (is_android && current_cpu != "arm64") { - ldflags = [ "-Wl,--dynamic-linker,/system/bin/linker" ] - } - + defines = [] if (!libyuv_use_neon) { - defines = [ "LIBYUV_DISABLE_NEON" ] + defines += [ "LIBYUV_DISABLE_NEON" ] + } + if (libyuv_disable_rvv) { + defines += [ "LIBYUV_DISABLE_RVV" ] } } @@ -130,6 +134,7 @@ static_library("libyuv_internal") { "source/row_any.cc", "source/row_common.cc", "source/row_gcc.cc", + "source/row_rvv.cc", "source/row_win.cc", "source/scale.cc", "source/scale_any.cc", diff --git a/libyuv.gni b/libyuv.gni index 852f08ca9..0a6c44533 100644 --- a/libyuv.gni +++ b/libyuv.gni @@ -13,6 +13,7 @@ import("//build_overrides/build.gni") declare_args() { libyuv_include_tests = !build_with_chromium libyuv_disable_jpeg = false + libyuv_disable_rvv = false libyuv_use_neon = current_cpu == "arm64" || (current_cpu == "arm" && (arm_use_neon || arm_optionally_use_neon))