diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-11-15 00:33:09 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2023-11-15 00:33:09 +0000 |
commit | d9900de7e934df7f9cc541b9bba91c04e14549a3 (patch) | |
tree | 05085dda5c76f413784ea47bf1b79f3b9fb2d89b | |
parent | 06e0e078ddfb3be5b8364feb69b94154d0ee7c8b (diff) | |
parent | 4ce40b3d6a9c5d01f7fb4baf27705e1c7d71b22d (diff) | |
download | rs-d9900de7e934df7f9cc541b9bba91c04e14549a3.tar.gz |
Merge "Snap for 11098506 from ef254e8f39c283bfacb5b25a20a487acb7cd4229 to sdk-release" into sdk-release
-rw-r--r-- | Android.bp | 111 | ||||
-rw-r--r-- | Android.mk | 28 | ||||
-rw-r--r-- | driver/Android.mk | 4 | ||||
-rwxr-xr-x | driver/runtime/Android.mk | 283 | ||||
-rw-r--r-- | support/java/src/androidx/renderscript/ScriptC.java | 18 |
5 files changed, 129 insertions, 315 deletions
@@ -345,6 +345,117 @@ cc_library_shared { ], } +prebuilt_renderscript_bitcode { + name: "libclcore.bc", + arch: { + arm: { + src: "driver/runtime/prebuilts/arm/lib/libclcore.bc", + }, + arm64: { + src: "driver/runtime/prebuilts/arm/lib64/libclcore.bc", + }, + x86: { + src: "driver/runtime/prebuilts/x86/lib/libclcore.bc", + }, + x86_64: { + src: "driver/runtime/prebuilts/x86/lib64/libclcore.bc", + }, + }, +} + +prebuilt_renderscript_bitcode { + name: "libclcore_debug.bc", + arch: { + arm: { + src: "driver/runtime/prebuilts/arm/lib/libclcore_debug.bc", + }, + arm64: { + src: "driver/runtime/prebuilts/arm/lib64/libclcore_debug.bc", + }, + x86: { + src: "driver/runtime/prebuilts/x86/lib/libclcore_debug.bc", + }, + x86_64: { + src: "driver/runtime/prebuilts/x86/lib64/libclcore_debug.bc", + }, + }, +} + +prebuilt_renderscript_bitcode { + name: "libclcore_x86.bc", + arch: { + arm: { + enabled: false, + }, + arm64: { + enabled: false, + }, + x86: { + src: "driver/runtime/prebuilts/x86/lib/libclcore_x86.bc", + }, + x86_64: { + src: "driver/runtime/prebuilts/x86/lib64/libclcore_x86.bc", + }, + }, +} + +prebuilt_renderscript_bitcode { + name: "libclcore_neon.bc", + arch: { + arm: { + src: "driver/runtime/prebuilts/arm/lib/libclcore_neon.bc", + }, + arm64: { + // These are only 32-bit libraries. + enabled: false, + }, + x86: { + // Using the ARM version is fine for native_bridge. + src: "driver/runtime/prebuilts/arm/lib/libclcore_neon.bc", + }, + x86_64: { + // These are only 32-bit libraries. + enabled: false, + }, + }, +} + +prebuilt_renderscript_bitcode { + name: "libclcore_g.bc", + arch: { + arm: { + src: "driver/runtime/prebuilts/arm/lib/libclcore_g.bc", + }, + arm64: { + src: "driver/runtime/prebuilts/arm/lib64/libclcore_g.bc", + }, + x86: { + src: "driver/runtime/prebuilts/x86/lib/libclcore_g.bc", + }, + x86_64: { + src: "driver/runtime/prebuilts/x86/lib64/libclcore_g.bc", + }, + }, +} + +prebuilt_renderscript_bitcode { + name: "libclcore_debug_g.bc", + arch: { + arm: { + src: "driver/runtime/prebuilts/arm/lib/libclcore_debug_g.bc", + }, + arm64: { + src: "driver/runtime/prebuilts/arm/lib64/libclcore_debug_g.bc", + }, + x86: { + src: "driver/runtime/prebuilts/x86/lib/libclcore_debug_g.bc", + }, + x86_64: { + src: "driver/runtime/prebuilts/x86/lib64/libclcore_debug_g.bc", + }, + }, +} + build = [ "support.bp", ] diff --git a/Android.mk b/Android.mk deleted file mode 100644 index a64fc081..00000000 --- a/Android.mk +++ /dev/null @@ -1,28 +0,0 @@ - -LOCAL_PATH:=$(call my-dir) - -.PHONY: rs-prebuilts-full -rs-prebuilts-full: \ - bcc_compat \ - llvm-rs-cc \ - libRSSupport \ - libRSSupportIO \ - libRScpp_static \ - libblasV8 \ - libcompiler_rt \ - librsrt_arm.bc \ - librsrt_arm64.bc \ - librsrt_mips.bc \ - librsrt_x86.bc \ - librsrt_x86_64.bc \ - libLLVM_android-host64 \ - libclang_android-host64 - -ifneq ($(HOST_OS),darwin) -rs-prebuilts-full: \ - host_cross_llvm-rs-cc \ - host_cross_bcc_compat -endif - -include $(call all-makefiles-under,$(LOCAL_PATH)) - diff --git a/driver/Android.mk b/driver/Android.mk deleted file mode 100644 index 271de29b..00000000 --- a/driver/Android.mk +++ /dev/null @@ -1,4 +0,0 @@ - -LOCAL_PATH:=$(call my-dir) - -include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/driver/runtime/Android.mk b/driver/runtime/Android.mk deleted file mode 100755 index a35ceab0..00000000 --- a/driver/runtime/Android.mk +++ /dev/null @@ -1,283 +0,0 @@ -# -# Copyright (C) 2013 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. -# - -LOCAL_PATH := $(call my-dir) - -# C/LLVM-IR source files for the library -clcore_base_files := \ - rs_allocation.c \ - rs_cl.c \ - rs_core.c \ - rs_element.c \ - rs_f16_math.c \ - rs_mesh.c \ - rs_matrix.c \ - rs_program.c \ - rs_sample.c \ - rs_sampler.c \ - rs_convert.c \ - rs_quaternion.c - -clcore_cflags := -Werror -Wall -Wextra \ - -Iframeworks/rs/cpu_ref -DRS_DECLARE_EXPIRED_APIS - -clcore_base_files_32 := \ - ll32/allocation.ll - -clcore_base_files_64 := \ - ll64/allocation.ll - -clcore_files := \ - $(clcore_base_files) \ - arch/generic.c - -clcore_g_files := \ - rs_abi_debuginfo.c \ - arch/generic.c - -clcore_files_32 := \ - $(clcore_base_files_32) \ - ll32/math.ll - -clcore_files_64 := \ - $(clcore_base_files_64) \ - ll64/math.ll - -clcore_neon_files := \ - $(clcore_base_files) \ - $(clcore_files_32) \ - arch/neon.ll \ - arch/clamp.c - -clcore_arm64_files := \ - $(clcore_files_64) \ - arch/asimd.ll \ - arch/clamp.c - -clcore_x86_files := \ - $(clcore_base_files) \ - arch/generic.c \ - arch/x86_sse2.ll \ - arch/x86_sse3.ll - -# Grab the current value for $(RS_VERSION_DEFINE) -include frameworks/compile/slang/rs_version.mk - -# Build the base version of the library -include $(CLEAR_VARS) - -LOCAL_MODULE := libclcore.bc -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE -LOCAL_CFLAGS += $(clcore_cflags) -LOCAL_SRC_FILES := $(clcore_base_files) -LOCAL_SRC_FILES_32 := $(clcore_files_32) -LOCAL_SRC_FILES_32 += arch/generic.c - -ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm64)) -LOCAL_SRC_FILES_64 := $(clcore_arm64_files) -LOCAL_CFLAGS_64 += -DARCH_ARM64_HAVE_NEON -else -LOCAL_SRC_FILES_64 := $(clcore_files_64) -LOCAL_SRC_FILES_64 += arch/generic.c -endif - -include $(LOCAL_PATH)/build_bc_lib.mk - -# Build a debug version of the library -include $(CLEAR_VARS) - -LOCAL_MODULE := libclcore_debug.bc -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE -rs_debug_runtime := 1 -LOCAL_CFLAGS += $(clcore_cflags) -LOCAL_SRC_FILES := $(clcore_base_files) -LOCAL_SRC_FILES_32 := $(clcore_files_32) -LOCAL_SRC_FILES_32 += arch/generic.c - -ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm64)) -LOCAL_SRC_FILES_64 := $(clcore_arm64_files) -LOCAL_CFLAGS_64 += -DARCH_ARM64_HAVE_NEON -else -LOCAL_SRC_FILES_64 := $(clcore_files_64) -LOCAL_SRC_FILES_64 += arch/generic.c -endif - -include $(LOCAL_PATH)/build_bc_lib.mk -rs_debug_runtime := - -# Build an optimized version of the library for x86 platforms (all have SSE2/3). -ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64)) -include $(CLEAR_VARS) - -LOCAL_MODULE := libclcore_x86.bc -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE -LOCAL_CFLAGS += $(clcore_cflags) -DARCH_X86_HAVE_SSSE3 -LOCAL_SRC_FILES := $(clcore_x86_files) -LOCAL_SRC_FILES_32 := $(clcore_base_files_32) -LOCAL_SRC_FILES_64 := $(clcore_base_files_64) - -include $(LOCAL_PATH)/build_bc_lib.mk -endif - -# Build a NEON-enabled version of the library -# Only build on 32-bit, because we don't need a 64-bit NEON lib -include $(CLEAR_VARS) - -LOCAL_32_BIT_ONLY := true - -LOCAL_MODULE := libclcore_neon.bc -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE -LOCAL_CFLAGS += $(clcore_cflags) -LOCAL_SRC_FILES := $(clcore_neon_files) -LOCAL_CFLAGS += -DARCH_ARM_HAVE_NEON - -include $(LOCAL_PATH)/build_bc_lib.mk - -# Build a version of the library with debug info -include $(CLEAR_VARS) - -LOCAL_MODULE := libclcore_g.bc -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE -rs_g_runtime := 1 -LOCAL_CFLAGS += $(clcore_cflags) -LOCAL_CFLAGS += -g -O0 -LOCAL_SRC_FILES := $(clcore_base_files) $(clcore_g_files) -LOCAL_SRC_FILES_32 := $(clcore_base_files_32) -LOCAL_SRC_FILES_64 := $(clcore_base_files_64) - -ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm64)) -LOCAL_CFLAGS_64 += -DARCH_ARM64_HAVE_NEON -endif - -include $(LOCAL_PATH)/build_bc_lib.mk - -# Build a debug version of the library with debug info -include $(CLEAR_VARS) - -LOCAL_MODULE := libclcore_debug_g.bc -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE -rs_debug_runtime := 1 -rs_g_runtime := 1 -LOCAL_CFLAGS += $(clcore_cflags) -LOCAL_CFLAGS += -g -O0 -LOCAL_SRC_FILES := $(clcore_base_files) -LOCAL_SRC_FILES += rs_abi_debuginfo.c -LOCAL_SRC_FILES_32 := $(clcore_base_files_32) -LOCAL_SRC_FILES_64 := $(clcore_base_files_64) - -ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm64)) -LOCAL_SRC_FILES_64 += arch/asimd.ll arch/clamp.c -LOCAL_CFLAGS_64 += -DARCH_ARM64_HAVE_NEON -else -LOCAL_SRC_FILES_64 += arch/generic.c -endif - -include $(LOCAL_PATH)/build_bc_lib.mk -rs_debug_runtime := -rs_g_runtime := - -### Build new versions (librsrt_<ARCH>.bc) as host shared libraries. -### These will be used with bcc_compat and the support library. - -# Build the ARM version of the library -include $(CLEAR_VARS) - -# FIXME for 64-bit -LOCAL_32_BIT_ONLY := true - -BCC_RS_TRIPLE := renderscript32-linux-androideabi -RS_TRIPLE_CFLAGS := -LOCAL_MODULE := librsrt_arm.bc -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE -LOCAL_IS_HOST_MODULE := true -LOCAL_CFLAGS += $(clcore_cflags) -LOCAL_SRC_FILES := $(clcore_files) $(clcore_files_32) -include $(LOCAL_PATH)/build_bc_lib.mk - -# Build the MIPS version of the library -include $(CLEAR_VARS) - -# FIXME for 64-bit -LOCAL_32_BIT_ONLY := true - -BCC_RS_TRIPLE := renderscript32-linux-androideabi -RS_TRIPLE_CFLAGS := -LOCAL_MODULE := librsrt_mips.bc -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE -LOCAL_IS_HOST_MODULE := true -LOCAL_CFLAGS += $(clcore_cflags) -LOCAL_SRC_FILES := $(clcore_files) $(clcore_files_32) -include $(LOCAL_PATH)/build_bc_lib.mk - -# Build the x86 version of the library -include $(CLEAR_VARS) - -# FIXME for 64-bit -LOCAL_32_BIT_ONLY := true - -BCC_RS_TRIPLE := renderscript32-linux-androideabi -RS_TRIPLE_CFLAGS := -D__i386__ -LOCAL_MODULE := librsrt_x86.bc -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE -LOCAL_IS_HOST_MODULE := true -LOCAL_CFLAGS += $(clcore_cflags) -DARCH_X86_HAVE_SSSE3 -LOCAL_SRC_FILES := $(clcore_x86_files) $(clcore_base_files_32) -include $(LOCAL_PATH)/build_bc_lib.mk - -include $(CLEAR_VARS) - -BCC_RS_TRIPLE := renderscript64-linux-android -RS_TRIPLE_CFLAGS := -LOCAL_MODULE := librsrt_arm64.bc -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE -LOCAL_IS_HOST_MODULE := true -LOCAL_CFLAGS += $(clcore_cflags) -LOCAL_SRC_FILES := $(clcore_files) $(clcore_files_64) -include $(LOCAL_PATH)/build_bc_lib.mk - -# Build the x86_64 version of the library -include $(CLEAR_VARS) - -BCC_RS_TRIPLE := renderscript64-linux-android -RS_TRIPLE_CFLAGS := -D__x86_64__ -LOCAL_MODULE := librsrt_x86_64.bc -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE -LOCAL_IS_HOST_MODULE := true -LOCAL_CFLAGS += $(clcore_cflags) -DARCH_X86_HAVE_SSSE3 -LOCAL_SRC_FILES := $(clcore_x86_files) $(clcore_base_files_64) -include $(LOCAL_PATH)/build_bc_lib.mk diff --git a/support/java/src/androidx/renderscript/ScriptC.java b/support/java/src/androidx/renderscript/ScriptC.java index 4fd626e6..e1d06a30 100644 --- a/support/java/src/androidx/renderscript/ScriptC.java +++ b/support/java/src/androidx/renderscript/ScriptC.java @@ -90,7 +90,24 @@ public class ScriptC extends Script { setID(id); } + private static void throwExceptionIfSDKTooHigh(RenderScript rs) { + String message = + "ScriptC scripts are not supported when targeting an API Level > 34. Please refer " + + "to https://developer.android.com/guide/topics/renderscript/migration-guide " + + "for proposed alternatives."; + Log.w(TAG, message); + // Inlining of the Build.VERSION_CODES.UPSIDE_DOWN_CAKE constant because it is not available + // when building with older SDKs. + // https://developer.android.com/reference/android/os/Build.VERSION_CODES#UPSIDE_DOWN_CAKE + final int maxSupportedTargetSDKVersion = 34; + int targetSdkVersion = rs.getApplicationContext().getApplicationInfo().targetSdkVersion; + if (targetSdkVersion > maxSupportedTargetSDKVersion) { + throw new UnsupportedOperationException(message); + } + } + private static synchronized long internalCreate(RenderScript rs, Resources resources, int resourceID) { + throwExceptionIfSDKTooHigh(rs); byte[] pgm; int pgmLength; InputStream is = resources.openRawResource(resourceID); @@ -129,6 +146,7 @@ public class ScriptC extends Script { private static synchronized long internalStringCreate(RenderScript rs, String resName, byte[] bitcode) { // Log.v(TAG, "Create script for resource = " + resName); + throwExceptionIfSDKTooHigh(rs); String cachePath = rs.getApplicationContext().getCacheDir().toString(); return rs.nScriptCCreate(resName, cachePath, bitcode, bitcode.length); } |