Reduce debugging spew and add props to selectivly re-enable it.
change-id: Ib59ed5d7a9d479ccd1af456029735dbc65ae1efe
diff --git a/graphics/java/android/renderscript/RSSurfaceView.java b/graphics/java/android/renderscript/RSSurfaceView.java
index 63994ab..53466cc 100644
--- a/graphics/java/android/renderscript/RSSurfaceView.java
+++ b/graphics/java/android/renderscript/RSSurfaceView.java
@@ -45,7 +45,7 @@
public RSSurfaceView(Context context) {
super(context);
init();
- Log.v(RenderScript.LOG_TAG, "RSSurfaceView");
+ //Log.v(RenderScript.LOG_TAG, "RSSurfaceView");
}
/**
@@ -55,7 +55,7 @@
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 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 @@
* 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 @@
if(mRS != null) {
mRS.pause();
}
- Log.v(RenderScript.LOG_TAG, "onPause");
+ //Log.v(RenderScript.LOG_TAG, "onPause");
}
/**
@@ -115,7 +115,7 @@
if(mRS != null) {
mRS.resume();
}
- Log.v(RenderScript.LOG_TAG, "onResume");
+ //Log.v(RenderScript.LOG_TAG, "onResume");
}
/**
@@ -125,7 +125,7 @@
* @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");
}
/**
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index 6c18ddb..653d427 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -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::runRootScript()
{
- if (this->logTimes) {
+ if (props.mLogTimes) {
timerSet(RS_TIMER_CLEAR_SWAP);
}
rsAssert(mRootScript->mEnviroment.mIsRoot);
@@ -140,7 +138,7 @@
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 @@
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 @@
{
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 @@
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();
diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h
index 28a9de2..cef421d 100644
--- a/libs/rs/rsContext.h
+++ b/libs/rs/rsContext.h
@@ -143,7 +143,11 @@
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;
diff --git a/libs/rs/rsObjectBase.cpp b/libs/rs/rsObjectBase.cpp
index acfc5ce..83fa482 100644
--- a/libs/rs/rsObjectBase.cpp
+++ b/libs/rs/rsObjectBase.cpp
@@ -65,10 +65,12 @@
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::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;
diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp
index fc2744f..fb8180f 100644
--- a/libs/rs/rsScriptC.cpp
+++ b/libs/rs/rsScriptC.cpp
@@ -130,8 +130,8 @@
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 @@
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::appendTypes(String8 *str)
+void ScriptCState::appendTypes(const Context *rsc, String8 *str)
{
char buf[256];
String8 tmp;
@@ -308,7 +310,9 @@
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 @@
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 @@
}
s.append(mSlotNames[ct]);
s.append(";\n");
- LOGD(s);
+ if (rsc->props.mLogScripts) {
+ LOGV(s);
+ }
str->append(s);
}
}
diff --git a/libs/rs/rsScriptC.h b/libs/rs/rsScriptC.h
index 96161d8..ae124b4 100644
--- a/libs/rs/rsScriptC.h
+++ b/libs/rs/rsScriptC.h
@@ -77,8 +77,8 @@
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;
diff --git a/libs/rs/rsThreadIO.cpp b/libs/rs/rsThreadIO.cpp
index 964901a..4d3d73a 100644
--- a/libs/rs/rsThreadIO.cpp
+++ b/libs/rs/rsThreadIO.cpp
@@ -42,7 +42,7 @@
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 @@
// exception occured, probably shutdown.
return false;
}
- if (con->logTimes) {
+ if (con->props.mLogTimes) {
con->timerSet(Context::RS_TIMER_INTERNAL);
}
waitForCommand = false;