diff options
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/renderscript/RenderScript.java | 16 | ||||
-rw-r--r-- | graphics/jni/android_renderscript_RenderScript.cpp | 11 |
2 files changed, 27 insertions, 0 deletions
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java index ea11882..a5bceb6 100644 --- a/graphics/java/android/renderscript/RenderScript.java +++ b/graphics/java/android/renderscript/RenderScript.java @@ -67,6 +67,7 @@ public class RenderScript { native int nContextCreate(int dev, int ver, boolean useDepth); native void nContextDestroy(int con); native void nContextSetSurface(int w, int h, Surface sur); + native void nContextSetPriority(int p); native void nContextBindRootScript(int script); native void nContextBindSampler(int sampler, int slot); @@ -218,6 +219,7 @@ public class RenderScript { Element mElement_XY_F32; Element mElement_XYZ_F32; + /////////////////////////////////////////////////////////////////////////////////// // @@ -229,6 +231,20 @@ public class RenderScript { } public RSMessage mMessageCallback = null; + public enum Priority { + LOW (5), //ANDROID_PRIORITY_BACKGROUND + 5 + NORMAL (-4); //ANDROID_PRIORITY_DISPLAY + + int mID; + Priority(int id) { + mID = id; + } + } + + public void contextSetPriority(Priority p) { + nContextSetPriority(p.mID); + } + private static class MessageThread extends Thread { RenderScript mRS; boolean mRun = true; diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp index 709cb97..d311c33 100644 --- a/graphics/jni/android_renderscript_RenderScript.cpp +++ b/graphics/jni/android_renderscript_RenderScript.cpp @@ -158,6 +158,16 @@ nContextCreate(JNIEnv *_env, jobject _this, jint dev, jint ver, jboolean useDept } static void +nContextSetPriority(JNIEnv *_env, jobject _this, jint p) +{ + RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); + LOG_API("ContextSetPriority, con(%p), priority(%i)", con, p); + rsContextSetPriority(con, p); +} + + + +static void nContextSetSurface(JNIEnv *_env, jobject _this, jint width, jint height, jobject wnd) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); @@ -1333,6 +1343,7 @@ static JNINativeMethod methods[] = { {"nDeviceDestroy", "(I)V", (void*)nDeviceDestroy }, {"nDeviceSetConfig", "(III)V", (void*)nDeviceSetConfig }, {"nContextCreate", "(IIZ)I", (void*)nContextCreate }, +{"nContextSetPriority", "(I)V", (void*)nContextSetPriority }, {"nContextSetSurface", "(IILandroid/view/Surface;)V", (void*)nContextSetSurface }, {"nContextDestroy", "(I)V", (void*)nContextDestroy }, {"nContextPause", "()V", (void*)nContextPause }, |