Merge "Fix YUV intrinsic" into jb-mr2-dev
diff --git a/cpu_ref/rsCpuScript.cpp b/cpu_ref/rsCpuScript.cpp
index 0b8dff7..d9e0044 100644
--- a/cpu_ref/rsCpuScript.cpp
+++ b/cpu_ref/rsCpuScript.cpp
@@ -149,6 +149,12 @@
if (selectRTCallback != NULL) {
core_lib = selectRTCallback((const char *)bitcode, bitcodeSize);
}
+
+ if (mCtx->getContext()->getContextType() == RS_CONTEXT_TYPE_DEBUG) {
+ // Use the libclcore_debug.bc instead of the default library.
+ core_lib = bcc::RSInfo::LibCLCoreDebugPath;
+ mCompilerDriver->setDebugContext(true);
+ }
exec = mCompilerDriver->build(*mCompilerContext, cacheDir, resName,
(const char *)bitcode, bitcodeSize, core_lib,
mCtx->getLinkRuntimeCallback());
diff --git a/driver/rsdRuntimeStubs.cpp b/driver/rsdRuntimeStubs.cpp
index 37c7b8d..c22b966 100644
--- a/driver/rsdRuntimeStubs.cpp
+++ b/driver/rsdRuntimeStubs.cpp
@@ -565,20 +565,20 @@
char buf[256];
if (x >= t->getLODDimX(0)) {
sprintf(buf, "Out range ElementAt X %i of %i", x, t->getLODDimX(0));
- rsc->setError(RS_ERROR_FATAL_UNKNOWN, buf);
+ rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
return NULL;
}
if (vecSize > 0) {
if (vecSize != e->getVectorSize()) {
sprintf(buf, "Vector size mismatch for ElementAt %i of %i", vecSize, e->getVectorSize());
- rsc->setError(RS_ERROR_FATAL_UNKNOWN, buf);
+ rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
return NULL;
}
if (dt != e->getType()) {
sprintf(buf, "Data type mismatch for ElementAt %i of %i", dt, e->getType());
- rsc->setError(RS_ERROR_FATAL_UNKNOWN, buf);
+ rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
return NULL;
}
}
@@ -596,26 +596,26 @@
char buf[256];
if (x >= t->getLODDimX(0)) {
sprintf(buf, "Out range ElementAt X %i of %i", x, t->getLODDimX(0));
- rsc->setError(RS_ERROR_FATAL_UNKNOWN, buf);
+ rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
return NULL;
}
if (y >= t->getLODDimY(0)) {
sprintf(buf, "Out range ElementAt Y %i of %i", y, t->getLODDimY(0));
- rsc->setError(RS_ERROR_FATAL_UNKNOWN, buf);
+ rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
return NULL;
}
if (vecSize > 0) {
if (vecSize != e->getVectorSize()) {
sprintf(buf, "Vector size mismatch for ElementAt %i of %i", vecSize, e->getVectorSize());
- rsc->setError(RS_ERROR_FATAL_UNKNOWN, buf);
+ rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
return NULL;
}
if (dt != e->getType()) {
sprintf(buf, "Data type mismatch for ElementAt %i of %i", dt, e->getType());
- rsc->setError(RS_ERROR_FATAL_UNKNOWN, buf);
+ rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
return NULL;
}
}
@@ -634,32 +634,32 @@
char buf[256];
if (x >= t->getLODDimX(0)) {
sprintf(buf, "Out range ElementAt X %i of %i", x, t->getLODDimX(0));
- rsc->setError(RS_ERROR_FATAL_UNKNOWN, buf);
+ rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
return NULL;
}
if (y >= t->getLODDimY(0)) {
sprintf(buf, "Out range ElementAt Y %i of %i", y, t->getLODDimY(0));
- rsc->setError(RS_ERROR_FATAL_UNKNOWN, buf);
+ rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
return NULL;
}
if (z >= t->getLODDimZ(0)) {
sprintf(buf, "Out range ElementAt Z %i of %i", z, t->getLODDimZ(0));
- rsc->setError(RS_ERROR_FATAL_UNKNOWN, buf);
+ rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
return NULL;
}
if (vecSize > 0) {
if (vecSize != e->getVectorSize()) {
sprintf(buf, "Vector size mismatch for ElementAt %i of %i", vecSize, e->getVectorSize());
- rsc->setError(RS_ERROR_FATAL_UNKNOWN, buf);
+ rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
return NULL;
}
if (dt != e->getType()) {
sprintf(buf, "Data type mismatch for ElementAt %i of %i", dt, e->getType());
- rsc->setError(RS_ERROR_FATAL_UNKNOWN, buf);
+ rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
return NULL;
}
}
@@ -1008,7 +1008,7 @@
{ "_Z20rsSetElementAt_uint313rs_allocationPKDv3_jjjj", (void *)&SC_SetElementAt3_uint3, true },
{ "_Z20rsSetElementAt_uint413rs_allocationPKDv4_jjjj", (void *)&SC_SetElementAt3_uint4, true },
- { "_Z19rsSetElementAt_int13rs_allocationPKij", (void *)&SC_SetElementAt1_int, true },
+ { "_Z18rsSetElementAt_int13rs_allocationPKij", (void *)&SC_SetElementAt1_int, true },
{ "_Z19rsSetElementAt_int213rs_allocationPKDv2_ij", (void *)&SC_SetElementAt1_int2, true },
{ "_Z19rsSetElementAt_int313rs_allocationPKDv3_ij", (void *)&SC_SetElementAt1_int3, true },
{ "_Z19rsSetElementAt_int413rs_allocationPKDv4_ij", (void *)&SC_SetElementAt1_int4, true },
diff --git a/rsContext.cpp b/rsContext.cpp
index 749973a..2c2573e 100644
--- a/rsContext.cpp
+++ b/rsContext.cpp
@@ -316,6 +316,8 @@
ALOGE("Skipping override driver and loading default CPU driver");
} else if (rsc->mForceCpu) {
ALOGV("Application requested CPU execution");
+ } else if (rsc->getContextType() == RS_CONTEXT_TYPE_DEBUG) {
+ ALOGV("Application requested debug context");
} else {
if (loadRuntime(OVERRIDE_RS_DRIVER_STRING, rsc)) {
ALOGE("Successfully loaded runtime: %s", OVERRIDE_RS_DRIVER_STRING);
@@ -503,15 +505,18 @@
mIsContextLite = false;
memset(&watchdog, 0, sizeof(watchdog));
mForceCpu = false;
+ mContextType = RS_CONTEXT_TYPE_NORMAL;
mSynchronous = false;
}
Context * Context::createContext(Device *dev, const RsSurfaceConfig *sc,
- bool forceCpu, bool synchronous) {
+ RsContextType ct, bool forceCpu,
+ bool synchronous) {
Context * rsc = new Context();
rsc->mForceCpu = forceCpu;
rsc->mSynchronous = synchronous;
+ rsc->mContextType = ct;
if (!rsc->initContext(dev, sc)) {
delete rsc;
@@ -896,7 +901,7 @@
RsContextType ct, bool forceCpu, bool synchronous) {
ALOGV("rsContextCreate dev=%p", vdev);
Device * dev = static_cast<Device *>(vdev);
- Context *rsc = Context::createContext(dev, NULL, forceCpu, synchronous);
+ Context *rsc = Context::createContext(dev, NULL, ct, forceCpu, synchronous);
if (rsc) {
rsc->setTargetSdkVersion(sdkVersion);
}
diff --git a/rsContext.h b/rsContext.h
index 5b1f50c..abc9b27 100644
--- a/rsContext.h
+++ b/rsContext.h
@@ -71,7 +71,9 @@
};
Hal mHal;
- static Context * createContext(Device *, const RsSurfaceConfig *sc, bool forceCpu = false, bool synchronous = false);
+ static Context * createContext(Device *, const RsSurfaceConfig *sc,
+ RsContextType ct = RS_CONTEXT_TYPE_NORMAL,
+ bool forceCpu = false, bool synchronous = false);
static Context * createContextLite();
~Context();
@@ -229,6 +231,9 @@
uint32_t getTargetSdkVersion() const {return mTargetSdkVersion;}
void setTargetSdkVersion(uint32_t sdkVer) {mTargetSdkVersion = sdkVer;}
+ RsContextType getContextType() const { return mContextType; }
+ void setContextType(RsContextType ct) { mContextType = ct; }
+
Device *mDev;
protected:
@@ -241,6 +246,8 @@
bool mForceCpu;
+ RsContextType mContextType;
+
bool mRunning;
bool mExit;
bool mPaused;
diff --git a/rsDefines.h b/rsDefines.h
index 242d649..6e080de 100644
--- a/rsDefines.h
+++ b/rsDefines.h
@@ -300,6 +300,9 @@
RS_ERROR_OUT_OF_MEMORY = 4,
RS_ERROR_DRIVER = 5,
+ // Errors that only occur in the debug context.
+ RS_ERROR_FATAL_DEBUG = 0x0800,
+
RS_ERROR_FATAL_UNKNOWN = 0x1000,
RS_ERROR_FATAL_DRIVER = 0x1001,
RS_ERROR_FATAL_PROGRAM_LINK = 0x1002