153 Commits

Author SHA1 Message Date
Steven Moreland
9f430b2782 Merge "frameworks/base: use proper nativehelper headers" am: 826eafd958 am: 5c091dc944
am: c840945a78

Change-Id: I654e14f0d1b495450db81592a2e564e308746350
2017-07-20 03:05:02 +00:00
Steven Moreland
5c091dc944 Merge "frameworks/base: use proper nativehelper headers"
am: 826eafd958

Change-Id: I36f10ff4d963284a313f1cc5b368f82549a4adb2
2017-07-20 02:50:53 +00:00
Steven Moreland
2279b25342 frameworks/base: use proper nativehelper headers
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-07-19 10:06:40 -07:00
Steven Moreland
c941fb0f1a RenderScript: IWYU
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-02 19:04:08 +00:00
Steven Moreland
dc01e938c2 RenderScript: IWYU
Renderscript was depending on macros from android-base that were
transitively included from MQDescriptor.h

Test: links
Bug: 37791060
Change-Id: Ie34ddef67328c5fcc6b0122a32725b980615ff43
2017-05-01 12:56:08 -07:00
Mike Reed
7c0ae0f58b bitmaps and pixelrefs no longer need lock/unlock
Test: covered by CtsGraphicsTestCases and hwui_unit_tests

Change-Id: I42a25961a2eb3755d2fd22a617aa21a24ec0994f
2017-04-18 10:22:42 -04:00
Miao Wang
f35ddc9843 [RenderScript] Connect ANativeWindow to BufferQueue before calling
AllocationSetSurface.

Bug: 34334222
Test: mm, boot Sailfish, CTS pass and ImageProcessingJB works well.
Change-Id: I77e7fb69987a347862286299622343b4f7879ab0
2017-04-04 05:59:19 +00:00
Pawin Vongmasa
34cca21eac Make IGraphicBufferProducer a hybrid interface.
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-14 18:45:26 -07:00
Miao Wang
1e95fc8658 [RenderScript] Update RenderScript JNI with the corresponding
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 10:03:30 -08:00
Miao Wang
33287e8a89 [RenderScript] Use ANativeWindow_fromSurface to get ANativeWindow
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-03-06 09:59:06 -08:00
Miao Wang
cbb0206cb4 Update RenderScript JNI code for Treble
- 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
2017-02-23 19:39:43 -08:00
Treehugger Robot
66f15cc01b Merge "Rely on the platform -std default." 2016-10-08 21:45:16 +00:00
Elliott Hughes
c08e32e0be Rely on the platform -std default.
Bug: http://b/32019064
Test: builds
Change-Id: I7180f1eb539ff8cbe33832d010775f053a922946
2016-10-07 15:57:17 -07:00
Miao Wang
b742fcc808 Correctly pass number of input allocations for BLAS
Bug: 31992305

Test: Build and CTS RsBlas test pass on Angler.
Change-Id: If49c0be003d9c2a2175924dc3303703b9ab49357
2016-10-06 10:45:42 -07:00
David Gross
8e988ec8d8 Merge \"Delete simple reduction implementation.\" into nyc-dev
am: d749245b88

Change-Id: I28a4e52a41678ecb10b0869566e1cb79d4287b60
2016-06-13 22:12:48 +00:00
David Gross
4a4578530a Delete simple reduction implementation.
Bug: 27298560
Change-Id: I8a89c9df753d12ee8af06008d424e77bb916cd8f
2016-06-02 14:47:12 -07:00
Yang Ni
86c5c2dab7 Silence clang static analyzer warnings
Bug: 27272549

Avoid uninitialized struct fields.
Avoid unused variables.
Avoid alloca(0).

Change-Id: I19a826aabaa4032caf728e16d242f5bb77f2b450
2016-03-25 15:50:26 -07:00
Yang Ni
2b551f4c42 Use proper ScriptCall size in nScriptForEach()
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-16 08:20:07 -07:00
Yang Ni
e8f2e445fd Use proper ScriptCall size in nScriptForEach()
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-15 16:20:08 -07:00
Yang Ni
5a6d9b6656 Merge "Revert "Set flags in RS JNI calls for rsObj creation"" 2016-03-08 21:02:26 +00:00
Yang Ni
8c8daea2ef Revert "Set flags in RS JNI calls for rsObj creation"
This reverts commit ad88055821a7aba3318f066c4e5f87bd0315462c.

Change-Id: I53a3f59022e2607216f4dd89bc2e28e0bd987785
2016-03-08 21:01:54 +00:00
Yang Ni
267fc8b361 Merge "Revert "Set flags in RS JNI calls for rsObj creation"" into nyc-dev 2016-03-08 21:00:54 +00:00
Yang Ni
3f3965ec13 Revert "Set flags in RS JNI calls for rsObj creation"
This reverts commit 972a409a3df6f105aa99a3d721e37111c70ef44c.

Change-Id: Icdac5cebf9944e7b237c91db05e5a7f47b6b67e8
2016-03-08 20:59:48 +00:00
Pirama Arumuga Nainar
1333215d8e [RenderScript] Enable untyped variants of Allocation-copy functions for FLOAT_16
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-03 16:04:57 -08:00
Pirama Arumuga Nainar
a2dde698a6 Merge "[RenderScript] Enable untyped variants of Allocation-copy functions for FLOAT_16" into nyc-dev 2016-03-03 20:13:09 +00:00
Yang Ni
972a409a3d Set flags in RS JNI calls for rsObj creation
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-03 08:47:33 -08:00
Pirama Arumuga Nainar
85e8c51dbf [RenderScript] Enable untyped variants of Allocation-copy functions for FLOAT_16
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-03-02 18:16:45 -08:00
Yang Ni
ad88055821 Set flags in RS JNI calls for rsObj creation
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-22 11:38:54 -08:00
Miao Wang
f94e77da7e [RenderScript] Fix potential leak in RS JNI
Bug: 27145639
Change-Id: I80cf2971d803a3366a63caa3612a503a88639040
(cherry picked from commit a4ad5f840173ecbfb679153a4f9460d2b06538e7)
2016-02-17 11:01:51 -08:00
Miao Wang
a4ad5f8401 [RenderScript] Fix potential leak in RS JNI
Bug: 27145639
Change-Id: I80cf2971d803a3366a63caa3612a503a88639040
2016-02-11 12:34:35 -08:00
Miao Wang
8c1509249c [RenderScript] Implement APIs for better multi-frame process support.
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-26 14:40:44 -08:00
Miao Wang
ed50f333fb Merge "[RenderScript] Add API to map Allocation mallocptr to Java ByteBuffer" 2016-01-26 01:11:41 +00:00
Miao Wang
0facf021ea [RenderScript] Add API to map Allocation mallocptr to Java ByteBuffer
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-25 16:12:37 -08:00
David Gross
26ef7a739b Add general reduction plumbing starting with Java Script::reduce().
Requires coordinated change in frameworks/rs.

Bug: 23535724
Change-Id: I2fee6750cf542948d8fa87a98441002c4d84f36e
2016-01-15 12:20:08 -08:00
Yang Ni
263cc90345 Various fixes in setting globals in a script group
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-11-13 10:00:12 -08:00
Miao Wang
ba8766c5db [RenderScript] Add null check for return values of JNI
Get<TYPE>ArrayElements.

Bug: 20760800
Change-Id: I6ba56933a71721da88d31dbf74c48d42a924305a
2015-10-13 10:44:38 -07:00
Miao Wang
05420e77f5 am 134c504a: Merge "[RenderScript] pass correct length of ains to BLAS functions"
* commit '134c504a3ea687a0ea875057792e66705ddbfce7':
  [RenderScript] pass correct length of ains to BLAS functions
2015-09-30 23:44:22 +00:00
Miao Wang
134c504a3e Merge "[RenderScript] pass correct length of ains to BLAS functions" 2015-09-30 22:53:18 +00:00
Miao Wang
0b34f2a3c5 [RenderScript] pass correct length of ains to BLAS functions
bug: 24540091
Change-Id: Ia541bcbee07125c4caf3e0f4863702a3c0b929d5
2015-09-30 15:38:07 -07:00
Elliott Hughes
b57dd722f1 resolved conflicts for a884d81e to stage-aosp-master
Change-Id: Ice485967fa96f13786024b6939b826638e906ff0
2015-09-24 10:01:32 -07:00
Daniel Micay
76f6a86de2 constify JNINativeMethod function pointer tables
Change-Id: I4036c924958221cbc644724f8eb01c5de3cd7954
2015-09-22 17:10:35 -04:00
Stephen Hines
b3a1674a47 am ed3ffe0f: am 6430812a: Merge "RenderScript: implement a Script entry point for calling a reduce-style kernel."
* commit 'ed3ffe0fc86de016ff2b4231e2fcc74a6119f6c7':
  RenderScript: implement a Script entry point for calling a reduce-style kernel.
2015-07-23 22:54:59 +00:00
Matt Wala
36eb1f74b3 RenderScript: implement a Script entry point for calling a
reduce-style kernel.

Bug: 22631253

This adds a new (currently hidden) API to the Script class and the
corresponding code for the RenderScript JNI layer.

Change-Id: I40f19aaeb90411b859bd6b0bffc3f071fa327c21
2015-07-21 11:07:10 -07:00
Miao Wang
c02720316d resolved conflicts for merge of a1867fb0 to mnc-dev-plus-aosp
Change-Id: Id0266c63c98b4cb37f49eb2e0fb9a98cbc7ee1de
2015-06-30 23:35:23 -07:00
Miao Wang
2514806817 [RenderScript] update the type of offsets for BLAS.BNNM
bug: 22184114

Change-Id: I7e7132aa3563f32de32640567b381f8f5bddf491
(cherry picked from commit 6099ee6e081904e73e0fad331e326b0607b6b1dc)
2015-06-30 22:29:47 -07:00
Miao Wang
8374e25a9e am 77877609: Merge "[RenderScript] fix Allocation.copyToFieldPacker"
* commit '7787760961703239763afad9639517ce02259090':
  [RenderScript] fix Allocation.copyToFieldPacker
2015-05-19 21:17:28 +00:00
Miao Wang
7787760961 Merge "[RenderScript] fix Allocation.copyToFieldPacker" 2015-05-19 16:45:13 +00:00
Miao Wang
bfa5e659e7 [RenderScript] fix Allocation.copyToFieldPacker
Change-Id: Iaba3333f9741238745fdb5c94f1b27b1015d50b2
2015-05-11 15:49:18 -07:00
Chih-Hung Hsieh
af622b1a98 Merge "Fix print format error." 2015-05-08 22:22:23 +00:00
Yang Ni
aa97de7501 am 496c07d7: Merge "Moved limit constants for kernel and script group"
* commit '496c07d75425eebb3402abd76c3186fceb67d6b3':
  Moved limit constants for kernel and script group
2015-05-08 18:07:19 +00:00