diff options
| author | Jason Sams <rjsams@android.com> | 2011-04-21 11:46:50 -0700 |
|---|---|---|
| committer | Jason Sams <rjsams@android.com> | 2011-04-21 11:46:50 -0700 |
| commit | be8ac6ace9036262942bc8c96baa36abeb2291f3 (patch) | |
| tree | f73b54808b4f3bd7e320f176b7f8b7eebf1a16f0 /libs/rs/driver/rsdBcc.cpp | |
| parent | 0ec8c6f9a89855439179b298d4d0034e64a0c9f0 (diff) | |
| download | frameworks_base-be8ac6ace9036262942bc8c96baa36abeb2291f3.zip frameworks_base-be8ac6ace9036262942bc8c96baa36abeb2291f3.tar.gz frameworks_base-be8ac6ace9036262942bc8c96baa36abeb2291f3.tar.bz2 | |
Move TLS behind hal.
Change-Id: I9e84acb3736bc98fa5fb0720bddb13a030285319
Diffstat (limited to 'libs/rs/driver/rsdBcc.cpp')
| -rw-r--r-- | libs/rs/driver/rsdBcc.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libs/rs/driver/rsdBcc.cpp b/libs/rs/driver/rsdBcc.cpp index 2c6840b..8120864 100644 --- a/libs/rs/driver/rsdBcc.cpp +++ b/libs/rs/driver/rsdBcc.cpp @@ -56,8 +56,9 @@ struct DrvScript { }; + static Script * setTLS(Script *sc) { - ScriptTLSStruct * tls = (ScriptTLSStruct *)pthread_getspecific(Context::gThreadTLSKey); + ScriptTLSStruct * tls = (ScriptTLSStruct *)pthread_getspecific(rsdgThreadTLSKey); rsAssert(tls); Script *old = tls->mScript; tls->mScript = sc; @@ -133,12 +134,13 @@ bool rsdScriptInit(const Context *rsc, uint32_t flags) { //LOGE("rsdScriptCreate %p %p %p %p %i %i %p", rsc, resName, cacheDir, bitcode, bitcodeSize, flags, lookupFunc); + pthread_mutex_lock(&rsdgInitMutex); char *cachePath = NULL; uint32_t objectSlotCount = 0; DrvScript *drv = (DrvScript *)calloc(1, sizeof(DrvScript)); if (drv == NULL) { - return false; + goto error; } script->mHal.drv = drv; @@ -159,20 +161,20 @@ bool rsdScriptInit(const Context *rsc, (char const *)drv->mScriptText, drv->mScriptTextLength, 0) != 0) { LOGE("bcc: FAILS to read bitcode"); - return NULL; + goto error; } #if 1 if (bccLinkFile(drv->mBccScript, "/system/lib/libclcore.bc", 0) != 0) { LOGE("bcc: FAILS to link bitcode"); - return NULL; + goto error; } #endif cachePath = genCacheFileName(cacheDir, resName, ".oBCC"); if (bccPrepareExecutable(drv->mBccScript, cachePath, 0) != 0) { LOGE("bcc: FAILS to prepare executable"); - return NULL; + goto error; } free(cachePath); @@ -234,10 +236,12 @@ bool rsdScriptInit(const Context *rsc, script->mHal.info.root = drv->mRoot; + pthread_mutex_unlock(&rsdgInitMutex); return true; error: + pthread_mutex_unlock(&rsdgInitMutex); free(drv); return false; |
