391 Commits

Author SHA1 Message Date
David Gross
11ec90971f Delete simple reduction implementation.
Bug: 27298560
Change-Id: I8a89c9df753d12ee8af06008d424e77bb916cd8f
(cherry picked from commit 4a4578530a1a5fb751ea5a7bfbff83f3ab669895)
2016-06-14 14:30:06 -07:00
Miao Wang
6aaede8cd7 [RenderScript] Fix ScriptIntrinsicBlur documentation.
Bug: 28177406
Change-Id: Icccf35857cf29f827a78704e7751c8791cda0d7b
(cherry picked from commit c242fa6b5d7b8624b5ce710c1e2740c5bb9679dd)
2016-05-25 14:44:10 -07:00
Miao Wang
1641dc9e68 Update documentation about copyTo and copyFrom.
Bug: 23159764
Bug: 26862970

  - Add detailed description of AutoPadding
  - Add comments to all the copy related APIs.
  - Fix typos in the comments.

Change-Id: I2d045e0d90efd94f1407f88d3e35bcd42ea93fb9
(cherry picked from commit 3231e8e0220614f7b1628493da5f276f19faab7c)
2016-05-25 14:38:43 -07:00
Miao Wang
4a574806e6 [RenderScript] Interrupt mMessageThread when tearing down context.
- Interrupt mMessageThread, so it gets to see immediately
    that mRun is false and exit rightaway.

Change-Id: Ic586ef225a5c6f3a77f89de00b7fb3f3547c9838
2016-05-10 16:48:25 -07:00
Yang Ni
acd0061f90 Merge "Made Element accessors thread-safe" 2016-04-20 18:14:08 +00:00
Yang Ni
6bdfe0fc5c Made Element accessors thread-safe
Bug: 28177082
Change-Id: I8f3f2d8ce559e93cba29f8eedd5b95d1389deb23
(cherry picked from commit 33703f0c4e9b16bda5fd72e71d7d89359ee0db17)
2016-04-20 09:49:36 -07:00
Yang Ni
e04e5d7cc0 Fixed ScriptGroup finalizer for old API
Bug: 28242626

ScriptGroup finalizer clears out the list of closures, which is
uninitialized for the old API.

Need to check null first, before accessing the list.

Change-Id: Ibf914e17a0878c8c561f823c5f6f6f6619594de1
(cherry picked from commit 07837d6dab331b1693aa3689223b4012012a7fad)
2016-04-19 09:46:47 -07:00
Yang Ni
2a64e23857 Merge "Destroy Type created by Allocation.createSized()" 2016-04-12 22:07:56 +00:00
Yang Ni
01db88335d Merge "Destroy Closures in ScriptGroup" 2016-04-12 16:00:47 +00:00
Yang Ni
3444dbe025 Destroy Type created by Allocation.createSized()
Bug: 27972184
Change-Id: I4f80c74079087eab20b75a701c56cde141322462
2016-04-11 17:31:39 -07:00
Stephen Hines
ad57e330ba Fix typos for the word "Unsupported".
Bug: https://code.google.com/p/android/issues/detail?id=206490
Change-Id: Ie1b2c2b0960d8dd8c12ed06d84a16913cd057221
2016-04-11 13:05:55 -07:00
Yang Ni
44e2f45f0c Destroy Closures in ScriptGroup
Bug: 27973681

Implemented correct destruction in ScriptGroup.destroy() and
Clsoure.destroy(), which properly destroys child BaseObj's.

Change-Id: I946f62c2979d6a338b8883514cacad472a213c5c
2016-04-07 13:00:30 -07:00
Yang Ni
cb939dc4fc Avoid destroying Device separately
Bug: 27983025

Device should be destroyed inside the destructor of the associated
Context.

Change-Id: I921a89974e1174f837349a89aef9b03efa4882f5
(cherry picked from commit 4a70df58a32591429ec04902deac2b2210fb96c3)
2016-04-04 18:00:03 -07:00
Yang Ni
01e307d461 Merge "Silence clang static analyzer warnings" 2016-04-01 16:26:17 +00:00
Yang Ni
64c4c1c1cd Merge "Added CloseGuard for BaseObj" 2016-03-31 22:56:37 +00:00
Yang Ni
eb4dd08ec1 Added CloseGuard for BaseObj
Bug: 27719830

To turn on warnings, apps have to add to their Activity.onCreate() method
the following code.

        StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
                               .detectLeakedClosableObjects()
                               .penaltyLog()
                               .build());

For Slang generated ScriptC derived classes, we assume their
constructors won't throw exceptions after calling the ScriptC
constructor. In addition, ScriptIntrinsic derived classes do not seem
to throw exceptions in their constructors either. Therefore, we can
leave the guard.open() call in the Script constructor. This may be
only an approximation, but allows us to add CloseGuard for script
objects without making changes to slang.

Change-Id: I77ed45239a60b85af5c811dee6c124fb53da9060
2016-03-31 14:38:38 -07:00
Miao Wang
ebfcdb935e [RenderScript] Update documentation for Allocation.setAutoPadding().
Bug: 26862970
Change-Id: Iaa88ac0266e5d2cac2837f1d13353aacc6177274
(cherry picked from commit 9ee7607615563c6b480968470e69cb58d0996cb8)
2016-03-29 17:57:45 -07:00
Miao Wang
e58ed9b16d [RenderScript] Fix IntrinsicConvolve documentation.
Bug: 25117120

  - Better format.
  - Typo fixes.

Change-Id: Ic6f8d1dacecdaf9993dd8298de7a801f5fd2a937
(cherry picked from commit 3d23dce43330b9c8f3fba34ef9515dca7912768a)
2016-03-29 17:52:37 -07:00
Miao Wang
c7c6364f51 [RenderScript] Update the documentation of Script.LaunchOptions
Bug: 26916665

  - Add description of the endArg.
  - Update the example.
  - Update the incorrect description.

Change-Id: Idd07db5d790e2d6462fff9cb580115ec45cfd4f0
(cherry picked from commit 53fdcfbe63c1d4b2f1cbee6e72a6dd13f41dc1bc)
2016-03-29 17:48:33 -07:00
Pirama Arumuga Nainar
994db1bb2c Merge "[RenderScript] Fail with Exception from validateObjectIsPrimitiveArray" 2016-03-29 03:56:58 +00:00
Pirama Arumuga Nainar
598d37f670 [RenderScript] Fail with Exception from validateObjectIsPrimitiveArray
Bug: http://b/25982676

Instead of returning null from validateObjectIsPrimitiveArray, fail with
an exception.  The callers of this function do not check for null.

Change-Id: Idd2b50a7b137e8d2db7a334bb9a48c1b19ee2403
2016-03-28 16:34:22 -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
689f637700 Correctly init code cache path for RS
Bug: 27439261

Script Group needs to know the code cache path before it can call bcc to
merge kernels. However, before this change, the code cache path has been
initialized by the ScriptC class.

In the case where a script group (or even the entire app) does not contain any
regular script but only intrinsics, the code cache would remain uninitialized.

Fixed this by initializing the code cache path in the RenderScript class
the first time when the accessor method is called.

Change-Id: I87f9e62e0f3b479f94e43daa3e9695a5b38710db
2016-03-18 23:28:27 +00: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
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
5b2a8ab2b4 [RenderScript] Allow copyTo(short[]) etc for Float16 Allocations
http://b/27251511

Allow copyTo(short[]), copyFrom(short[]), and their 1D range and 2D
range variants to copy data between short[] arrays and Float16
Allocations.

Change-Id: I370584685c3b773c165bd718974ca736ed548339
(cherry picked from commit f51bb356deeb8a22414fb44cede4b8618c4b57ba)
2016-03-03 16:01:28 -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
a4ad5f8401 [RenderScript] Fix potential leak in RS JNI
Bug: 27145639
Change-Id: I80cf2971d803a3366a63caa3612a503a88639040
2016-02-11 12:34:35 -08:00
Stephen Hines
49aee686d8 Merge "Remove the CREATE_FLAG_OPT_LEVEL_0 from the Java API." 2016-01-30 17:44:52 +00: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
Pirama Arumuga Nainar
115b4117a0 Fix punctuation and typos in AllocationAdapter's documentation.
Change-Id: I5574ff201b857a29f30ebe8413dbe4128dcff3ae
2015-10-08 19:51:11 +00:00
Pirama Arumuga Nainar
c9390c8baf am 46b51097: Merge "Safely handle interrupts during Thread.join()"
* commit '46b51097b92900866ac5b25762f622d3ceb1be5d':
  Safely handle interrupts during Thread.join()
2015-10-05 23:33:38 +00:00
Pirama Arumuga Nainar
83461d73bc Safely handle interrupts during Thread.join()
Interrupt current thread if InterruptedException is received during
Thread.join().  Also, log the interruption.

Change-Id: I452124915ea3f19610e6d4a3411d741f2f604af2
2015-10-05 15:45:47 -07:00
Pirama Arumuga Nainar
5fbb245230 am ca3e5aea: Merge "Retry if interrupted before mMessageThread has joined"
* commit 'ca3e5aeaa65ae1d77ce92f082ab789933eb18237':
  Retry if interrupted before mMessageThread has joined
2015-10-02 22:08:11 +00:00
Pirama Arumuga Nainar
2f25ce7753 Retry if interrupted before mMessageThread has joined
Bug: 24342101

If interrupted during mMessageThread.join(), retry the join instead of
assuming the thread has joined and continuing.  Continuing to destroy
the context will cause a segfault when the message thread attempts to
use the destroyed context.

Change-Id: I3213091a0e996449bceb403dffca3063786d5a65
2015-10-02 21:42:12 +00: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 McGroarty
88891e63c0 Remove the CREATE_FLAG_OPT_LEVEL_0 from the Java API.
The flag was previously used to set the optimization level
of the bcc compiler to -O0. However, this functionality is
now accomplished through deriving the optimization level
from the input bitcode. That patch can be found here:
https://android-review.googlesource.com/169330

Change-Id: I9c57d941bb35c6f737a31fcd74f31d9de25a16a8
Signed-off-by: Stephen McGroarty <stephen@codeplay.com>
2015-09-02 16:11:28 +01: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
Stephen Hines
6430812a93 Merge "RenderScript: implement a Script entry point for calling a reduce-style kernel." 2015-07-23 22:26:05 +00:00