am fa0394c9: Merge change I715333b8 into eclair

Merge commit 'fa0394c9f89f13b53c6db2470253825b88cafb64' into eclair-mr2

* commit 'fa0394c9f89f13b53c6db2470253825b88cafb64':
  Add support for dumping RS objects to aid in debugging of white blocks bug.
This commit is contained in:
Jason Sams
2009-11-17 17:35:44 -08:00
committed by Android Git Automerger
8 changed files with 56 additions and 1 deletions

View File

@ -68,6 +68,7 @@ public class RenderScript {
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 @@ public class RenderScript {
nContextSetSurface(w, h, mSurface);
}
public void contextDump(int bits) {
nContextDump(bits);
}
public void destroy() {
nContextDeinitToClient();
mMessageThread.mRun = false;

View File

@ -189,9 +189,16 @@ static void
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 @@ static JNINativeMethod methods[] = {
{"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 },

View File

@ -42,6 +42,10 @@ ContextSetSurface {
param void *sur
}
ContextDump {
param int32_t bits
}
ContextSetPriority {
param int32_t priority
}

View File

@ -190,6 +190,24 @@ void Allocation::subData(uint32_t xoff, uint32_t yoff, uint32_t zoff,
{
}
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);
}
/////////////////

View File

@ -65,6 +65,8 @@ public:
void enableGLVertexBuffers() const;
void setupGLIndexBuffers() const;
virtual void dumpLOGV(const char *prefix) const;
protected:
ObjectBaseRef<const Type> mType;

View File

@ -819,6 +819,11 @@ void rsi_ContextSetPriority(Context *rsc, int32_t p)
rsc->setPriority(p);
}
void rsi_ContextDump(Context *rsc, int32_t bits)
{
ObjectBase::dumpAll(rsc);
}
}
}

View File

@ -190,3 +190,15 @@ void ObjectBase::zeroAllUserRef(Context *rsc)
}
}
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;
}
}
}

View File

@ -49,6 +49,7 @@ public:
void setContext(Context *);
static void zeroAllUserRef(Context *rsc);
static void dumpAll(Context *rsc);
virtual void dumpLOGV(const char *prefix) const;