diff options
author | Sijie Chen <sijiec@google.com> | 2023-11-21 00:27:39 +0000 |
---|---|---|
committer | Sijie Chen <sijiec@google.com> | 2023-12-11 19:43:34 +0000 |
commit | 7930fac2030e1dae1184714c11b9bcfbf8da2d98 (patch) | |
tree | a3fe9a3e36941d5ca1a35c00e833fc2b43ad49f8 | |
parent | 160d6f3d4434fd8cbd006d505bc1b4b375ff3237 (diff) | |
download | binary_translation-7930fac2030e1dae1184714c11b9bcfbf8da2d98.tar.gz |
[Berberis] Add libjnigraphics library
Bug: 286230479
Test: mmm /frameworks/libs/binary_translation/android_api/libjnigraphics
ls /system/lib64/libberberis_proxy_libjnigraphics.so
Change-Id: I1c18bb21516163ab9ed4e53f40f610fbf44c3608
5 files changed, 42 insertions, 6 deletions
diff --git a/android_api/libjnigraphics/Android.bp b/android_api/libjnigraphics/Android.bp new file mode 100644 index 00000000..23ac99d8 --- /dev/null +++ b/android_api/libjnigraphics/Android.bp @@ -0,0 +1,30 @@ +// +// Copyright (C) 2023 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_library_shared { + name: "libberberis_proxy_libjnigraphics", + defaults: ["berberis_proxy_library_defaults"], + header_libs: ["jni_headers"], + srcs: ["//frameworks/libs/native_bridge_support/libjnigraphics:native_bridge_proxy_libjnigraphics_files"], + shared_libs: [ + "libandroid", + "libjnigraphics", + ], +} diff --git a/berberis_config.mk b/berberis_config.mk index ffb0e1f3..58f2558c 100644 --- a/berberis_config.mk +++ b/berberis_config.mk @@ -39,6 +39,7 @@ BERBERIS_PRODUCT_PACKAGES_RISCV64_TO_X86_64 := \ libberberis_proxy_libcamera2ndk \ libberberis_proxy_libmediandk \ libberberis_proxy_libnativehelper \ + libberberis_proxy_libjnigraphics \ libberberis_proxy_libnativewindow \ libberberis_proxy_libneuralnetworks \ libberberis_proxy_libwebviewchromium_plat_support \ diff --git a/calling_conventions/include/berberis/calling_conventions/calling_conventions_riscv64.h b/calling_conventions/include/berberis/calling_conventions/calling_conventions_riscv64.h index ec6f5d94..4297589d 100644 --- a/calling_conventions/include/berberis/calling_conventions/calling_conventions_riscv64.h +++ b/calling_conventions/include/berberis/calling_conventions/calling_conventions_riscv64.h @@ -81,8 +81,8 @@ class CallingConventions { } constexpr ArgLocation GetIntResLoc(unsigned size) { - // Fundamental integer type - 1/1, 2/2, 4/4, 8/8. - CHECK_LE(size, 8u); + // Fundamental integer type - 1/1, 2/2, 4/4, 8/8, 16/16. + CHECK_LE(size, 16u); // Use x10/a0. return {kArgLocationInt, 0u}; diff --git a/guest_abi/riscv64/include/berberis/guest_abi/guest_abi_arch.h b/guest_abi/riscv64/include/berberis/guest_abi/guest_abi_arch.h index 8f46ada3..01c4d921 100644 --- a/guest_abi/riscv64/include/berberis/guest_abi/guest_abi_arch.h +++ b/guest_abi/riscv64/include/berberis/guest_abi/guest_abi_arch.h @@ -228,9 +228,9 @@ class GuestAbi { struct GuestArgumentInfo<IntegerType, kCallingConventionsVariant, std::enable_if_t<std::is_integral_v<IntegerType>>> { - // Integers wider than 8 bytes are not supported. They do not appear in the public Android API. - // TODO: Remove this if 16-byte parameters are encountered. - static_assert(sizeof(IntegerType) <= 8); + // Integers wider than 16 bytes are not supported. They do not appear in the public Android + // API. + static_assert(sizeof(IntegerType) <= 16); constexpr static ArgumentClass kArgumentClass = ArgumentClass::kInteger; constexpr static unsigned kSize = sizeof(IntegerType); // Use sizeof, not alignof for kAlignment because all integer types are naturally aligned on diff --git a/guest_abi/riscv64/include/berberis/guest_abi/guest_params_arch.h b/guest_abi/riscv64/include/berberis/guest_abi/guest_params_arch.h index 31dd1bba..17c92416 100644 --- a/guest_abi/riscv64/include/berberis/guest_abi/guest_params_arch.h +++ b/guest_abi/riscv64/include/berberis/guest_abi/guest_params_arch.h @@ -133,6 +133,11 @@ class GuestParamsAndReturn<ReturnType(ParamType...) noexcept(kNoexcept), kCallin return {conv, return_loc, param_locs}; } + constexpr static riscv64::ArgLocation ReturnInfoHelper() { + riscv64::CallingConventions conv; + return ReturnInfoHelper(conv); + } + constexpr static riscv64::ArgLocation ReturnInfoHelper(riscv64::CallingConventions& conv) { using ReturnInfo = GuestArgumentInfo<ReturnType, kCallingConventionsVariant>; if constexpr (std::is_same_v<ReturnType, void>) { @@ -153,7 +158,7 @@ class GuestParamsAndReturn<ReturnType(ParamType...) noexcept(kNoexcept), kCallin constexpr static riscv64::CallingConventions kVaStartBase = std::get<0>(ParamsInfoHelper()); - constexpr static riscv64::ArgLocation kReturnLocation = std::get<1>(ParamsInfoHelper()); + constexpr static riscv64::ArgLocation kReturnLocation = ReturnInfoHelper(); constexpr static std::array<riscv64::ArgLocation, sizeof...(ParamType)> kParamsLocations = std::get<2>(ParamsInfoHelper()); |