diff options
author | Tim Murray <timmurray@google.com> | 2013-04-09 14:33:32 -0700 |
---|---|---|
committer | Tim Murray <timmurray@google.com> | 2013-04-09 16:01:23 -0700 |
commit | f8c033db1edf36a0ab09568c3142054f0be2d1a1 (patch) | |
tree | 60d13d018ebbd5777404657855722d6cdc345bb6 /graphics/java/android/renderscript/Allocation.java | |
parent | b4c13c4b045f4d96c377ba1fb9d834c111412a8c (diff) |
Implement RS GC worker thread.
Bug 8579360
Change-Id: I98a5509b68e592bcbb4958f2ca72c236a22910b5
Diffstat (limited to 'graphics/java/android/renderscript/Allocation.java')
-rw-r--r-- | graphics/java/android/renderscript/Allocation.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java index b8564b60bbf2..8bc6b968cd90 100644 --- a/graphics/java/android/renderscript/Allocation.java +++ b/graphics/java/android/renderscript/Allocation.java @@ -274,12 +274,20 @@ public class Allocation extends BaseObj { } } + // don't need to account for USAGE_SHARED Allocations + if ((usage & USAGE_SHARED) == 0) { + int numBytes = t.getCount() * t.getElement().getBytesSize(); + rs.addAllocSizeForGC(numBytes); + mGCSize = numBytes; + } + mType = t; mUsage = usage; if (t != null) { updateCacheInfo(t); } + } private void validateIsInt32() { @@ -1117,6 +1125,7 @@ public class Allocation extends BaseObj { if (type.getID(rs) == 0) { throw new RSInvalidStateException("Bad Type"); } + int id = rs.nAllocationCreateTyped(type.getID(rs), mips.mID, usage, 0); if (id == 0) { throw new RSRuntimeException("Allocation creation failed."); @@ -1266,7 +1275,6 @@ public class Allocation extends BaseObj { return alloc; } - int id = rs.nAllocationCreateFromBitmap(t.getID(rs), mips.mID, b, usage); if (id == 0) { throw new RSRuntimeException("Load failed."); |