Merge "Call .rs.dtor() when tearing down Scripts."
This commit is contained in:
committed by
Android (Google) Code Review
commit
1716fe47bd
@@ -37,6 +37,7 @@ using namespace android::renderscript;
|
|||||||
struct DrvScript {
|
struct DrvScript {
|
||||||
int (*mRoot)();
|
int (*mRoot)();
|
||||||
void (*mInit)();
|
void (*mInit)();
|
||||||
|
void (*mFreeChildren)();
|
||||||
|
|
||||||
BCCScriptRef mBccScript;
|
BCCScriptRef mBccScript;
|
||||||
|
|
||||||
@@ -125,6 +126,7 @@ bool rsdScriptInit(const Context *rsc,
|
|||||||
|
|
||||||
drv->mRoot = reinterpret_cast<int (*)()>(bccGetFuncAddr(drv->mBccScript, "root"));
|
drv->mRoot = reinterpret_cast<int (*)()>(bccGetFuncAddr(drv->mBccScript, "root"));
|
||||||
drv->mInit = reinterpret_cast<void (*)()>(bccGetFuncAddr(drv->mBccScript, "init"));
|
drv->mInit = reinterpret_cast<void (*)()>(bccGetFuncAddr(drv->mBccScript, "init"));
|
||||||
|
drv->mFreeChildren = reinterpret_cast<void (*)()>(bccGetFuncAddr(drv->mBccScript, ".rs.dtor"));
|
||||||
|
|
||||||
exportFuncCount = drv->ME->getExportFuncCount();
|
exportFuncCount = drv->ME->getExportFuncCount();
|
||||||
if (exportFuncCount > 0) {
|
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,
|
void rsdScriptInvokeFunction(const Context *dc, Script *script,
|
||||||
uint32_t slot,
|
uint32_t slot,
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ int rsdScriptInvokeRoot(const android::renderscript::Context *dc,
|
|||||||
android::renderscript::Script *script);
|
android::renderscript::Script *script);
|
||||||
void rsdScriptInvokeInit(const android::renderscript::Context *dc,
|
void rsdScriptInvokeInit(const android::renderscript::Context *dc,
|
||||||
android::renderscript::Script *script);
|
android::renderscript::Script *script);
|
||||||
|
void rsdScriptInvokeFreeChildren(const android::renderscript::Context *dc,
|
||||||
|
android::renderscript::Script *script);
|
||||||
|
|
||||||
void rsdScriptSetGlobalVar(const android::renderscript::Context *,
|
void rsdScriptSetGlobalVar(const android::renderscript::Context *,
|
||||||
const android::renderscript::Script *,
|
const android::renderscript::Script *,
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ static RsdHalFunctions FunctionTable = {
|
|||||||
rsdScriptInvokeRoot,
|
rsdScriptInvokeRoot,
|
||||||
rsdScriptInvokeForEach,
|
rsdScriptInvokeForEach,
|
||||||
rsdScriptInvokeInit,
|
rsdScriptInvokeInit,
|
||||||
|
rsdScriptInvokeFreeChildren,
|
||||||
rsdScriptSetGlobalVar,
|
rsdScriptSetGlobalVar,
|
||||||
rsdScriptSetGlobalBind,
|
rsdScriptSetGlobalBind,
|
||||||
rsdScriptSetGlobalObj,
|
rsdScriptSetGlobalObj,
|
||||||
|
|||||||
@@ -72,6 +72,12 @@ void Script::setVarObj(uint32_t slot, ObjectBase *val) {
|
|||||||
mRSC->mHal.funcs.script.setGlobalObj(mRSC, this, slot, 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 android {
|
||||||
namespace renderscript {
|
namespace renderscript {
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ public:
|
|||||||
void setVar(uint32_t slot, const void *val, size_t len);
|
void setVar(uint32_t slot, const void *val, size_t len);
|
||||||
void setVarObj(uint32_t slot, ObjectBase *val);
|
void setVarObj(uint32_t slot, ObjectBase *val);
|
||||||
|
|
||||||
|
virtual bool freeChildren();
|
||||||
|
|
||||||
virtual void runForEach(Context *rsc,
|
virtual void runForEach(Context *rsc,
|
||||||
const Allocation * ain,
|
const Allocation * ain,
|
||||||
Allocation * aout,
|
Allocation * aout,
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ typedef struct {
|
|||||||
uint32_t usrLen,
|
uint32_t usrLen,
|
||||||
const RsScriptCall *sc);
|
const RsScriptCall *sc);
|
||||||
void (*invokeInit)(const Context *rsc, Script *s);
|
void (*invokeInit)(const Context *rsc, Script *s);
|
||||||
|
void (*invokeFreeChildren)(const Context *rsc, Script *s);
|
||||||
|
|
||||||
void (*setGlobalVar)(const Context *rsc, const Script *s,
|
void (*setGlobalVar)(const Context *rsc, const Script *s,
|
||||||
uint32_t slot,
|
uint32_t slot,
|
||||||
|
|||||||
Reference in New Issue
Block a user