Merge "Implement RS GC worker thread." into jb-mr2-dev

This commit is contained in:
Jason Sams
2013-04-10 04:21:01 +00:00
committed by Android (Google) Code Review
4 changed files with 75 additions and 1 deletions

View File

@ -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() {
@ -1235,6 +1243,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.");
@ -1384,7 +1393,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.");