diff options
author | Jason Sams <jsams@google.com> | 2012-03-15 19:18:03 -0700 |
---|---|---|
committer | Jason Sams <jsams@google.com> | 2012-03-15 19:18:03 -0700 |
commit | 2791429451d799d754a785e18e7bfb6befd05ba5 (patch) | |
tree | 746d9873b2d545f00b815fa4319a2c5a169a35ce /libs/rs | |
parent | d1c8c1292c4273442c052d0899f3375913a51fc5 (diff) | |
download | frameworks_base-2791429451d799d754a785e18e7bfb6befd05ba5.zip frameworks_base-2791429451d799d754a785e18e7bfb6befd05ba5.tar.gz frameworks_base-2791429451d799d754a785e18e7bfb6befd05ba5.tar.bz2 |
Add prop to force cap compute threading.
bug=6124869
Change-Id: Ibf2cc388f3906cea2741382ff5e522e3b416393c
Diffstat (limited to 'libs/rs')
-rw-r--r-- | libs/rs/driver/rsdCore.cpp | 7 | ||||
-rw-r--r-- | libs/rs/rsContext.cpp | 19 | ||||
-rw-r--r-- | libs/rs/rsContext.h | 1 |
3 files changed, 17 insertions, 10 deletions
diff --git a/libs/rs/driver/rsdCore.cpp b/libs/rs/driver/rsdCore.cpp index 403393f..35a5c08 100644 --- a/libs/rs/driver/rsdCore.cpp +++ b/libs/rs/driver/rsdCore.cpp @@ -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)); diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp index 1b51872..5e21763 100644 --- a/libs/rs/rsContext.cpp +++ b/libs/rs/rsContext.cpp @@ -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"); diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h index 0f44267..de110c6 100644 --- a/libs/rs/rsContext.h +++ b/libs/rs/rsContext.h @@ -184,6 +184,7 @@ public: bool mLogShadersAttr; bool mLogShadersUniforms; bool mLogVisual; + uint32_t mDebugMaxThreads; } props; mutable struct { |