Merge change I715333b8 into eclair
* changes:
Add support for dumping RS objects to aid in debugging of white blocks bug.
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index a5bceb6..c42f647 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -68,6 +68,7 @@
native void nContextDestroy(int con);
native void nContextSetSurface(int w, int h, Surface sur);
native void nContextSetPriority(int p);
+ native void nContextDump(int bits);
native void nContextBindRootScript(int script);
native void nContextBindSampler(int sampler, int slot);
@@ -304,6 +305,10 @@
nContextSetSurface(w, h, mSurface);
}
+ public void contextDump(int bits) {
+ nContextDump(bits);
+ }
+
public void destroy() {
nContextDeinitToClient();
mMessageThread.mRun = false;
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index d311c33..af3bc74 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -189,9 +189,16 @@
nContextDestroy(JNIEnv *_env, jobject _this, jint con)
{
LOG_API("nContextDestroy, con(%p)", (RsContext)con);
- return rsContextDestroy((RsContext)con);
+ rsContextDestroy((RsContext)con);
}
+static void
+nContextDump(JNIEnv *_env, jobject _this, jint bits)
+{
+ RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
+ LOG_API("nContextDump, con(%p) bits(%i)", (RsContext)con, bits);
+ rsContextDump((RsContext)con, bits);
+}
static void
nContextPause(JNIEnv *_env, jobject _this)
@@ -1346,6 +1353,7 @@
{"nContextSetPriority", "(I)V", (void*)nContextSetPriority },
{"nContextSetSurface", "(IILandroid/view/Surface;)V", (void*)nContextSetSurface },
{"nContextDestroy", "(I)V", (void*)nContextDestroy },
+{"nContextDump", "(I)V", (void*)nContextDump },
{"nContextPause", "()V", (void*)nContextPause },
{"nContextResume", "()V", (void*)nContextResume },
{"nAssignName", "(I[B)V", (void*)nAssignName },
diff --git a/libs/rs/rs.spec b/libs/rs/rs.spec
index be988e7..a4e72d9 100644
--- a/libs/rs/rs.spec
+++ b/libs/rs/rs.spec
@@ -42,6 +42,10 @@
param void *sur
}
+ContextDump {
+ param int32_t bits
+}
+
ContextSetPriority {
param int32_t priority
}
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp
index 16029a6..408d83f 100644
--- a/libs/rs/rsAllocation.cpp
+++ b/libs/rs/rsAllocation.cpp
@@ -190,6 +190,24 @@
{
}
+void Allocation::dumpLOGV(const char *prefix) const
+{
+ ObjectBase::dumpLOGV(prefix);
+
+ String8 s(prefix);
+ s.append(" type ");
+ if (mType.get()) {
+ mType->dumpLOGV(s.string());
+ }
+
+ LOGV("%s allocation ptr=%p mCpuWrite=%i, mCpuRead=%i, mGpuWrite=%i, mGpuRead=%i",
+ prefix, mPtr, mCpuWrite, mCpuRead, mGpuWrite, mGpuRead);
+
+ LOGV("%s allocation mIsTexture=%i mIsTextureID=%i, mIsVertexBuffer=%i, mBufferID=%i",
+ prefix, mIsTexture, mTextureID, mIsVertexBuffer, mBufferID);
+
+
+}
/////////////////
diff --git a/libs/rs/rsAllocation.h b/libs/rs/rsAllocation.h
index 1b83267..514b1c2 100644
--- a/libs/rs/rsAllocation.h
+++ b/libs/rs/rsAllocation.h
@@ -65,6 +65,8 @@
void enableGLVertexBuffers() const;
void setupGLIndexBuffers() const;
+ virtual void dumpLOGV(const char *prefix) const;
+
protected:
ObjectBaseRef<const Type> mType;
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index deb9592..08ed725 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -819,6 +819,11 @@
rsc->setPriority(p);
}
+void rsi_ContextDump(Context *rsc, int32_t bits)
+{
+ ObjectBase::dumpAll(rsc);
+}
+
}
}
diff --git a/libs/rs/rsObjectBase.cpp b/libs/rs/rsObjectBase.cpp
index b7d67cc..05791cb 100644
--- a/libs/rs/rsObjectBase.cpp
+++ b/libs/rs/rsObjectBase.cpp
@@ -190,3 +190,15 @@
}
}
+void ObjectBase::dumpAll(Context *rsc)
+{
+ if (rsc->props.mLogObjects) {
+ LOGV("Dumping all objects");
+ const ObjectBase * o = rsc->mObjHead;
+ while (o) {
+ o->dumpLOGV(" ");
+ o = o->mNext;
+ }
+ }
+}
+
diff --git a/libs/rs/rsObjectBase.h b/libs/rs/rsObjectBase.h
index dc85ac7..f247022 100644
--- a/libs/rs/rsObjectBase.h
+++ b/libs/rs/rsObjectBase.h
@@ -49,6 +49,7 @@
void setContext(Context *);
static void zeroAllUserRef(Context *rsc);
+ static void dumpAll(Context *rsc);
virtual void dumpLOGV(const char *prefix) const;