summaryrefslogtreecommitdiffstats
path: root/tests/RenderScriptTests/PerfTest/src/com
diff options
context:
space:
mode:
authorAlex Sakhartchouk <alexst@google.com>2011-12-09 10:04:27 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-12-09 10:04:27 -0800
commitf8c1f1c17c4909e321f23a9cd603d4410cd03ce0 (patch)
tree06195e39a5a5c389419bd8b400e28b8e13eb505e /tests/RenderScriptTests/PerfTest/src/com
parente61fd281a8cb69ae45c5de4b160ab86226083152 (diff)
parente7a5b5aa9a3c8b371dd89f44b7d4cef445f7f7c2 (diff)
downloadframeworks_base-f8c1f1c17c4909e321f23a9cd603d4410cd03ce0.zip
frameworks_base-f8c1f1c17c4909e321f23a9cd603d4410cd03ce0.tar.gz
frameworks_base-f8c1f1c17c4909e321f23a9cd603d4410cd03ce0.tar.bz2
Merge "Making UI a bit more responsive."
Diffstat (limited to 'tests/RenderScriptTests/PerfTest/src/com')
-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 {