summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2011-09-01 13:49:29 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-09-01 13:49:29 -0700
commit1716fe47bdbc4f23f2e4e27eb2d787388792adeb (patch)
treec53b62dd47acbaf1fdd79ed46272fa9d1589e76d /libs
parentf9fa8be5e37b47d01ae37afb08f68428072e4aa3 (diff)
parent514f9790fdf180ca3c58e508cbd36c520fa7be08 (diff)
downloadframeworks_base-1716fe47bdbc4f23f2e4e27eb2d787388792adeb.zip
frameworks_base-1716fe47bdbc4f23f2e4e27eb2d787388792adeb.tar.gz
frameworks_base-1716fe47bdbc4f23f2e4e27eb2d787388792adeb.tar.bz2
Merge "Call .rs.dtor() when tearing down Scripts."
Diffstat (limited to 'libs')
-rw-r--r--libs/rs/driver/rsdBcc.cpp9
-rw-r--r--libs/rs/driver/rsdBcc.h2
-rw-r--r--libs/rs/driver/rsdCore.cpp1
-rw-r--r--libs/rs/rsScript.cpp6
-rw-r--r--libs/rs/rsScript.h2
-rw-r--r--libs/rs/rs_hal.h1
6 files changed, 21 insertions, 0 deletions
diff --git a/libs/rs/driver/rsdBcc.cpp b/libs/rs/driver/rsdBcc.cpp
index 44ea79c..0755fb7 100644
--- a/libs/rs/driver/rsdBcc.cpp
+++ b/libs/rs/driver/rsdBcc.cpp
@@ -37,6 +37,7 @@ using namespace android::renderscript;
struct DrvScript {
int (*mRoot)();
void (*mInit)();
+ void (*mFreeChildren)();
BCCScriptRef mBccScript;
@@ -125,6 +126,7 @@ bool rsdScriptInit(const Context *rsc,
drv->mRoot = reinterpret_cast<int (*)()>(bccGetFuncAddr(drv->mBccScript, "root"));
drv->mInit = reinterpret_cast<void (*)()>(bccGetFuncAddr(drv->mBccScript, "init"));
+ drv->mFreeChildren = reinterpret_cast<void (*)()>(bccGetFuncAddr(drv->mBccScript, ".rs.dtor"));
exportFuncCount = drv->ME->getExportFuncCount();
if (exportFuncCount > 0) {
@@ -430,6 +432,13 @@ void rsdScriptInvokeInit(const Context *dc, Script *script) {
}
}
+void rsdScriptInvokeFreeChildren(const Context *dc, Script *script) {
+ DrvScript *drv = (DrvScript *)script->mHal.drv;
+
+ if (drv->mFreeChildren) {
+ drv->mFreeChildren();
+ }
+}
void rsdScriptInvokeFunction(const Context *dc, Script *script,
uint32_t slot,
diff --git a/libs/rs/driver/rsdBcc.h b/libs/rs/driver/rsdBcc.h
index 67929bc..5f83ed2 100644
--- a/libs/rs/driver/rsdBcc.h
+++ b/libs/rs/driver/rsdBcc.h
@@ -43,6 +43,8 @@ int rsdScriptInvokeRoot(const android::renderscript::Context *dc,
android::renderscript::Script *script);
void rsdScriptInvokeInit(const android::renderscript::Context *dc,
android::renderscript::Script *script);
+void rsdScriptInvokeFreeChildren(const android::renderscript::Context *dc,
+ android::renderscript::Script *script);
void rsdScriptSetGlobalVar(const android::renderscript::Context *,
const android::renderscript::Script *,
diff --git a/libs/rs/driver/rsdCore.cpp b/libs/rs/driver/rsdCore.cpp
index 171d045..a38fff7 100644
--- a/libs/rs/driver/rsdCore.cpp
+++ b/libs/rs/driver/rsdCore.cpp
@@ -60,6 +60,7 @@ static RsdHalFunctions FunctionTable = {
rsdScriptInvokeRoot,
rsdScriptInvokeForEach,
rsdScriptInvokeInit,
+ rsdScriptInvokeFreeChildren,
rsdScriptSetGlobalVar,
rsdScriptSetGlobalBind,
rsdScriptSetGlobalObj,
diff --git a/libs/rs/rsScript.cpp b/libs/rs/rsScript.cpp
index f62c72e..93513fe 100644
--- a/libs/rs/rsScript.cpp
+++ b/libs/rs/rsScript.cpp
@@ -72,6 +72,12 @@ void Script::setVarObj(uint32_t slot, ObjectBase *val) {
mRSC->mHal.funcs.script.setGlobalObj(mRSC, this, slot, val);
}
+bool Script::freeChildren() {
+ incSysRef();
+ mRSC->mHal.funcs.script.invokeFreeChildren(mRSC, this);
+ return decSysRef();
+}
+
namespace android {
namespace renderscript {
diff --git a/libs/rs/rsScript.h b/libs/rs/rsScript.h
index c0324dd..d645421 100644
--- a/libs/rs/rsScript.h
+++ b/libs/rs/rsScript.h
@@ -73,6 +73,8 @@ public:
void setVar(uint32_t slot, const void *val, size_t len);
void setVarObj(uint32_t slot, ObjectBase *val);
+ virtual bool freeChildren();
+
virtual void runForEach(Context *rsc,
const Allocation * ain,
Allocation * aout,
diff --git a/libs/rs/rs_hal.h b/libs/rs/rs_hal.h
index 21dff21..b8d7351 100644
--- a/libs/rs/rs_hal.h
+++ b/libs/rs/rs_hal.h
@@ -90,6 +90,7 @@ typedef struct {
uint32_t usrLen,
const RsScriptCall *sc);
void (*invokeInit)(const Context *rsc, Script *s);
+ void (*invokeFreeChildren)(const Context *rsc, Script *s);
void (*setGlobalVar)(const Context *rsc, const Script *s,
uint32_t slot,