361 Commits

Author SHA1 Message Date
Xusong Wang
1f8dc651a8 Deprecate RS Java APIs.
This CL marks RenderScript Java APIs as deprecated.

Bug: 168711199
Test: m
Test: CtsRenderscriptTestCases
Test: CtsRsCppTestCases
Test: CtsRsBlasTestCases
Change-Id: Id271a794679d445c480d62c87ae6c8150f6901f8
Merged-In: Id271a794679d445c480d62c87ae6c8150f6901f8
(cherry picked from commit 8b4548c43a06290b5d9446c0235e65f21e9bfe5d)
2021-04-21 11:23:11 -07:00
Hans Boehm
5dc6b62136 No longer call registerNativeAllocation
The original rationale is obsolete, since contexts are now almost
always shared.

This call was unbalanced; there was no corresponding
freeNativeAllocation call. Thus, in the rare cases in which this
actually makes a difference, it's likely to lead to perpetually
increasing native allocation counts, which is more likely to be
confusing than helpful to the garbage collector.

(Discussed with Tim and Jean-Luc, and concluded that it was best
just to remove the code.)

Test: Treehugger
Bug: 181351667
Change-Id: I376a16732231aad0fdacd022de301464e5ac71dd
2021-03-06 18:47:20 -08:00
Mathew Inwood
5d123b6775 Add maxTargetSdk restriction to unused APIs.
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

Bug: 170729553
Test: Treehugger
Merged-In: I626caf7c1fe46c5ab1f39c2895b42a34319f771a
Change-Id: I54e5ecd11e76ca1de3c5893e3a98b0108e735413
2020-11-04 09:45:53 +00:00
TreeHugger Robot
2a3b7a21c0 Merge "Use new UnsupportedAppUsage annotation." 2020-01-09 09:41:06 +00:00
Derek Sollenberger
db98b528ab Update renderscript to use stable graphics APIs
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
2020-01-08 13:35:11 -05:00
Artur Satayev
2ebb31c00c Use new UnsupportedAppUsage annotation.
Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library.

Bug: 145132366
Test: m && diff unsupportedappusage_index.csv \
      git diff HEAD^ HEAD | grep '^[+-][^+-]' | grep -v '.import'

Change-Id: I853372f3c6fef905553bb31be4f1bb48df735f7a
2020-01-08 16:06:00 +00:00
Austin Wang
a63a2c0130 Revert "Use new UnsupportedAppUsage annotation."
This reverts commit a5264903e22bc741add895133474ea13a370de4c.

Reason for revert: Droidcop-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=git_master&target=sdk_phone_armv7-sdk&lkgb=6083299&lkbb=6085371&fkbb=6083313, bug b/146533269

Change-Id: Ie5b031d7b277cf0e09b0a9776b26bf74f5f69e70
2019-12-19 06:38:19 +00:00
Artur Satayev
a5264903e2 Use new UnsupportedAppUsage annotation.
Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library.

Bug: 145132366
Test: m && diff unsupportedappusage_index.csv \
      git diff HEAD^ HEAD | grep '^[+-][^+-]' | grep -v '.import'
Change-Id: I087bb1cecbe59f1cf0c2e770c735d7a433722c6f
2019-12-18 12:07:36 +00:00
Leon Scroggins III
71fae62f5f Pass Bitmap's native instance to JNI where feasible
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
2019-03-27 13:39:23 -04:00
Hans Boehm
0f037171c9 Merge "Correct registerNativeAllocation type" am: fe015a098c am: 90e8135f1e
am: ecb7e4a77b

Change-Id: I2ba5370ad1f6f3b8f0ad757c0993b5c399baaea7
2019-03-12 16:23:19 -07:00
Miao Wang
08d7d0398e Add check for input allocation type for ScriptIntrinsicBlur.
Bug: 124466617
Test: mm
Test: CtsRenderscriptTestCases
Change-Id: I4784b96b5f96749d503bd1de8360e74b72f3f5c2
2019-03-06 12:49:19 -08:00
Hans Boehm
da3cee60c5 Correct registerNativeAllocation type
We're changing the argument type to long, since it should be roughly
large enough to hold a size_t everywhere.

Make style checker happy by reordering imports.

Test: Treehugger
Change-Id: Iccdc5fa592f56d448817f7762af1cff27b4fc2a8
2019-02-11 11:22:25 -08:00
Mathew Inwood
1d526c114f Merge "Add @UnsupportedAppUsage annotations"
am: 3d05f769a3

Change-Id: Id21c0f5dee82e2f2174d795763420bfed806a17b
2018-08-06 09:38:58 -07:00
Mathew Inwood
1532447a7b Add @UnsupportedAppUsage annotations
For packages:
  android.renderscript

This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.

Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 110868826
Test: m
Change-Id: I016f6e720e79c48afe44f4690b5dd99fc81ae780
Merged-In: I1aa8ebca448547031b426a7b305c5c3d6fcf2652
2018-08-06 11:19:48 +01:00
Mathew Inwood
f0c90b1f36 Add @UnsupportedAppUsage annotations
For packages:
  android.renderscript

This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.

Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 110868826
Test: m
Change-Id: I1aa8ebca448547031b426a7b305c5c3d6fcf2652
2018-08-02 14:46:03 +01:00
kopriva
6a7f167f67 docs: fixing bug 36982027 and 30636712, typos
Test: make ds-docs

Bug: 36982027
Bug: 30636712

Change-Id: I70d6d216c714a31b7e762a203a27f6124642131e
2018-03-20 17:59:48 -07:00
Treehugger Robot
6b70eafae1 Merge "Do not CloseGuard KernelID or FieldID" 2017-06-13 21:49:49 +00:00
Yang Ni
3a84a23f36 Do not CloseGuard KernelID or FieldID
Bug: 28053584

Stop CloseGuarding for two reasons:

1) KernelID and FieldID objects are constructed in auto-generated
(RenderScript reflected) Java code. It would be impossible for a user to
explicitly call destroy() on them. Guarding them would leave a lot of
noisy warnings in logcat.

2) These KernelID and FieldID objects are not big compared to other
RenderScript objects, e.g. Allocations. They occupy almost no native
resources except for a native pointer. Leaving their destruction to Java
GC would be completely acceptable, since any delay in reclaiming them is
unlikely to cause memory pressure.

Test: CTS on x86_64 emulator
Change-Id: I587b5561a0b2bdbf0b2e95bf2995c20d5f5faf9d
2017-06-13 19:41:55 +00:00
Yang Ni
c48a09cce8 Destroy Allocation right away on exception
Bug: 28053584

To avoid holding the resource (surface) for too long.

Test: CTS on x86_64 emulator
Change-Id: I2fdec107c2a16b7dadbf78a9aee79c33423a3676
2017-05-05 15:32:34 +00:00
Yang Ni
8b8f75a700 Destroy Allocation with ScriptIntrinsicLut
Bug: 28053584

On destroying the intrinsic, destroy its contained Allocation right away.

Test: CTS on x86_64 emulator
Change-Id: I5ca0da33b620c3291b7cafda31a6cc83eb7461a0
2017-05-04 18:44:17 +00:00
Yang Ni
bb671376ff Validates Intrinsic Blur only takes 2D Allocations
Bug: 24555166

Test: RSTest on x86_64 emulator
Change-Id: I0c8c970ce85989c3213fb4986e517ac0be5beb26
2017-04-18 15:43:08 -07:00
Yang Ni
25684ceff5 Merge "Removed close guards for Element and Type objects"
am: 97c9b57cec

Change-Id: I28b4149b6a0ace42dff2ca4ce9a1803b0baa4430
2017-03-07 00:36:19 +00:00
Yang Ni
45438c9402 Removed close guards for Element and Type objects
Bug: 28053769

These objects are tiny and unlikely to cause memory issues.

In addition, llvm-rs-cc auto-generated code contains such objects, which are
not visibible to developers and impossible to manually destroy, leaving
distracting warnings in Strict Mode.

Test: RsTest with StrictMode on and CTS tests

Change-Id: Iec68cca4f1259124b9f503a230c1a28b97ede1f3
2017-03-03 10:44:30 -08:00
Elliot Waite
28ba4722a9 Fix @links in reference docs. am: 54de77470d
am: ab978c035e

Change-Id: If0d0613362e0ea95cf48eaf9a16d3eea48b589ea
2017-01-26 04:39:57 +00:00
Elliot Waite
54de77470d Fix @links in reference docs.
Change-Id: I40cea46efd80c448640ff69753698fe8404da40b
2017-01-25 17:00:55 -08:00
David Gross
1d5ce9ab34 Merge \\"Delete simple reduction implementation.\\" into nyc-dev am: d749245b88
am: 9a53329b0a

Change-Id: I66f67b6d55f4ce0496c6e136b82ca58a7a5fbfd6
2016-06-13 22:20:32 +00: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
Miao Wang
35927794fc Merge "[RenderScript] Fix ScriptIntrinsicBlur documentation." into nyc-dev
am: 75445fd6a0

* commit '75445fd6a043a892bb7d7f18c1d62c5f72337413':
  [RenderScript] Fix ScriptIntrinsicBlur documentation.

Change-Id: I8ccd115fd6f92ef4b4ef7194a77fd01ffbda5916
2016-05-19 22:24:27 +00:00
Miao Wang
7ae30e18a4 Merge "Update documentation about copyTo and copyFrom." into nyc-dev
am: 1a523b7502

* commit '1a523b7502135a5cc0a94ea380263638b0ffdab1':
  Update documentation about copyTo and copyFrom.

Change-Id: I0aa87cd4bde408ba5395ae3f951d86e10ece58de
2016-05-19 22:24:21 +00:00
Miao Wang
c242fa6b5d [RenderScript] Fix ScriptIntrinsicBlur documentation.
Bug: 28177406
Change-Id: Icccf35857cf29f827a78704e7751c8791cda0d7b
2016-05-18 16:28:55 -07:00
Miao Wang
3231e8e022 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
2016-05-18 16:28:47 -07:00
Miao Wang
e41611d7ab Merge "[RenderScript] Interrupt mMessageThread when tearing down context." am: 9f2a1979a7
am: b02f7b0a0e

* commit 'b02f7b0a0e17ac97184e113ea527145a302f8bbc':
  [RenderScript] Interrupt mMessageThread when tearing down context.

Change-Id: Icc19c3d04f3b33f928ef6f61b4a42471d51736b5
2016-05-11 19:32:00 +00: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
888017db77 Merge "Fixed BaseObj finalizer and destroy()" into nyc-dev
am: 8ca7638

* commit '8ca763803d8960ddc9f6c498c3294e69aac0f7cf':
  Fixed BaseObj finalizer and destroy()

Change-Id: Id607034269102c84d673b7148beb0b050121e0bc
2016-04-22 19:52:18 +00:00
Yang Ni
1b4df1697f Fixed BaseObj finalizer and destroy()
Bug: 28242626
Bug: 27972184
Bug: 27973681

This is resolving issues in ScriptGroup (V1) again.
In ScriptGroup.destroy(), we also need to consider the old API where
mClosures is not initialized.

Also cleaned up the finalizer for ScriptGroup and Allocation:
Since BaseObj.finalize() calls BaseObj.helpDestroy(), instead of
BaseObj.destroy(), there is no possibility that the finalizers of
child objects may race their parents finalizers. Note that
helpDestroy() does not try to recurse on child objects.

Change-Id: I9dbb2b60f8478f656f8a418c2b5fc8d6848aeef0
2016-04-22 10:21:18 -07:00
Yang Ni
f17e491517 Merge "Made Element accessors thread-safe" am: acd0061
am: 3c207ff

* commit '3c207ff5af7c4f0a9d9cafa6c6f5c947cfdb78ca':
  Made Element accessors thread-safe

Change-Id: I5bc65b3b28c328081335a04ce15864a6dd072543
2016-04-20 18:23:58 +00: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
c74d2a8b87 Merge "Made Element accessors thread-safe" into nyc-dev 2016-04-20 16:44:39 +00: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
33703f0c4e Made Element accessors thread-safe
Bug: 28177082
Change-Id: I8f3f2d8ce559e93cba29f8eedd5b95d1389deb23
2016-04-18 17:25:58 -07:00
Yang Ni
82ed817c43 Merge "Fixed ScriptGroup finalizer for old API" into nyc-dev
am: ecf094a

* commit 'ecf094ae9d715ac3cff6213fae4c904f9dd791e8':
  Fixed ScriptGroup finalizer for old API

Change-Id: Ia673958b883634197077b69aebd8af293088fef0
2016-04-18 23:38:14 +00:00
Yang Ni
07837d6dab 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
2016-04-18 14:27:02 -07:00
Yang Ni
0f10f043be Merge "Destroy Type created by Allocation.createSized()" into nyc-dev 2016-04-12 23:37:01 +00:00
Yang Ni
dadd35d5d7 Merge "Destroy Type created by Allocation.createSized()" am: 2a64e23
am: cc24885

* commit 'cc248853c361588eb5429aee5921acbcc1900c8a':
  Destroy Type created by Allocation.createSized()

Change-Id: Ic79bbf7fbf1a3f9d8f49fdb3a3950b0383bc4dcb
2016-04-12 22:18:26 +00:00
Yang Ni
e1798e4284 Destroy Type created by Allocation.createSized()
Bug: 27972184
Change-Id: I4f80c74079087eab20b75a701c56cde141322462
(cherry picked from commit 3444dbe025ad78cae9fd77a4d2203a1a806ae1af)
2016-04-12 15:11:31 -07:00
Yang Ni
2a64e23857 Merge "Destroy Type created by Allocation.createSized()" 2016-04-12 22:07:56 +00:00
Yang Ni
9101274f91 Merge "Destroy Closures in ScriptGroup" am: 01db883
am: 122c39a

* commit '122c39ab82a3e027d0e46e26bb09ac4e5e480842':
  Destroy Closures in ScriptGroup

Change-Id: I9b03e2ae8ec80250686afc9ac9f39d294e5f9b5d
2016-04-12 16:18:15 +00:00
Yang Ni
44d1b3bfba Destroy Closures in ScriptGroup
Bug: 27973681

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

Change-Id: I946f62c2979d6a338b8883514cacad472a213c5c
(cherry picked from commit 44e2f45f0cab4a429e59f07c1e5bf0eef08c7819)
2016-04-12 09:01:44 -07:00