Merge "Remove STL references from header files"
diff --git a/driver/rsdRuntimeStubs.cpp b/driver/rsdRuntimeStubs.cpp
index b7e676e..1bfbf9f 100644
--- a/driver/rsdRuntimeStubs.cpp
+++ b/driver/rsdRuntimeStubs.cpp
@@ -157,6 +157,24 @@
#endif
+// Some RS functions are not threadsafe but can be called from an invoke
+// function. Instead of summarily marking scripts that call these functions as
+// not-threadable we detect calls to them in the driver and sends a fatal error
+// message.
+static bool failIfInKernel(Context *rsc, const char *funcName) {
+ RsdHal *dc = (RsdHal *)rsc->mHal.drv;
+ RsdCpuReference *impl = (RsdCpuReference *) dc->mCpuRef;
+
+ if (impl->getInForEach()) {
+ char buf[256];
+ sprintf(buf, "Error: Call to unsupported function %s "
+ "in kernel", funcName);
+ rsc->setError(RS_ERROR_FATAL_DRIVER, buf);
+ return true;
+ }
+ return false;
+}
+
//////////////////////////////////////////////////////////////////////////////
// Allocation
//////////////////////////////////////////////////////////////////////////////
@@ -181,6 +199,9 @@
RS_TY_ALLOC srcAlloc,
uint32_t srcOff, uint32_t srcMip) {
Context *rsc = RsdCpuReference::getTlsContext();
+ if (failIfInKernel(rsc, "rsAllocationCopy1DRange"))
+ return;
+
rsrAllocationCopy1DRange(rsc, rsGetObjPtr(dstAlloc), dstOff, dstMip, count,
rsGetObjPtr(srcAlloc), srcOff, srcMip);
}
@@ -193,6 +214,9 @@
uint32_t srcXoff, uint32_t srcYoff,
uint32_t srcMip, uint32_t srcFace) {
Context *rsc = RsdCpuReference::getTlsContext();
+ if (failIfInKernel(rsc, "rsAllocationCopy2DRange"))
+ return;
+
rsrAllocationCopy2DRange(rsc, rsGetObjPtr(dstAlloc),
dstXoff, dstYoff, dstMip, dstFace,
width, height, rsGetObjPtr(srcAlloc),
@@ -201,12 +225,18 @@
static void SC_AllocationIoSend(RS_TY_ALLOC alloc) {
Context *rsc = RsdCpuReference::getTlsContext();
+ if (failIfInKernel(rsc, "rsAllocationIoSend"))
+ return;
+
rsrAllocationIoSend(rsc, rsGetObjPtr(alloc));
}
static void SC_AllocationIoReceive(RS_TY_ALLOC alloc) {
Context *rsc = RsdCpuReference::getTlsContext();
+ if (failIfInKernel(rsc, "rsAllocationIoReceive"))
+ return;
+
rsrAllocationIoReceive(rsc, rsGetObjPtr(alloc));
}
@@ -219,6 +249,9 @@
RS_TY_ALLOC srcAlloc,
uint32_t srcOff, uint32_t srcMip) {
Context *rsc = RsdCpuReference::getTlsContext();
+ if (failIfInKernel(rsc, "rsAllocationCopy1DRange"))
+ return;
+
rsrAllocationCopy1DRange(rsc, rsGetObjPtr(dstAlloc), dstOff, dstMip, count,
rsGetObjPtr(srcAlloc), srcOff, srcMip);
}
@@ -231,6 +264,9 @@
uint32_t srcXoff, uint32_t srcYoff,
uint32_t srcMip, uint32_t srcFace) {
Context *rsc = RsdCpuReference::getTlsContext();
+ if (failIfInKernel(rsc, "rsAllocationCopy2DRange"))
+ return;
+
rsrAllocationCopy2DRange(rsc, rsGetObjPtr(dstAlloc),
dstXoff, dstYoff, dstMip, dstFace,
width, height,
@@ -240,12 +276,18 @@
static void SC_AllocationIoSend(RS_TY_ALLOC alloc) {
Context *rsc = RsdCpuReference::getTlsContext();
+ if (failIfInKernel(rsc, "rsAllocationIoSend"))
+ return;
+
rsrAllocationIoSend(rsc, rsGetObjPtr(alloc));
}
static void SC_AllocationIoReceive(RS_TY_ALLOC alloc) {
Context *rsc = RsdCpuReference::getTlsContext();
+ if (failIfInKernel(rsc, "rsAllocationIoReceive"))
+ return;
+
rsrAllocationIoReceive(rsc, rsGetObjPtr(alloc));
}
diff --git a/run_rs_cts.sh b/run_rs_cts.sh
index 48bc001..9022844 100755
--- a/run_rs_cts.sh
+++ b/run_rs_cts.sh
@@ -1,12 +1,22 @@
-#!/bin/bash
+#!/bin/bash -x
# Run the general RS CTS tests. We can expand this script to run more tests
# as we see fit, but this essentially should be a reasonable smoke test of
# RenderScript (to be run on build/test bots).
CTS_TRADEFED=$ANDROID_BUILD_TOP/out/host/linux-x86/bin/cts-tradefed
+TMP_PATH=`mktemp -d`
#$CTS_TRADEFED run commandAndExit cts --force-abi 64 -p android.renderscript
#$CTS_TRADEFED run commandAndExit cts --force-abi 32 -p android.renderscript
-$CTS_TRADEFED run commandAndExit cts -p android.renderscript
+$CTS_TRADEFED run commandAndExit cts --output-file-path $TMP_PATH -p android.renderscript
+
+CTS_RESULTS=$ANDROID_BUILD_TOP/cts-results
+RESULTS=$CTS_RESULTS/renderscript
+mkdir -p $CTS_RESULTS
+rm -rf $RESULTS
+mkdir $RESULTS
+find $TMP_PATH -name 'testResult.xml' -exec cp {} $RESULTS/ \;
+rm -rf $TMP_PATH
+
exit $?