summaryrefslogtreecommitdiffstats
path: root/tests/RenderScriptTests/PerfTest/src/com/android
diff options
context:
space:
mode:
Diffstat (limited to 'tests/RenderScriptTests/PerfTest/src/com/android')
-rw-r--r--tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBench.java5
-rw-r--r--tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java4
-rw-r--r--tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchView.java4
-rw-r--r--tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs5
4 files changed, 18 insertions, 0 deletions
diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBench.java b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBench.java
index 4ed42b4..0dceafe 100644
--- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBench.java
+++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBench.java
@@ -95,8 +95,10 @@ public class RsBench extends Activity {
switch (item.getItemId()) {
case R.id.benchmark_all:
mView.setBenchmarkMode(-1);
+ mView.suspendRendering(false);
return true;
case R.id.benchmark_one:
+ mView.suspendRendering(true);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Pick a Test");
builder.setItems(mView.getTestNames(),
@@ -106,11 +108,13 @@ public class RsBench extends Activity {
"Starting to benchmark: " + mView.getTestNames()[item],
Toast.LENGTH_SHORT).show();
mView.setBenchmarkMode(item);
+ mView.suspendRendering(false);
}
});
builder.show();
return true;
case R.id.debug_mode:
+ mView.suspendRendering(true);
AlertDialog.Builder debugBuilder = new AlertDialog.Builder(this);
debugBuilder.setTitle("Pick a Test");
debugBuilder.setItems(mView.getTestNames(),
@@ -120,6 +124,7 @@ public class RsBench extends Activity {
"Switching to: " + mView.getTestNames()[item],
Toast.LENGTH_SHORT).show();
mView.setDebugMode(item);
+ mView.suspendRendering(false);
}
});
debugBuilder.show();
diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java
index 8c67026..4ac7dd5 100644
--- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java
+++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java
@@ -266,6 +266,10 @@ public class RsBenchRS {
mScript.invoke_setBenchmarkMode(benchNum);
}
+ public void pause(boolean pause) {
+ mScript.set_gPauseRendering(pause);
+ }
+
private void initRS() {
mScript = new ScriptC_rsbench(mRS, mRes, R.raw.rsbench);
diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchView.java b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchView.java
index 004e6bf..124071e 100644
--- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchView.java
+++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchView.java
@@ -92,6 +92,10 @@ public class RsBenchView extends RSSurfaceView {
mRender.setBenchmarkMode(benchNum);
}
+ void suspendRendering(boolean pause) {
+ mRender.pause(pause);
+ }
+
void setDebugMode(int num) {
mRender.setDebugMode(num);
}
diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs
index cb15449..27e5b11 100644
--- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs
+++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs
@@ -51,6 +51,7 @@ typedef struct TestScripts_s {
TestScripts *gTestScripts;
bool gLoadComplete = false;
+bool gPauseRendering = false;
static float gDt = 0;
@@ -257,6 +258,10 @@ int root(void) {
return 1;
}
+ if (gPauseRendering) {
+ rsgDrawText("Paused", 50, 50);
+ return 30;
+ }
if (gIsDebugMode) {
debug();
} else {