Fix use of rs_script_call_t.

There were a few broken parts here for rs_script_call_t.
1) Incorrect runtime function signatures.
2) Missing enum at the start of the driver structure.
3) Missing update of pointer based on xStart.

Bug: 7212879
Change-Id: I25d44d5534ceb61b49b0bbc7cf1b5c6b16bab360
diff --git a/driver/rsdBcc.cpp b/driver/rsdBcc.cpp
index e616afd..c78508c 100644
--- a/driver/rsdBcc.cpp
+++ b/driver/rsdBcc.cpp
@@ -194,7 +194,7 @@
         }
 
         //ALOGE("usr idx %i, x %i,%i  y %i,%i", idx, mtls->xStart, mtls->xEnd, yStart, yEnd);
-        //ALOGE("usr ptr in %p,  out %p", mtls->ptrIn, mtls->ptrOut);
+        //ALOGE("usr ptr in %p,  out %p", mtls->fep.ptrIn, mtls->fep.ptrOut);
 
 #if defined(ARCH_ARM_RS_USE_CACHED_SCANLINE_WRITE)
         if (mtls->fep.yStrideOut < sizeof(buf)) {
@@ -208,8 +208,10 @@
 #endif
             {
             for (p.y = yStart; p.y < yEnd; p.y++) {
-                p.out = mtls->fep.ptrOut + (mtls->fep.yStrideOut * p.y);
-                p.in = mtls->fep.ptrIn + (mtls->fep.yStrideIn * p.y);
+                p.out = mtls->fep.ptrOut + (mtls->fep.yStrideOut * p.y) +
+                        (mtls->fep.eStrideOut * mtls->xStart);
+                p.in = mtls->fep.ptrIn + (mtls->fep.yStrideIn * p.y) +
+                       (mtls->fep.eStrideIn * mtls->xStart);
                 fn(&p, mtls->xStart, mtls->xEnd, mtls->fep.eStrideIn, mtls->fep.eStrideOut);
             }
         }
@@ -234,7 +236,7 @@
         }
 
         //ALOGE("usr slice %i idx %i, x %i,%i", slice, idx, xStart, xEnd);
-        //ALOGE("usr ptr in %p,  out %p", mtls->ptrIn, mtls->ptrOut);
+        //ALOGE("usr ptr in %p,  out %p", mtls->fep.ptrIn, mtls->fep.ptrOut);
 
         p.out = mtls->fep.ptrOut + (mtls->fep.eStrideOut * xStart);
         p.in = mtls->fep.ptrIn + (mtls->fep.eStrideIn * xStart);
@@ -371,8 +373,10 @@
                 for (p.y = mtls->yStart; p.y < mtls->yEnd; p.y++) {
                     uint32_t offset = mtls->fep.dimY * mtls->fep.dimZ * p.ar[0] +
                                       mtls->fep.dimY * p.z + p.y;
-                    p.out = mtls->fep.ptrOut + (mtls->fep.yStrideOut * offset);
-                    p.in = mtls->fep.ptrIn + (mtls->fep.yStrideIn * offset);
+                    p.out = mtls->fep.ptrOut + (mtls->fep.yStrideOut * offset) +
+                            (mtls->fep.eStrideOut * mtls->xStart);
+                    p.in = mtls->fep.ptrIn + (mtls->fep.yStrideIn * offset) +
+                           (mtls->fep.eStrideIn * mtls->xStart);
                     fn(&p, mtls->xStart, mtls->xEnd, mtls->fep.eStrideIn, mtls->fep.eStrideOut);
                 }
             }
diff --git a/driver/rsdRuntimeStubs.cpp b/driver/rsdRuntimeStubs.cpp
index 1ab676e..9bd1396 100644
--- a/driver/rsdRuntimeStubs.cpp
+++ b/driver/rsdRuntimeStubs.cpp
@@ -824,9 +824,9 @@
 
     { "_Z9rsForEach9rs_script13rs_allocationS0_", (void *)&SC_ForEach_SAA, true },
     { "_Z9rsForEach9rs_script13rs_allocationS0_PKv", (void *)&SC_ForEach_SAAU, true },
-    { "_Z9rsForEach9rs_script13rs_allocationS0_PKvPK16rs_script_call_t", (void *)&SC_ForEach_SAAUS, true },
+    { "_Z9rsForEach9rs_script13rs_allocationS0_PKvPK14rs_script_call", (void *)&SC_ForEach_SAAUS, true },
     { "_Z9rsForEach9rs_script13rs_allocationS0_PKvj", (void *)&SC_ForEach_SAAUL, true },
-    { "_Z9rsForEach9rs_script13rs_allocationS0_PKvjPK16rs_script_call_t", (void *)&SC_ForEach_SAAULS, true },
+    { "_Z9rsForEach9rs_script13rs_allocationS0_PKvjPK14rs_script_call", (void *)&SC_ForEach_SAAULS, true },
 
     // time
     { "_Z6rsTimePi", (void *)&SC_Time, true },
diff --git a/rsDefines.h b/rsDefines.h
index cccff86..8900c13 100644
--- a/rsDefines.h
+++ b/rsDefines.h
@@ -357,8 +357,18 @@
     const char* objectName;
 } RsFileIndexEntry;
 
+enum RsForEachStrategy {
+    RS_FOR_EACH_STRATEGY_SERIAL = 0,
+    RS_FOR_EACH_STRATEGY_DONT_CARE = 1,
+    RS_FOR_EACH_STRATEGY_DST_LINEAR = 2,
+    RS_FOR_EACH_STRATEGY_TILE_SMALL = 3,
+    RS_FOR_EACH_STRATEGY_TILE_MEDIUM = 4,
+    RS_FOR_EACH_STRATEGY_TILE_LARGE = 5
+};
+
 // Script to Script
 typedef struct {
+    enum RsForEachStrategy strategy;
     uint32_t xStart;
     uint32_t xEnd;
     uint32_t yStart;
diff --git a/scriptc/rs_core.rsh b/scriptc/rs_core.rsh
index 1b0f9db..2aab509 100644
--- a/scriptc/rs_core.rsh
+++ b/scriptc/rs_core.rsh
@@ -97,12 +97,12 @@
  * This is a hint and implementations may not obey the order.
  */
 enum rs_for_each_strategy {
-    RS_FOR_EACH_STRATEGY_SERIAL,
-    RS_FOR_EACH_STRATEGY_DONT_CARE,
-    RS_FOR_EACH_STRATEGY_DST_LINEAR,
-    RS_FOR_EACH_STRATEGY_TILE_SMALL,
-    RS_FOR_EACH_STRATEGY_TILE_MEDIUM,
-    RS_FOR_EACH_STRATEGY_TILE_LARGE
+    RS_FOR_EACH_STRATEGY_SERIAL = 0,
+    RS_FOR_EACH_STRATEGY_DONT_CARE = 1,
+    RS_FOR_EACH_STRATEGY_DST_LINEAR = 2,
+    RS_FOR_EACH_STRATEGY_TILE_SMALL= 3,
+    RS_FOR_EACH_STRATEGY_TILE_MEDIUM = 4,
+    RS_FOR_EACH_STRATEGY_TILE_LARGE = 5
 };