Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f37b258c authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 27146 into eclair

* changes:
  Reduce debugging spew and add props to selectivly re-enable it.
parents ba14fff7 66b2771d
Loading
Loading
Loading
Loading
+7 −7
Original line number Original line Diff line number Diff line
@@ -45,7 +45,7 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback
    public RSSurfaceView(Context context) {
    public RSSurfaceView(Context context) {
        super(context);
        super(context);
        init();
        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) {
    public RSSurfaceView(Context context, AttributeSet attrs) {
        super(context, attrs);
        super(context, attrs);
        init();
        init();
        Log.v(RenderScript.LOG_TAG, "RSSurfaceView");
        //Log.v(RenderScript.LOG_TAG, "RSSurfaceView");
    }
    }


    private void init() {
    private void init() {
@@ -80,7 +80,7 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback
     */
     */
    public void surfaceDestroyed(SurfaceHolder holder) {
    public void surfaceDestroyed(SurfaceHolder holder) {
        // Surface will be destroyed when we return
        // 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.
     * not normally called or subclassed by clients of RSSurfaceView.
     */
     */
    public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
    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) {
        if(mRS != null) {
            mRS.pause();
            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) {
        if(mRS != null) {
            mRS.resume();
            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.
     * @param r the runnable to be run on the GL rendering thread.
     */
     */
    public void queueEvent(Runnable r) {
    public void queueEvent(Runnable r) {
        Log.v(RenderScript.LOG_TAG, "queueEvent");
        //Log.v(RenderScript.LOG_TAG, "queueEvent");
    }
    }


    /**
    /**
+9 −9
Original line number Original line Diff line number Diff line
@@ -28,8 +28,6 @@
using namespace android;
using namespace android;
using namespace android::renderscript;
using namespace android::renderscript;


bool g_logTimes = -1;

pthread_key_t Context::gThreadTLSKey = 0;
pthread_key_t Context::gThreadTLSKey = 0;


void Context::initEGL()
void Context::initEGL()
@@ -117,7 +115,7 @@ bool Context::runScript(Script *s, uint32_t launchID)


bool Context::runRootScript()
bool Context::runRootScript()
{
{
    if (this->logTimes) {
    if (props.mLogTimes) {
        timerSet(RS_TIMER_CLEAR_SWAP);
        timerSet(RS_TIMER_CLEAR_SWAP);
    }
    }
    rsAssert(mRootScript->mEnviroment.mIsRoot);
    rsAssert(mRootScript->mEnviroment.mIsRoot);
@@ -140,7 +138,7 @@ bool Context::runRootScript()
        glClear(GL_COLOR_BUFFER_BIT);
        glClear(GL_COLOR_BUFFER_BIT);
    }
    }


    if (this->logTimes) {
    if (this->props.mLogTimes) {
        timerSet(RS_TIMER_SCRIPT);
        timerSet(RS_TIMER_SCRIPT);
    }
    }
    bool ret = runScript(mRootScript.get(), 0);
    bool ret = runScript(mRootScript.get(), 0);
@@ -208,10 +206,10 @@ void Context::setupCheck()
    mVertex->setupGL(this, &mStateVertex);
    mVertex->setupGL(this, &mStateVertex);
}
}


static bool get_log_times()
static bool getProp(const char *str)
{
{
    char buf[PROPERTY_VALUE_MAX];
    char buf[PROPERTY_VALUE_MAX];
    property_get("debug.rs.profile", buf, "0");
    property_get(str, buf, "0");
    return 0 != strcmp(buf, "0");
    return 0 != strcmp(buf, "0");
}
}


@@ -219,7 +217,9 @@ void * Context::threadProc(void *vrsc)
{
{
     Context *rsc = static_cast<Context *>(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();
     rsc->initEGL();


@@ -252,11 +252,11 @@ void * Context::threadProc(void *vrsc)


         if (mDraw) {
         if (mDraw) {
             mDraw = rsc->runRootScript() && !rsc->mPaused;
             mDraw = rsc->runRootScript() && !rsc->mPaused;
             if (rsc->logTimes) {
             if (rsc->props.mLogTimes) {
                 rsc->timerSet(RS_TIMER_CLEAR_SWAP);
                 rsc->timerSet(RS_TIMER_CLEAR_SWAP);
             }
             }
             eglSwapBuffers(rsc->mEGL.mDisplay, rsc->mEGL.mSurface);
             eglSwapBuffers(rsc->mEGL.mDisplay, rsc->mEGL.mSurface);
             if (rsc->logTimes) {
             if (rsc->props.mLogTimes) {
                 rsc->timerFrame();
                 rsc->timerFrame();
                 rsc->timerSet(RS_TIMER_INTERNAL);
                 rsc->timerSet(RS_TIMER_INTERNAL);
                 rsc->timerPrint();
                 rsc->timerPrint();
+5 −1
Original line number Original line Diff line number Diff line
@@ -143,7 +143,11 @@ public:
    bool checkVersion1_1() const {return (mGL.mMajorVersion > 1) || (mGL.mMinorVersion >= 1); }
    bool checkVersion1_1() const {return (mGL.mMajorVersion > 1) || (mGL.mMinorVersion >= 1); }
    bool checkVersion2_0() const {return mGL.mMajorVersion >= 2; }
    bool checkVersion2_0() const {return mGL.mMajorVersion >= 2; }


    bool logTimes;
    struct {
        bool mLogTimes;
        bool mLogScripts;
        bool mLogObjects;
    } props;


    mutable const ObjectBase * mObjHead;
    mutable const ObjectBase * mObjHead;


+9 −5
Original line number Original line Diff line number Diff line
@@ -65,11 +65,13 @@ void ObjectBase::incSysRef() const
bool ObjectBase::checkDelete() const
bool ObjectBase::checkDelete() const
{
{
    if (!(mSysRefCount | mUserRefCount)) {
    if (!(mSysRefCount | mUserRefCount)) {
        if (mRSC && mRSC->props.mLogObjects) {
            if (mName) {
            if (mName) {
                LOGV("Deleting RS object %p, name %s", this, mName);
                LOGV("Deleting RS object %p, name %s", this, mName);
            } else {
            } else {
                LOGV("Deleting RS object %p, no name", this);
                LOGV("Deleting RS object %p, no name", this);
            }
            }
        }
        delete this;
        delete this;
        return true;
        return true;
    }
    }
@@ -155,7 +157,9 @@ void ObjectBase::remove() const


void ObjectBase::zeroAllUserRef(Context *rsc)
void ObjectBase::zeroAllUserRef(Context *rsc)
{
{
    if (rsc->props.mLogObjects) {
        LOGV("Forcing release of all outstanding user refs.");
        LOGV("Forcing release of all outstanding user refs.");
    }


    // This operation can be slow, only to be called during context cleanup.
    // This operation can be slow, only to be called during context cleanup.
    const ObjectBase * o = rsc->mObjHead;
    const ObjectBase * o = rsc->mObjHead;
+17 −9
Original line number Original line Diff line number Diff line
@@ -130,8 +130,8 @@ void ScriptCState::runCompiler(Context *rsc, ScriptC *s)
    rsc->appendNameDefines(&tmp);
    rsc->appendNameDefines(&tmp);
    appendDecls(&tmp);
    appendDecls(&tmp);
    rsc->appendVarDefines(&tmp);
    rsc->appendVarDefines(&tmp);
    appendVarDefines(&tmp);
    appendVarDefines(rsc, &tmp);
    appendTypes(&tmp);
    appendTypes(rsc, &tmp);
    tmp.append("#line 1\n");
    tmp.append("#line 1\n");


    const char* scriptSource[] = {tmp.string(), s->mEnviroment.mScriptText};
    const char* scriptSource[] = {tmp.string(), s->mEnviroment.mScriptText};
@@ -260,11 +260,13 @@ static void appendElementBody(String8 *s, const Element *e)
    s->append("}");
    s->append("}");
}
}


void ScriptCState::appendVarDefines(String8 *str)
void ScriptCState::appendVarDefines(const Context *rsc, String8 *str)
{
{
    char buf[256];
    char buf[256];
    if (rsc->props.mLogScripts) {
        LOGD("appendVarDefines mInt32Defines.size()=%d mFloatDefines.size()=%d\n",
        LOGD("appendVarDefines mInt32Defines.size()=%d mFloatDefines.size()=%d\n",
                mInt32Defines.size(), mFloatDefines.size());
                mInt32Defines.size(), mFloatDefines.size());
    }
    for (size_t ct=0; ct < mInt32Defines.size(); ct++) {
    for (size_t ct=0; ct < mInt32Defines.size(); ct++) {
        str->append("#define ");
        str->append("#define ");
        str->append(mInt32Defines.keyAt(ct));
        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];
    char buf[256];
    String8 tmp;
    String8 tmp;
@@ -308,7 +310,9 @@ void ScriptCState::appendTypes(String8 *str)
            s.append("_t struct struct_");
            s.append("_t struct struct_");
            s.append(e->getName());
            s.append(e->getName());
            s.append("\n\n");
            s.append("\n\n");
            LOGD(s);
            if (rsc->props.mLogScripts) {
                LOGV(s);
            }
            str->append(s);
            str->append(s);
        }
        }


@@ -321,7 +325,9 @@ void ScriptCState::appendTypes(String8 *str)
                tmp.append(c->getComponentName());
                tmp.append(c->getComponentName());
                sprintf(buf, " %i\n", ct2);
                sprintf(buf, " %i\n", ct2);
                tmp.append(buf);
                tmp.append(buf);
                LOGD(tmp);
                if (rsc->props.mLogScripts) {
                    LOGV(tmp);
                }
                str->append(tmp);
                str->append(tmp);
            }
            }
        }
        }
@@ -351,7 +357,9 @@ void ScriptCState::appendTypes(String8 *str)
            }
            }
            s.append(mSlotNames[ct]);
            s.append(mSlotNames[ct]);
            s.append(";\n");
            s.append(";\n");
            LOGD(s);
            if (rsc->props.mLogScripts) {
                LOGV(s);
            }
            str->append(s);
            str->append(s);
        }
        }
    }
    }
Loading