summaryrefslogtreecommitdiffstats
path: root/rs
diff options
context:
space:
mode:
authorJason Sams <jsams@google.com>2014-05-07 14:23:27 -0700
committerJason Sams <jsams@google.com>2014-05-07 14:23:46 -0700
commit26e9051957dc3255cce9c5336c4a32f280c3eb4d (patch)
tree922b3764b8fc4149ca7cb42f0ac9fa4ef442ecf8 /rs
parentc9e7b1e3dae2b2b6207aac16e94cce1b8220a85e (diff)
downloadframeworks_base-26e9051957dc3255cce9c5336c4a32f280c3eb4d.zip
frameworks_base-26e9051957dc3255cce9c5336c4a32f280c3eb4d.tar.gz
frameworks_base-26e9051957dc3255cce9c5336c4a32f280c3eb4d.tar.bz2
Add flags to context creation for RS
We have a number of context options exposed though native that were not available though the Java API. This brings them to parity. Will finish plumbing in a follow on CL. Change-Id: I8c65ee743d0e750e418304127b84088f25176c38
Diffstat (limited to 'rs')
-rw-r--r--rs/java/android/renderscript/RenderScript.java39
1 files changed, 36 insertions, 3 deletions
diff --git a/rs/java/android/renderscript/RenderScript.java b/rs/java/android/renderscript/RenderScript.java
index dce4f58..a62d1fd 100644
--- a/rs/java/android/renderscript/RenderScript.java
+++ b/rs/java/android/renderscript/RenderScript.java
@@ -63,6 +63,25 @@ public class RenderScript {
static Method registerNativeAllocation;
static Method registerNativeFree;
+ /*
+ * Context creation flag which specifies a normal context.
+ */
+ public static final long CREATE_FLAG_NONE = 0x0000;
+
+ /*
+ * Context creation flag which specifies a context optimized for low
+ * latency over peak performance. This is a hint and may have no effect
+ * on some implementations.
+ */
+ public static final long CREATE_FLAG_LOW_LATENCY = 0x0001;
+
+ /*
+ * Context creation flag which specifies a context optimized for long
+ * battery life over peak performance. This is a hint and may have no effect
+ * on some implementations.
+ */
+ public static final long CREATE_FLAG_LOW_POWER = 0x0002;
+
static {
sInitialized = false;
if (!SystemProperties.getBoolean("config.disable_renderscript", false)) {
@@ -1145,7 +1164,7 @@ public class RenderScript {
* @hide
*/
public static RenderScript create(Context ctx, int sdkVersion) {
- return create(ctx, sdkVersion, ContextType.NORMAL);
+ return create(ctx, sdkVersion, ContextType.NORMAL, CREATE_FLAG_NONE);
}
/**
@@ -1155,7 +1174,7 @@ public class RenderScript {
* @param ctx The context.
* @return RenderScript
*/
- public static RenderScript create(Context ctx, int sdkVersion, ContextType ct) {
+ public static RenderScript create(Context ctx, int sdkVersion, ContextType ct, long flags) {
if (!sInitialized) {
Log.e(LOG_TAG, "RenderScript.create() called when disabled; someone is likely to crash");
return null;
@@ -1194,7 +1213,21 @@ public class RenderScript {
*/
public static RenderScript create(Context ctx, ContextType ct) {
int v = ctx.getApplicationInfo().targetSdkVersion;
- return create(ctx, v, ct);
+ return create(ctx, v, ct, CREATE_FLAG_NONE);
+ }
+
+ /**
+ * Create a RenderScript context.
+ *
+ *
+ * @param ctx The context.
+ * @param ct The type of context to be created.
+ * @param flags The OR of the CREATE_FLAG_* options desired
+ * @return RenderScript
+ */
+ public static RenderScript create(Context ctx, ContextType ct, long flags) {
+ int v = ctx.getApplicationInfo().targetSdkVersion;
+ return create(ctx, v, ct, flags);
}
/**