Add support for DEBUG context type.

Bug: 7343201

This change adds switching for the debug runtime (libclcore_debug.bc) when
running under a DEBUG RS context. It also fixes a small naming issue for
rsSetElementAt_int().

Change-Id: I8b574c9ce915a440375530325ba7de2b46707cfd
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);
     }