am a3007127: Merge change 26728 into eclair
Merge commit 'a30071273a8ee59b300eebe515db86f9070ab4a4' into eclair-plus-aosp * commit 'a30071273a8ee59b300eebe515db86f9070ab4a4': Make the renderscript timing logging available by setting debug.rs.profile=1
This commit is contained in:
@@ -20,12 +20,16 @@
|
|||||||
#include <ui/FramebufferNativeWindow.h>
|
#include <ui/FramebufferNativeWindow.h>
|
||||||
#include <ui/EGLUtils.h>
|
#include <ui/EGLUtils.h>
|
||||||
|
|
||||||
|
#include <cutils/properties.h>
|
||||||
|
|
||||||
#include <GLES/gl.h>
|
#include <GLES/gl.h>
|
||||||
#include <GLES/glext.h>
|
#include <GLES/glext.h>
|
||||||
|
|
||||||
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()
|
||||||
@@ -113,9 +117,9 @@ bool Context::runScript(Script *s, uint32_t launchID)
|
|||||||
|
|
||||||
bool Context::runRootScript()
|
bool Context::runRootScript()
|
||||||
{
|
{
|
||||||
#if RS_LOG_TIMES
|
if (this->logTimes) {
|
||||||
timerSet(RS_TIMER_CLEAR_SWAP);
|
timerSet(RS_TIMER_CLEAR_SWAP);
|
||||||
#endif
|
}
|
||||||
rsAssert(mRootScript->mEnviroment.mIsRoot);
|
rsAssert(mRootScript->mEnviroment.mIsRoot);
|
||||||
|
|
||||||
eglQuerySurface(mEGL.mDisplay, mEGL.mSurface, EGL_WIDTH, &mEGL.mWidth);
|
eglQuerySurface(mEGL.mDisplay, mEGL.mSurface, EGL_WIDTH, &mEGL.mWidth);
|
||||||
@@ -136,9 +140,9 @@ bool Context::runRootScript()
|
|||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if RS_LOG_TIMES
|
if (this->logTimes) {
|
||||||
timerSet(RS_TIMER_SCRIPT);
|
timerSet(RS_TIMER_SCRIPT);
|
||||||
#endif
|
}
|
||||||
bool ret = runScript(mRootScript.get(), 0);
|
bool ret = runScript(mRootScript.get(), 0);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -204,11 +208,19 @@ void Context::setupCheck()
|
|||||||
mVertex->setupGL(this, &mStateVertex);
|
mVertex->setupGL(this, &mStateVertex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool get_log_times()
|
||||||
|
{
|
||||||
|
char buf[PROPERTY_VALUE_MAX];
|
||||||
|
property_get("debug.rs.profile", buf, "0");
|
||||||
|
return 0 != strcmp(buf, "0");
|
||||||
|
}
|
||||||
|
|
||||||
void * Context::threadProc(void *vrsc)
|
void * Context::threadProc(void *vrsc)
|
||||||
{
|
{
|
||||||
Context *rsc = static_cast<Context *>(vrsc);
|
Context *rsc = static_cast<Context *>(vrsc);
|
||||||
|
|
||||||
|
rsc->logTimes = get_log_times();
|
||||||
|
|
||||||
rsc->initEGL();
|
rsc->initEGL();
|
||||||
|
|
||||||
ScriptTLSStruct *tlsStruct = new ScriptTLSStruct;
|
ScriptTLSStruct *tlsStruct = new ScriptTLSStruct;
|
||||||
@@ -240,16 +252,16 @@ void * Context::threadProc(void *vrsc)
|
|||||||
|
|
||||||
if (mDraw) {
|
if (mDraw) {
|
||||||
mDraw = rsc->runRootScript();
|
mDraw = rsc->runRootScript();
|
||||||
#if RS_LOG_TIMES
|
if (rsc->logTimes) {
|
||||||
rsc->timerSet(RS_TIMER_CLEAR_SWAP);
|
rsc->timerSet(RS_TIMER_CLEAR_SWAP);
|
||||||
#endif
|
}
|
||||||
eglSwapBuffers(rsc->mEGL.mDisplay, rsc->mEGL.mSurface);
|
eglSwapBuffers(rsc->mEGL.mDisplay, rsc->mEGL.mSurface);
|
||||||
#if RS_LOG_TIMES
|
if (rsc->logTimes) {
|
||||||
rsc->timerFrame();
|
rsc->timerFrame();
|
||||||
rsc->timerSet(RS_TIMER_INTERNAL);
|
rsc->timerSet(RS_TIMER_INTERNAL);
|
||||||
rsc->timerPrint();
|
rsc->timerPrint();
|
||||||
rsc->timerReset();
|
rsc->timerReset();
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
if (rsc->mObjDestroy.mNeedToEmpty) {
|
if (rsc->mObjDestroy.mNeedToEmpty) {
|
||||||
rsc->objDestroyOOBRun();
|
rsc->objDestroyOOBRun();
|
||||||
|
|||||||
@@ -143,6 +143,8 @@ 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;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Device *mDev;
|
Device *mDev;
|
||||||
|
|
||||||
@@ -215,7 +217,6 @@ private:
|
|||||||
uint64_t mTimeLastFrame;
|
uint64_t mTimeLastFrame;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -42,13 +42,13 @@ bool ThreadIO::playCoreCommands(Context *con, bool waitForCommand)
|
|||||||
uint32_t cmdID = 0;
|
uint32_t cmdID = 0;
|
||||||
uint32_t cmdSize = 0;
|
uint32_t cmdSize = 0;
|
||||||
ret = true;
|
ret = true;
|
||||||
#if RS_LOG_TIMES
|
if (con->logTimes) {
|
||||||
con->timerSet(Context::RS_TIMER_IDLE);
|
con->timerSet(Context::RS_TIMER_IDLE);
|
||||||
#endif
|
}
|
||||||
const void * data = mToCore.get(&cmdID, &cmdSize);
|
const void * data = mToCore.get(&cmdID, &cmdSize);
|
||||||
#if RS_LOG_TIMES
|
if (con->logTimes) {
|
||||||
con->timerSet(Context::RS_TIMER_INTERNAL);
|
con->timerSet(Context::RS_TIMER_INTERNAL);
|
||||||
#endif
|
}
|
||||||
waitForCommand = false;
|
waitForCommand = false;
|
||||||
//LOGV("playCoreCommands 3 %i %i", cmdID, cmdSize);
|
//LOGV("playCoreCommands 3 %i %i", cmdID, cmdSize);
|
||||||
|
|
||||||
|
|||||||
@@ -41,8 +41,6 @@ namespace renderscript {
|
|||||||
#define rsAssert(v) while(0)
|
#define rsAssert(v) while(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define RS_LOG_TIMES 0
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T rsMin(T in1, T in2)
|
T rsMin(T in1, T in2)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user