am f56f317f: am fa0394c9: Merge change I715333b8 into eclair

Merge commit 'f56f317fb941c354c3a10e9fbf36d194656fa7d4' into eclair-mr2-plus-aosp

* commit 'f56f317fb941c354c3a10e9fbf36d194656fa7d4':
  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:41:02 -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 nContextDestroy(int con);
native void nContextSetSurface(int w, int h, Surface sur); native void nContextSetSurface(int w, int h, Surface sur);
native void nContextSetPriority(int p); native void nContextSetPriority(int p);
native void nContextDump(int bits);
native void nContextBindRootScript(int script); native void nContextBindRootScript(int script);
native void nContextBindSampler(int sampler, int slot); native void nContextBindSampler(int sampler, int slot);
@ -304,6 +305,10 @@ public class RenderScript {
nContextSetSurface(w, h, mSurface); nContextSetSurface(w, h, mSurface);
} }
public void contextDump(int bits) {
nContextDump(bits);
}
public void destroy() { public void destroy() {
nContextDeinitToClient(); nContextDeinitToClient();
mMessageThread.mRun = false; mMessageThread.mRun = false;

View File

@ -189,9 +189,16 @@ static void
nContextDestroy(JNIEnv *_env, jobject _this, jint con) nContextDestroy(JNIEnv *_env, jobject _this, jint con)
{ {
LOG_API("nContextDestroy, con(%p)", (RsContext)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 static void
nContextPause(JNIEnv *_env, jobject _this) nContextPause(JNIEnv *_env, jobject _this)
@ -1346,6 +1353,7 @@ static JNINativeMethod methods[] = {
{"nContextSetPriority", "(I)V", (void*)nContextSetPriority }, {"nContextSetPriority", "(I)V", (void*)nContextSetPriority },
{"nContextSetSurface", "(IILandroid/view/Surface;)V", (void*)nContextSetSurface }, {"nContextSetSurface", "(IILandroid/view/Surface;)V", (void*)nContextSetSurface },
{"nContextDestroy", "(I)V", (void*)nContextDestroy }, {"nContextDestroy", "(I)V", (void*)nContextDestroy },
{"nContextDump", "(I)V", (void*)nContextDump },
{"nContextPause", "()V", (void*)nContextPause }, {"nContextPause", "()V", (void*)nContextPause },
{"nContextResume", "()V", (void*)nContextResume }, {"nContextResume", "()V", (void*)nContextResume },
{"nAssignName", "(I[B)V", (void*)nAssignName }, {"nAssignName", "(I[B)V", (void*)nAssignName },

View File

@ -42,6 +42,10 @@ ContextSetSurface {
param void *sur param void *sur
} }
ContextDump {
param int32_t bits
}
ContextSetPriority { ContextSetPriority {
param int32_t priority 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 enableGLVertexBuffers() const;
void setupGLIndexBuffers() const; void setupGLIndexBuffers() const;
virtual void dumpLOGV(const char *prefix) const;
protected: protected:
ObjectBaseRef<const Type> mType; ObjectBaseRef<const Type> mType;

View File

@ -819,6 +819,11 @@ void rsi_ContextSetPriority(Context *rsc, int32_t p)
rsc->setPriority(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 *); void setContext(Context *);
static void zeroAllUserRef(Context *rsc); static void zeroAllUserRef(Context *rsc);
static void dumpAll(Context *rsc);
virtual void dumpLOGV(const char *prefix) const; virtual void dumpLOGV(const char *prefix) const;