Add prop to force cap compute threading.

bug=6124869

Change-Id: Ibf2cc388f3906cea2741382ff5e522e3b416393c
This commit is contained in:
Jason Sams
2012-03-15 19:18:03 -07:00
parent d1c8c1292c
commit 2791429451
3 changed files with 17 additions and 10 deletions

View File

@@ -228,7 +228,12 @@ bool rsdHalInit(Context *rsc, uint32_t version_major, uint32_t version_minor) {
int cpu = sysconf(_SC_NPROCESSORS_ONLN);
ALOGV("%p Launching thread(s), CPUs %i", rsc, cpu);
if (cpu < 2) cpu = 0;
if(rsc->props.mDebugMaxThreads && (cpu > (int)rsc->props.mDebugMaxThreads)) {
cpu = rsc->props.mDebugMaxThreads;
}
if (cpu < 2) {
cpu = 0;
}
dc->mWorkers.mCount = (uint32_t)cpu;
dc->mWorkers.mThreadId = (pthread_t *) calloc(dc->mWorkers.mCount, sizeof(pthread_t));

View File

@@ -178,10 +178,10 @@ void Context::setupProgramStore() {
mFragmentStore->setup(this, &mStateFragmentStore);
}
static bool getProp(const char *str) {
static uint32_t getProp(const char *str) {
char buf[PROPERTY_VALUE_MAX];
property_get(str, buf, "0");
return 0 != strcmp(buf, "0");
return atoi(buf);
}
void Context::displayDebugStats() {
@@ -211,13 +211,14 @@ void * Context::threadProc(void *vrsc) {
setpriority(PRIO_PROCESS, rsc->mNativeThreadId, ANDROID_PRIORITY_DISPLAY);
rsc->mThreadPriority = ANDROID_PRIORITY_DISPLAY;
#endif //ANDROID_RS_SERIALIZE
rsc->props.mLogTimes = getProp("debug.rs.profile");
rsc->props.mLogScripts = getProp("debug.rs.script");
rsc->props.mLogObjects = getProp("debug.rs.object");
rsc->props.mLogShaders = getProp("debug.rs.shader");
rsc->props.mLogShadersAttr = getProp("debug.rs.shader.attributes");
rsc->props.mLogShadersUniforms = getProp("debug.rs.shader.uniforms");
rsc->props.mLogVisual = getProp("debug.rs.visual");
rsc->props.mLogTimes = getProp("debug.rs.profile") != 0;
rsc->props.mLogScripts = getProp("debug.rs.script") != 0;
rsc->props.mLogObjects = getProp("debug.rs.object") != 0;
rsc->props.mLogShaders = getProp("debug.rs.shader") != 0;
rsc->props.mLogShadersAttr = getProp("debug.rs.shader.attributes") != 0;
rsc->props.mLogShadersUniforms = getProp("debug.rs.shader.uniforms") != 0;
rsc->props.mLogVisual = getProp("debug.rs.visual") != 0;
rsc->props.mDebugMaxThreads = getProp("debug.rs.max-threads");
if (!rsdHalInit(rsc, 0, 0)) {
rsc->setError(RS_ERROR_FATAL_DRIVER, "Failed initializing GL");

View File

@@ -184,6 +184,7 @@ public:
bool mLogShadersAttr;
bool mLogShadersUniforms;
bool mLogVisual;
uint32_t mDebugMaxThreads;
} props;
mutable struct {