am f37b258c: Merge change 27146 into eclair

Merge commit 'f37b258c88e339b482696183def08f5c9437a0ff' into eclair-plus-aosp

* commit 'f37b258c88e339b482696183def08f5c9437a0ff':
  Reduce debugging spew and add props to selectivly re-enable it.
This commit is contained in:
Jason Sams
2009-09-25 15:35:28 -07:00
committed by Android Git Automerger
7 changed files with 51 additions and 35 deletions

View File

@@ -45,7 +45,7 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback
public RSSurfaceView(Context context) {
super(context);
init();
Log.v(RenderScript.LOG_TAG, "RSSurfaceView");
//Log.v(RenderScript.LOG_TAG, "RSSurfaceView");
}
/**
@@ -55,7 +55,7 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback
public RSSurfaceView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
Log.v(RenderScript.LOG_TAG, "RSSurfaceView");
//Log.v(RenderScript.LOG_TAG, "RSSurfaceView");
}
private void init() {
@@ -80,7 +80,7 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback
*/
public void surfaceDestroyed(SurfaceHolder holder) {
// Surface will be destroyed when we return
Log.v(RenderScript.LOG_TAG, "surfaceDestroyed");
//Log.v(RenderScript.LOG_TAG, "surfaceDestroyed");
}
/**
@@ -88,7 +88,7 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback
* not normally called or subclassed by clients of RSSurfaceView.
*/
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
Log.v(RenderScript.LOG_TAG, "surfaceChanged");
//Log.v(RenderScript.LOG_TAG, "surfaceChanged");
}
/**
@@ -101,7 +101,7 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback
if(mRS != null) {
mRS.pause();
}
Log.v(RenderScript.LOG_TAG, "onPause");
//Log.v(RenderScript.LOG_TAG, "onPause");
}
/**
@@ -115,7 +115,7 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback
if(mRS != null) {
mRS.resume();
}
Log.v(RenderScript.LOG_TAG, "onResume");
//Log.v(RenderScript.LOG_TAG, "onResume");
}
/**
@@ -125,7 +125,7 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback
* @param r the runnable to be run on the GL rendering thread.
*/
public void queueEvent(Runnable r) {
Log.v(RenderScript.LOG_TAG, "queueEvent");
//Log.v(RenderScript.LOG_TAG, "queueEvent");
}
/**

View File

@@ -28,8 +28,6 @@
using namespace android;
using namespace android::renderscript;
bool g_logTimes = -1;
pthread_key_t Context::gThreadTLSKey = 0;
void Context::initEGL()
@@ -117,7 +115,7 @@ bool Context::runScript(Script *s, uint32_t launchID)
bool Context::runRootScript()
{
if (this->logTimes) {
if (props.mLogTimes) {
timerSet(RS_TIMER_CLEAR_SWAP);
}
rsAssert(mRootScript->mEnviroment.mIsRoot);
@@ -140,7 +138,7 @@ bool Context::runRootScript()
glClear(GL_COLOR_BUFFER_BIT);
}
if (this->logTimes) {
if (this->props.mLogTimes) {
timerSet(RS_TIMER_SCRIPT);
}
bool ret = runScript(mRootScript.get(), 0);
@@ -208,10 +206,10 @@ void Context::setupCheck()
mVertex->setupGL(this, &mStateVertex);
}
static bool get_log_times()
static bool getProp(const char *str)
{
char buf[PROPERTY_VALUE_MAX];
property_get("debug.rs.profile", buf, "0");
property_get(str, buf, "0");
return 0 != strcmp(buf, "0");
}
@@ -219,7 +217,9 @@ void * Context::threadProc(void *vrsc)
{
Context *rsc = static_cast<Context *>(vrsc);
rsc->logTimes = get_log_times();
rsc->props.mLogTimes = getProp("debug.rs.profile");
rsc->props.mLogScripts = getProp("debug.rs.script");
rsc->props.mLogObjects = getProp("debug.rs.objects");
rsc->initEGL();
@@ -252,11 +252,11 @@ void * Context::threadProc(void *vrsc)
if (mDraw) {
mDraw = rsc->runRootScript() && !rsc->mPaused;
if (rsc->logTimes) {
if (rsc->props.mLogTimes) {
rsc->timerSet(RS_TIMER_CLEAR_SWAP);
}
eglSwapBuffers(rsc->mEGL.mDisplay, rsc->mEGL.mSurface);
if (rsc->logTimes) {
if (rsc->props.mLogTimes) {
rsc->timerFrame();
rsc->timerSet(RS_TIMER_INTERNAL);
rsc->timerPrint();

View File

@@ -143,7 +143,11 @@ public:
bool checkVersion1_1() const {return (mGL.mMajorVersion > 1) || (mGL.mMinorVersion >= 1); }
bool checkVersion2_0() const {return mGL.mMajorVersion >= 2; }
bool logTimes;
struct {
bool mLogTimes;
bool mLogScripts;
bool mLogObjects;
} props;
mutable const ObjectBase * mObjHead;

View File

@@ -65,10 +65,12 @@ void ObjectBase::incSysRef() const
bool ObjectBase::checkDelete() const
{
if (!(mSysRefCount | mUserRefCount)) {
if (mName) {
LOGV("Deleting RS object %p, name %s", this, mName);
} else {
LOGV("Deleting RS object %p, no name", this);
if (mRSC && mRSC->props.mLogObjects) {
if (mName) {
LOGV("Deleting RS object %p, name %s", this, mName);
} else {
LOGV("Deleting RS object %p, no name", this);
}
}
delete this;
return true;
@@ -155,7 +157,9 @@ void ObjectBase::remove() const
void ObjectBase::zeroAllUserRef(Context *rsc)
{
LOGV("Forcing release of all outstanding user refs.");
if (rsc->props.mLogObjects) {
LOGV("Forcing release of all outstanding user refs.");
}
// This operation can be slow, only to be called during context cleanup.
const ObjectBase * o = rsc->mObjHead;

View File

@@ -130,8 +130,8 @@ void ScriptCState::runCompiler(Context *rsc, ScriptC *s)
rsc->appendNameDefines(&tmp);
appendDecls(&tmp);
rsc->appendVarDefines(&tmp);
appendVarDefines(&tmp);
appendTypes(&tmp);
appendVarDefines(rsc, &tmp);
appendTypes(rsc, &tmp);
tmp.append("#line 1\n");
const char* scriptSource[] = {tmp.string(), s->mEnviroment.mScriptText};
@@ -260,11 +260,13 @@ static void appendElementBody(String8 *s, const Element *e)
s->append("}");
}
void ScriptCState::appendVarDefines(String8 *str)
void ScriptCState::appendVarDefines(const Context *rsc, String8 *str)
{
char buf[256];
LOGD("appendVarDefines mInt32Defines.size()=%d mFloatDefines.size()=%d\n",
mInt32Defines.size(), mFloatDefines.size());
if (rsc->props.mLogScripts) {
LOGD("appendVarDefines mInt32Defines.size()=%d mFloatDefines.size()=%d\n",
mInt32Defines.size(), mFloatDefines.size());
}
for (size_t ct=0; ct < mInt32Defines.size(); ct++) {
str->append("#define ");
str->append(mInt32Defines.keyAt(ct));
@@ -283,7 +285,7 @@ void ScriptCState::appendVarDefines(String8 *str)
void ScriptCState::appendTypes(String8 *str)
void ScriptCState::appendTypes(const Context *rsc, String8 *str)
{
char buf[256];
String8 tmp;
@@ -308,7 +310,9 @@ void ScriptCState::appendTypes(String8 *str)
s.append("_t struct struct_");
s.append(e->getName());
s.append("\n\n");
LOGD(s);
if (rsc->props.mLogScripts) {
LOGV(s);
}
str->append(s);
}
@@ -321,7 +325,9 @@ void ScriptCState::appendTypes(String8 *str)
tmp.append(c->getComponentName());
sprintf(buf, " %i\n", ct2);
tmp.append(buf);
LOGD(tmp);
if (rsc->props.mLogScripts) {
LOGV(tmp);
}
str->append(tmp);
}
}
@@ -351,7 +357,9 @@ void ScriptCState::appendTypes(String8 *str)
}
s.append(mSlotNames[ct]);
s.append(";\n");
LOGD(s);
if (rsc->props.mLogScripts) {
LOGV(s);
}
str->append(s);
}
}

View File

@@ -77,8 +77,8 @@ public:
void clear();
void runCompiler(Context *rsc, ScriptC *s);
void appendVarDefines(String8 *str);
void appendTypes(String8 *str);
void appendVarDefines(const Context *rsc, String8 *str);
void appendTypes(const Context *rsc, String8 *str);
struct SymbolTable_t {
const char * mName;

View File

@@ -42,7 +42,7 @@ bool ThreadIO::playCoreCommands(Context *con, bool waitForCommand)
uint32_t cmdID = 0;
uint32_t cmdSize = 0;
ret = true;
if (con->logTimes) {
if (con->props.mLogTimes) {
con->timerSet(Context::RS_TIMER_IDLE);
}
const void * data = mToCore.get(&cmdID, &cmdSize);
@@ -50,7 +50,7 @@ bool ThreadIO::playCoreCommands(Context *con, bool waitForCommand)
// exception occured, probably shutdown.
return false;
}
if (con->logTimes) {
if (con->props.mLogTimes) {
con->timerSet(Context::RS_TIMER_INTERNAL);
}
waitForCommand = false;