summaryrefslogtreecommitdiff
path: root/rs/jni/android_renderscript_RenderScript.cpp
AgeCommit message (Collapse)Author
2020-01-08Update renderscript to use stable graphics APIsDerek Sollenberger
This change removes usage of skia data structures and replaces them with stable C APIs. It also removes two unused java APIs that were missing their native components. Test: CTS presubmit tests Bug: 137655431 Change-Id: I18cbe0cf9dc731c4c6c1f645be0df2f462764118
2019-03-27Pass Bitmap's native instance to JNI where feasibleLeon Scroggins III
Test: CtsGraphicsTestCases, CtsUiRenderingTestCases, CtsRenderscriptTestCases This is significantly faster than passing the Java object down and then calling a JNI method to retrieve the pointer. See https://buganizer.corp.google.com/issues/16656908#comment19 In some cases this changes what used to be native crashes (due to android::BitmapWrapper:assertValid's LOG_ALWAYS_FATAL_IF) into NullPointerExceptions (if a caller used a null Bitmap). In addition: - Remove unnecessary JNIEnv param from toBitmap(jlong) - Change instances of toBitmap(JNIEnv*, jobject) to the above - Replace calls to GraphicsJNI::getSkBitmap() to inline calls to toBitmap/getSkBitmap - make Canvas#nInitRaster @FastNative (FIXME: Could these be @CriticalNative?) Change-Id: I6194097be1b6e6952eba70e1e7052a5a250eed93
2018-02-28Refactor AssetManagerAdam Lesinski
Bug: 64071469 Test: atest CtsContentTestCases Change-Id: Ia6856157e8813856268fba003e1e591d690cb26e
2018-02-09Revert "Replace AssetManager with AssetManager2 implementation"Adam Lesinski
This reverts commit 1187590da38457809dd368d4901c9c47ac5a6958. Bug: 73134570 Change-Id: I59b4d714e447478ea124f086356f127f42251fb7
2018-02-05Replace AssetManager with AssetManager2 implementationAdam Lesinski
Test: atest CtsContentTestCases:android.content.res.cts Test: make libandroidfw_tests Change-Id: I2bb6d7656d2516d371e83e541ed02f91405f6d94
2018-01-25Revert "Replace AssetManager with AssetManager2 implementation"Adam Lesinski
This reverts commit dcb3c6559b09ec89771858ec27a787027da9af50. Bug:72511998 Change-Id: I665966ca109f66f85d8665db388c71ea2303c3b8
2018-01-24Replace AssetManager with AssetManager2 implementationAdam Lesinski
Test: atest CtsContentTestCases:android.content.res.cts Test: make libandroidfw_tests Change-Id: I572eb13c6a4372c7f656f5912821cececd5bf3d4
2018-01-23Revert "Replace AssetManager with AssetManager2 implementation"Adam Lesinski
This reverts commit b20a0ce59f59cb5ec857748e056cc341dbd13b92.
2018-01-09Replace AssetManager with AssetManager2 implementationAdam Lesinski
Test: Existing CTS tests pass Test: make libandroidfw_tests Change-Id: I858f7e1d909c08273b096601136e3f28e15eb5d4
2017-10-06switch to new API for compute image sizeMike Reed
Test: make Change-Id: Ie3a5d068bef1c2a1790ab227f6398695aee11cf7
2017-07-20Merge "frameworks/base: use proper nativehelper headers" am: 826eafd958 am: ↵Steven Moreland
5c091dc944 am: c840945a78 Change-Id: I654e14f0d1b495450db81592a2e564e308746350
2017-07-20Merge "frameworks/base: use proper nativehelper headers"Steven Moreland
am: 826eafd958 Change-Id: I36f10ff4d963284a313f1cc5b368f82549a4adb2
2017-07-19frameworks/base: use proper nativehelper headersSteven Moreland
libnativehelper exports headers under nativehelper. These were available before incorrectly as global headers in order to give access to jni.h. Test: modules using frameworks/base find headers Bug: 63762847 Change-Id: I0f9f231acdebe460f279135462f43d3e32eff64d
2017-05-02RenderScript: IWYUSteven Moreland
Renderscript was depending on macros from android-base that were transitively included from MQDescriptor.h Test: links Bug: 37791060 Change-Id: Ie34ddef67328c5fcc6b0122a32725b980615ff43 (cherry picked from commit dc01e938c2550390a540311b22e3e6c7603ed975)
2017-05-01RenderScript: IWYUSteven Moreland
Renderscript was depending on macros from android-base that were transitively included from MQDescriptor.h Test: links Bug: 37791060 Change-Id: Ie34ddef67328c5fcc6b0122a32725b980615ff43
2017-04-18bitmaps and pixelrefs no longer need lock/unlockMike Reed
Test: covered by CtsGraphicsTestCases and hwui_unit_tests Change-Id: I42a25961a2eb3755d2fd22a617aa21a24ec0994f
2017-04-04[RenderScript] Connect ANativeWindow to BufferQueue before callingMiao Wang
AllocationSetSurface. Bug: 34334222 Test: mm, boot Sailfish, CTS pass and ImageProcessingJB works well. Change-Id: I77e7fb69987a347862286299622343b4f7879ab0
2017-03-14Make IGraphicBufferProducer a hybrid interface.Pawin Vongmasa
android::IGraphicBufferProducer will now become a hybrid interface on top of the HIDL interface android::hardware::graphics::bufferqueue::V1_0::IGraphicBufferProducer. Test: With CtsMediaTestCases.apk installed, adb shell am instrument -e size small -w 'android.media.cts/android.support.test.runner.AndroidJUnitRunner' Bug: 33854657 Change-Id: Ia8914ea49d2acf3d43682982a164d7e10f7b8542
2017-03-06[RenderScript] Update RenderScript JNI with the correspondingMiao Wang
AllocationGetSurface driver implementation change. - AllocationGetSurface now returns opaque handle to ANativeWindow*, instead of IGraphicBufferProducer*, as IGraphicBufferProducer is not part of NDK. So the JNI side need to change accordingly. Bug: 34396220 Test: mm, CTS tests pass. Change-Id: If9b6a733202d29bc40c0e0b87c4fb48db092cbe5
2017-03-06[RenderScript] Use ANativeWindow_fromSurface to get ANativeWindowMiao Wang
from Java Surface. - ANativeWindow_fromSurface and ANativeWindow_release has to be used in pairs to avoid leaks. Bug: 34396220 Test: mm, CTS tests pass. Change-Id: Id67fd005a056df4d496a48f705d445a2d8c45232
2017-02-23Update RenderScript JNI code for TrebleMiao Wang
- Include rsApiStubs.h instead of rs.h, and remove unused dependencies for rs.h in Android.mk. - Remove libRSDriver.so from LOCAL_REQUIRED_MODULE, since it is not required nor directly used by librs_jni.so. - Fix the discrepancy in ElementGetNativeData and ElementGetSubElements, respective to NDK APIs exposed in libRS.so. rsApiStubs.h contains all public RenderScript APIs exposed in libRS.so. It fixes the mismatch of the declarations and definitions of the two functions mentioned above. And it does not rely on the auto generated header (rsgApiFuncDecl.h) anymore. Bug: 34396220 Test: mm Merged-In: Iedb1b976cfa9033dccefe78cbe80c8022f990e53 Change-Id: Iedb1b976cfa9033dccefe78cbe80c8022f990e53
2016-10-06Correctly pass number of input allocations for BLASMiao Wang
Bug: 31992305 Test: Build and CTS RsBlas test pass on Angler. Change-Id: If49c0be003d9c2a2175924dc3303703b9ab49357
2016-06-13Merge \"Delete simple reduction implementation.\" into nyc-devDavid Gross
am: d749245b88 Change-Id: I28a4e52a41678ecb10b0869566e1cb79d4287b60
2016-06-02Delete simple reduction implementation.David Gross
Bug: 27298560 Change-Id: I8a89c9df753d12ee8af06008d424e77bb916cd8f
2016-03-25Silence clang static analyzer warningsYang Ni
Bug: 27272549 Avoid uninitialized struct fields. Avoid unused variables. Avoid alloca(0). Change-Id: I19a826aabaa4032caf728e16d242f5bb77f2b450
2016-03-16Use proper ScriptCall size in nScriptForEach()Yang Ni
Bug: 26498479 Although the size of struct ScriptCall is not used underneath in the runtime or drivers, assign the correct value here to avoid confusion. Change-Id: I8db19538b9f70f3bf9ee849a8724da3d9ee04785 (cherry picked from commit e8f2e445fdb138416043a16659bbf86fbbd3fff8)
2016-03-15Use proper ScriptCall size in nScriptForEach()Yang Ni
Bug: 26498479 Although the size of struct ScriptCall is not used underneath in the runtime or drivers, assign the correct value here to avoid confusion. Change-Id: I8db19538b9f70f3bf9ee849a8724da3d9ee04785
2016-03-08Merge "Revert "Set flags in RS JNI calls for rsObj creation""Yang Ni
2016-03-08Revert "Set flags in RS JNI calls for rsObj creation"Yang Ni
This reverts commit ad88055821a7aba3318f066c4e5f87bd0315462c. Change-Id: I53a3f59022e2607216f4dd89bc2e28e0bd987785
2016-03-08Merge "Revert "Set flags in RS JNI calls for rsObj creation"" into nyc-devYang Ni
2016-03-08Revert "Set flags in RS JNI calls for rsObj creation"Yang Ni
This reverts commit 972a409a3df6f105aa99a3d721e37111c70ef44c. Change-Id: Icdac5cebf9944e7b237c91db05e5a7f47b6b67e8
2016-03-03[RenderScript] Enable untyped variants of Allocation-copy functions for FLOAT_16Pirama Arumuga Nainar
http://b/27251511 Handle FLOAT_16 case to PER_ARRAY_TYPE macro to enable untyped variants of Allocation-copy functions. Untyped variants of Allocation-copy functions call validateObjectIsPrimitiveArray(), with checkType parameter set to true, to validate and obtain the Element type of the Allocation. When checkType is true, validateObjectIsPrimitiveArray() returns the actual Element type of the Allocation (instead of the canonical SIGNED type). Because of this, FLOAT_16 element type can reach the JNI layer, necessitating this change to PER_ARRAY_TYPE macro. Change-Id: I3651e5ae0ab0cd6bb4ad3157841e2910ac8699dc (cherry picked from commit 85e8c51dbf8dc774ecfd09981ac6a8bf1b75f464)
2016-03-03Merge "[RenderScript] Enable untyped variants of Allocation-copy functions ↵Pirama Arumuga Nainar
for FLOAT_16" into nyc-dev
2016-03-03Set flags in RS JNI calls for rsObj creationYang Ni
Bug: 25570907 Added a flag to all RS runtime API for rsObj creation to indicate a call is from Java. This flag will help us avoid incrementing the user ref count for rsObj's created from Single-Source RS, and therefore avoid memory leaks for such objects. Change-Id: Id3604f93b166089e3aca896d1c6c509b3ea19bcf (cherry picked from commit ad88055821a7aba3318f066c4e5f87bd0315462c)
2016-03-02[RenderScript] Enable untyped variants of Allocation-copy functions for FLOAT_16Pirama Arumuga Nainar
http://b/27251511 Handle FLOAT_16 case to PER_ARRAY_TYPE macro to enable untyped variants of Allocation-copy functions. Untyped variants of Allocation-copy functions call validateObjectIsPrimitiveArray(), with checkType parameter set to true, to validate and obtain the Element type of the Allocation. When checkType is true, validateObjectIsPrimitiveArray() returns the actual Element type of the Allocation (instead of the canonical SIGNED type). Because of this, FLOAT_16 element type can reach the JNI layer, necessitating this change to PER_ARRAY_TYPE macro. Change-Id: I3651e5ae0ab0cd6bb4ad3157841e2910ac8699dc
2016-02-22Set flags in RS JNI calls for rsObj creationYang Ni
Bug: 25570907 Added a flag to all RS runtime API for rsObj creation to indicate a call is from Java. This flag will help us avoid incrementing the user ref count for rsObj's created from Single-Source RS, and therefore avoid memory leaks for such objects. Change-Id: Id3604f93b166089e3aca896d1c6c509b3ea19bcf
2016-02-17[RenderScript] Fix potential leak in RS JNIMiao Wang
Bug: 27145639 Change-Id: I80cf2971d803a3366a63caa3612a503a88639040 (cherry picked from commit a4ad5f840173ecbfb679153a4f9460d2b06538e7)
2016-02-11[RenderScript] Fix potential leak in RS JNIMiao Wang
Bug: 27145639 Change-Id: I80cf2971d803a3366a63caa3612a503a88639040
2016-01-26[RenderScript] Implement APIs for better multi-frame process support.Miao Wang
Bug: 23535524 Two APIs added for multiframe processing: - createAllocations(...): To create an array of Allocations sharing the same Type and Usage. For USAGE_IO_INPUT Allocations, they also share the same BufferQueue. - getTimeStamp(): API to retrieve the time stamp associated with the most recent buffer. Change-Id: I6b7b35d7dca5e87ee2f3db2ee17cb9cf824bcfe1
2016-01-26Merge "[RenderScript] Add API to map Allocation mallocptr to Java ByteBuffer"Miao Wang
2016-01-25[RenderScript] Add API to map Allocation mallocptr to Java ByteBufferMiao Wang
Bug: 25926361 Bug: 23535524 - Construct the ByteBuffer using the AllocationGetPointer. - Add an API to query the stride of the allocation. - Both ByteBuffer and Stride will be cached for normal Allocations. if using USAGE_IO, since after each ioReceive, the mallocPtr will change, getByteBuffer will always create a new one using the most up-to-date mallocPtr. Change-Id: I5e84b6690e83bb062c383043275524d0e51e46eb
2016-01-15Add general reduction plumbing starting with Java Script::reduce().David Gross
Requires coordinated change in frameworks/rs. Bug: 23535724 Change-Id: I2fee6750cf542948d8fa87a98441002c4d84f36e
2015-11-13Various fixes in setting globals in a script groupYang Ni
Bug: 25602504 1) Passing floating point values into a script group was broken, since they were casted to long values. Fixed that in the frameworks implementation by taking the raw bits instead. 2) Passing 64-bit values into a script group was broken on 32-bit platforms, since they were casted to pointer-sized integers (uintptr_t) in the JNI code. Fixed that by casting to int64_t instead. 3) Setting global variables of Allocation type in a script group was broken. The special size value -1 was used to indicate the value is an Allocation. However, size was casted to size_t in the JNI code. Fixed that by using signed integers. Change-Id: Ifff099a76be7707df7b67c388395f5a00f9cae66
2015-10-13[RenderScript] Add null check for return values of JNIMiao Wang
Get<TYPE>ArrayElements. Bug: 20760800 Change-Id: I6ba56933a71721da88d31dbf74c48d42a924305a
2015-09-30am 134c504a: Merge "[RenderScript] pass correct length of ains to BLAS ↵Miao Wang
functions" * commit '134c504a3ea687a0ea875057792e66705ddbfce7': [RenderScript] pass correct length of ains to BLAS functions
2015-09-30Merge "[RenderScript] pass correct length of ains to BLAS functions"Miao Wang
2015-09-30[RenderScript] pass correct length of ains to BLAS functionsMiao Wang
bug: 24540091 Change-Id: Ia541bcbee07125c4caf3e0f4863702a3c0b929d5
2015-09-24resolved conflicts for a884d81e to stage-aosp-masterElliott Hughes
Change-Id: Ice485967fa96f13786024b6939b826638e906ff0
2015-09-22constify JNINativeMethod function pointer tablesDaniel Micay
Change-Id: I4036c924958221cbc644724f8eb01c5de3cd7954
2015-07-23am ed3ffe0f: am 6430812a: Merge "RenderScript: implement a Script entry ↵Stephen Hines
point for calling a reduce-style kernel." * commit 'ed3ffe0fc86de016ff2b4231e2fcc74a6119f6c7': RenderScript: implement a Script entry point for calling a reduce-style kernel.