diff options
author | Miao Wang <miaowang@google.com> | 2017-03-15 15:54:06 -0700 |
---|---|---|
committer | Miao Wang <miaowang@google.com> | 2017-03-15 15:54:10 -0700 |
commit | 58423152d9e7791dddd124c235db5f693638bbd6 (patch) | |
tree | c3287ddd17d25b1695dba75268d3560f69747086 /cpu_ref | |
parent | 6df9ff9d7f59c7dd1fd94146f9d23e355b641647 (diff) | |
parent | 902d1ab7baa3898f1c042262b72dece784533f37 (diff) | |
download | rs-58423152d9e7791dddd124c235db5f693638bbd6.tar.gz |
resolve merge conflicts of 902d1ab7 to master
Test: mm
Change-Id: Ie8ebf3dc243c24924ba174b40d45029564dbbaff
Diffstat (limited to 'cpu_ref')
-rw-r--r-- | cpu_ref/Android.mk | 2 | ||||
-rw-r--r-- | cpu_ref/rsCpuCore.h | 8 | ||||
-rw-r--r-- | cpu_ref/rsCpuExecutable.cpp | 6 | ||||
-rw-r--r-- | cpu_ref/rsCpuExecutable.h | 6 | ||||
-rw-r--r-- | cpu_ref/rsCpuScript.cpp | 6 | ||||
-rw-r--r-- | cpu_ref/rsCpuScript.h | 6 | ||||
-rw-r--r-- | cpu_ref/rsCpuScriptGroup.cpp | 50 | ||||
-rw-r--r-- | cpu_ref/rsCpuScriptGroup.h | 4 | ||||
-rw-r--r-- | cpu_ref/rsCpuScriptGroup2.cpp | 2 |
9 files changed, 49 insertions, 41 deletions
diff --git a/cpu_ref/Android.mk b/cpu_ref/Android.mk index 3e817ae1..8b553348 100644 --- a/cpu_ref/Android.mk +++ b/cpu_ref/Android.mk @@ -82,7 +82,7 @@ ifeq ($(ARCH_X86_HAVE_SSSE3),true) rsCpuIntrinsics_x86.cpp endif -LOCAL_SHARED_LIBRARIES += libRS_internal libc++ liblog libutils libui libgui libz +LOCAL_SHARED_LIBRARIES += libRS_internal libc++ liblog libui libgui libz LOCAL_SHARED_LIBRARIES += libbcinfo libblas LOCAL_STATIC_LIBRARIES := libbnnmlowp diff --git a/cpu_ref/rsCpuCore.h b/cpu_ref/rsCpuCore.h index 8c5653f8..59e6c4bb 100644 --- a/cpu_ref/rsCpuCore.h +++ b/cpu_ref/rsCpuCore.h @@ -25,6 +25,8 @@ #include "rsScriptC.h" #include "rsCpuCoreRuntime.h" +#include <string> + namespace android { namespace renderscript { @@ -188,10 +190,10 @@ public: } virtual void setBccPluginName(const char *name) { - mBccPluginName.setTo(name); + mBccPluginName.assign(name); } virtual const char *getBccPluginName() const { - return mBccPluginName.string(); + return mBccPluginName.c_str(); } bool getInKernel() override { return mInKernel; } @@ -243,7 +245,7 @@ protected: ScriptTLSStruct mTlsStruct; RSSelectRTCallback mSelectRTCallback; - String8 mBccPluginName; + std::string mBccPluginName; // Specifies whether we should embed global variable information in the // code via special RS variables that can be examined later by the driver. diff --git a/cpu_ref/rsCpuExecutable.cpp b/cpu_ref/rsCpuExecutable.cpp index 66441c34..91d93556 100644 --- a/cpu_ref/rsCpuExecutable.cpp +++ b/cpu_ref/rsCpuExecutable.cpp @@ -166,7 +166,7 @@ void* SharedLibraryUtils::loadSharedLibrary(const char *cacheDir, return loaded; } -String8 SharedLibraryUtils::getRandomString(size_t len) { +std::string SharedLibraryUtils::getRandomString(size_t len) { char buf[len + 1]; for (size_t i = 0; i < len; i++) { uint32_t r = arc4random() & 0xffff; @@ -183,7 +183,7 @@ String8 SharedLibraryUtils::getRandomString(size_t len) { } } buf[len] = '\0'; - return String8(buf); + return std::string(buf); } void* SharedLibraryUtils::loadSOHelper(const char *origName, const char *cacheDir, @@ -238,7 +238,7 @@ void* SharedLibraryUtils::loadSOHelper(const char *origName, const char *cacheDi newName.append("librs."); newName.append(resName); newName.append("#"); - newName.append(getRandomString(6).string()); // 62^6 potential filename variants. + newName.append(getRandomString(6).c_str()); // 62^6 potential filename variants. newName.append(".so"); int r = copyFile(newName.c_str(), origName); diff --git a/cpu_ref/rsCpuExecutable.h b/cpu_ref/rsCpuExecutable.h index 90d37591..ee58e377 100644 --- a/cpu_ref/rsCpuExecutable.h +++ b/cpu_ref/rsCpuExecutable.h @@ -17,10 +17,12 @@ #ifndef ANDROID_RENDERSCRIPT_EXECUTABLE_H #define ANDROID_RENDERSCRIPT_EXECUTABLE_H -#include <stdlib.h> #include "rsCpuScript.h" +#include <stdlib.h> +#include <string> + namespace android { namespace renderscript { @@ -47,7 +49,7 @@ public: bool *alreadyLoaded = nullptr); // Create a len length string containing random characters from [A-Za-z0-9]. - static String8 getRandomString(size_t len); + static std::string getRandomString(size_t len); private: // Attempt to load the shared library from origName, but then fall back to diff --git a/cpu_ref/rsCpuScript.cpp b/cpu_ref/rsCpuScript.cpp index 5bd24240..545e92f3 100644 --- a/cpu_ref/rsCpuScript.cpp +++ b/cpu_ref/rsCpuScript.cpp @@ -58,7 +58,7 @@ static bool allocationLODIsNull(const android::renderscript::Allocation *alloc) #ifndef RS_COMPATIBILITY_LIB static bool is_force_recompile() { - char buf[PROPERTY_VALUE_MAX]; + char buf[PROP_VALUE_MAX]; // Re-compile if floating point precision has been overridden. android::renderscript::property_get("debug.rs.precision", buf, ""); @@ -176,7 +176,7 @@ bool isChecksumNeeded(const char *cacheDir) { if ((::strcmp(SYSLIBPATH, cacheDir) == 0) || (::strcmp(SYSLIBPATH_VENDOR, cacheDir) == 0)) return false; - char buf[PROPERTY_VALUE_MAX]; + char buf[PROP_VALUE_MAX]; android::renderscript::property_get("ro.debuggable", buf, ""); return (buf[0] == '1'); } @@ -422,7 +422,7 @@ bool RsdCpuScriptImpl::init(char const *resName, char const *cacheDir, } } - mBitcodeFilePath.setTo(bcFileName.c_str()); + mBitcodeFilePath.assign(bcFileName.c_str()); #else // RS_COMPATIBILITY_LIB is defined const char *nativeLibDir = mCtx->getContext()->getNativeLibDir(); diff --git a/cpu_ref/rsCpuScript.h b/cpu_ref/rsCpuScript.h index c6f96245..1814d5ff 100644 --- a/cpu_ref/rsCpuScript.h +++ b/cpu_ref/rsCpuScript.h @@ -26,6 +26,8 @@ #include "rsCpuCore.h" +#include <string> + namespace bcinfo { class MetadataExtractor; } // namespace bcinfo @@ -130,14 +132,14 @@ protected: public: static const char* BCC_EXE_PATH; - const char* getBitcodeFilePath() const { return mBitcodeFilePath.string(); } + const char* getBitcodeFilePath() const { return mBitcodeFilePath.c_str(); } private: bool setUpMtlsDimensions(MTLaunchStructCommon *mtls, const RsLaunchDimensions &baseDim, const RsScriptCall *sc); - String8 mBitcodeFilePath; + std::string mBitcodeFilePath; uint32_t mBuildChecksum; bool mChecksumNeeded; }; diff --git a/cpu_ref/rsCpuScriptGroup.cpp b/cpu_ref/rsCpuScriptGroup.cpp index f7a330a2..cc2933c1 100644 --- a/cpu_ref/rsCpuScriptGroup.cpp +++ b/cpu_ref/rsCpuScriptGroup.cpp @@ -19,6 +19,8 @@ #include "rsScriptGroup.h" #include "rsCpuScriptGroup.h" +#include <vector> + namespace android { namespace renderscript { @@ -124,11 +126,11 @@ void CpuScriptGroupImpl::scriptGroupRoot(const RsExpandKernelDriverInfo *kinfo, void CpuScriptGroupImpl::execute() { - Vector<Allocation *> ins; - Vector<bool> inExts; - Vector<Allocation *> outs; - Vector<bool> outExts; - Vector<const ScriptKernelID *> kernels; + std::vector<Allocation *> ins; + std::vector<uint8_t> inExts; + std::vector<Allocation *> outs; + std::vector<uint8_t> outExts; + std::vector<const ScriptKernelID *> kernels; bool fieldDep = false; for (size_t ct=0; ct < mSG->mNodes.size(); ct++) { @@ -194,11 +196,11 @@ void CpuScriptGroupImpl::execute() { rsAssert((k->mHasKernelOutput == (aout != nullptr)) && (k->mHasKernelInput == (ain != nullptr))); - ins.add(ain); - inExts.add(inExt); - outs.add(aout); - outExts.add(outExt); - kernels.add(k); + ins.push_back(ain); + inExts.push_back(inExt); + outs.push_back(aout); + outExts.push_back(outExt); + kernels.push_back(k); } } @@ -237,9 +239,9 @@ void CpuScriptGroupImpl::execute() { } } else { ScriptList sl; - sl.ins = ins.array(); - sl.outs = outs.array(); - sl.kernels = kernels.array(); + sl.ins = ins.data(); + sl.outs = outs.data(); + sl.kernels = kernels.data(); sl.count = kernels.size(); uint32_t inLen; @@ -254,25 +256,25 @@ void CpuScriptGroupImpl::execute() { ains = const_cast<const Allocation**>(&ins[0]); } - Vector<const void *> usrPtrs; - Vector<const void *> fnPtrs; - Vector<uint32_t> sigs; + std::vector<const void *> usrPtrs; + std::vector<const void *> fnPtrs; + std::vector<uint32_t> sigs; for (size_t ct=0; ct < kernels.size(); ct++) { Script *s = kernels[ct]->mScript; RsdCpuScriptImpl *si = (RsdCpuScriptImpl *)mCtx->lookupScript(s); si->forEachKernelSetup(kernels[ct]->mSlot, &mtls); - fnPtrs.add((void *)mtls.kernel); - usrPtrs.add(mtls.fep.usr); - sigs.add(mtls.fep.usrLen); + fnPtrs.push_back((void *)mtls.kernel); + usrPtrs.push_back(mtls.fep.usr); + sigs.push_back(mtls.fep.usrLen); si->preLaunch(kernels[ct]->mSlot, ains, inLen, outs[ct], mtls.fep.usr, mtls.fep.usrLen, nullptr); } - sl.sigs = sigs.array(); - sl.usrPtrs = usrPtrs.array(); - sl.fnPtrs = fnPtrs.array(); - sl.inExts = inExts.array(); - sl.outExts = outExts.array(); + sl.sigs = sigs.data(); + sl.usrPtrs = usrPtrs.data(); + sl.fnPtrs = fnPtrs.data(); + sl.inExts = inExts.data(); + sl.outExts = outExts.data(); Script *s = kernels[0]->mScript; RsdCpuScriptImpl *si = (RsdCpuScriptImpl *)mCtx->lookupScript(s); diff --git a/cpu_ref/rsCpuScriptGroup.h b/cpu_ref/rsCpuScriptGroup.h index a749ea43..7e1386d7 100644 --- a/cpu_ref/rsCpuScriptGroup.h +++ b/cpu_ref/rsCpuScriptGroup.h @@ -41,9 +41,9 @@ protected: struct ScriptList { size_t count; Allocation *const* ins; - bool const* inExts; + uint8_t const* inExts; Allocation *const* outs; - bool const* outExts; + uint8_t const* outExts; const void *const* usrPtrs; size_t const *usrSizes; uint32_t const *sigs; diff --git a/cpu_ref/rsCpuScriptGroup2.cpp b/cpu_ref/rsCpuScriptGroup2.cpp index 9d9929a9..a8b72c41 100644 --- a/cpu_ref/rsCpuScriptGroup2.cpp +++ b/cpu_ref/rsCpuScriptGroup2.cpp @@ -483,7 +483,7 @@ void CpuScriptGroup2Impl::compile(const char* cacheDir) { cloneName.append(resName); cloneName.append("#"); - cloneName.append(SharedLibraryUtils::getRandomString(6).string()); + cloneName.append(SharedLibraryUtils::getRandomString(6).c_str()); // The last element in arguments is the output filename. arguments.pop_back(); |