summaryrefslogtreecommitdiff
path: root/rs/jni
diff options
context:
space:
mode:
authorMiao Wang <miaowang@google.com>2015-10-26 17:44:10 -0700
committerMiao Wang <miaowang@google.com>2016-01-26 14:40:44 -0800
commit8c1509249c5552270d8accc2c9512f499a8f5e2d (patch)
tree1eb1ed7548cda13c54d19d96b6fb86bcee88520d /rs/jni
parented50f333fb28905f085473d3150f906f0106295a (diff)
[RenderScript] Implement APIs for better multi-frame process support.
Bug: 23535524 Two APIs added for multiframe processing: - createAllocations(...): To create an array of Allocations sharing the same Type and Usage. For USAGE_IO_INPUT Allocations, they also share the same BufferQueue. - getTimeStamp(): API to retrieve the time stamp associated with the most recent buffer. Change-Id: I6b7b35d7dca5e87ee2f3db2ee17cb9cf824bcfe1
Diffstat (limited to 'rs/jni')
-rw-r--r--rs/jni/android_renderscript_RenderScript.cpp30
1 files changed, 26 insertions, 4 deletions
diff --git a/rs/jni/android_renderscript_RenderScript.cpp b/rs/jni/android_renderscript_RenderScript.cpp
index 398d89b20b1e..3dff37bb4505 100644
--- a/rs/jni/android_renderscript_RenderScript.cpp
+++ b/rs/jni/android_renderscript_RenderScript.cpp
@@ -1223,6 +1223,27 @@ nAllocationSyncAll(JNIEnv *_env, jobject _this, jlong con, jlong a, jint bits)
rsAllocationSyncAll((RsContext)con, (RsAllocation)a, (RsAllocationUsageType)bits);
}
+static void
+nAllocationSetupBufferQueue(JNIEnv *_env, jobject _this, jlong con, jlong alloc, jint numAlloc)
+{
+ if (kLogApi) {
+ ALOGD("nAllocationSetupBufferQueue, con(%p), alloc(%p), numAlloc(%d)", (RsContext)con,
+ (RsAllocation)alloc, numAlloc);
+ }
+ rsAllocationSetupBufferQueue((RsContext)con, (RsAllocation)alloc, (uint32_t)numAlloc);
+}
+
+static void
+nAllocationShareBufferQueue(JNIEnv *_env, jobject _this, jlong con, jlong alloc1, jlong alloc2)
+{
+ if (kLogApi) {
+ ALOGD("nAllocationShareBufferQueue, con(%p), alloc1(%p), alloc2(%p)", (RsContext)con,
+ (RsAllocation)alloc1, (RsAllocation)alloc2);
+ }
+
+ rsAllocationShareBufferQueue((RsContext)con, (RsAllocation)alloc1, (RsAllocation)alloc2);
+}
+
static jobject
nAllocationGetSurface(JNIEnv *_env, jobject _this, jlong con, jlong a)
{
@@ -1265,16 +1286,15 @@ nAllocationIoSend(JNIEnv *_env, jobject _this, jlong con, jlong alloc)
rsAllocationIoSend((RsContext)con, (RsAllocation)alloc);
}
-static void
+static jlong
nAllocationIoReceive(JNIEnv *_env, jobject _this, jlong con, jlong alloc)
{
if (kLogApi) {
ALOGD("nAllocationIoReceive, con(%p), alloc(%p)", (RsContext)con, (RsAllocation)alloc);
}
- rsAllocationIoReceive((RsContext)con, (RsAllocation)alloc);
+ return (jlong) rsAllocationIoReceive((RsContext)con, (RsAllocation)alloc);
}
-
static void
nAllocationGenerateMipmaps(JNIEnv *_env, jobject _this, jlong con, jlong alloc)
{
@@ -2856,10 +2876,12 @@ static const JNINativeMethod methods[] = {
{"rsnAllocationCopyToBitmap", "(JJLandroid/graphics/Bitmap;)V", (void*)nAllocationCopyToBitmap },
{"rsnAllocationSyncAll", "(JJI)V", (void*)nAllocationSyncAll },
+{"rsnAllocationSetupBufferQueue", "(JJI)V", (void*)nAllocationSetupBufferQueue },
+{"rsnAllocationShareBufferQueue", "(JJJ)V", (void*)nAllocationShareBufferQueue },
{"rsnAllocationGetSurface", "(JJ)Landroid/view/Surface;", (void*)nAllocationGetSurface },
{"rsnAllocationSetSurface", "(JJLandroid/view/Surface;)V", (void*)nAllocationSetSurface },
{"rsnAllocationIoSend", "(JJ)V", (void*)nAllocationIoSend },
-{"rsnAllocationIoReceive", "(JJ)V", (void*)nAllocationIoReceive },
+{"rsnAllocationIoReceive", "(JJ)J", (void*)nAllocationIoReceive },
{"rsnAllocationData1D", "(JJIIILjava/lang/Object;IIIZ)V", (void*)nAllocationData1D },
{"rsnAllocationElementData", "(JJIIIII[BI)V", (void*)nAllocationElementData },
{"rsnAllocationData2D", "(JJIIIIIILjava/lang/Object;IIIZ)V", (void*)nAllocationData2D },