diff options
author | Jason Sams <jsams@google.com> | 2012-01-12 14:22:21 -0800 |
---|---|---|
committer | Jason Sams <jsams@google.com> | 2012-01-12 14:22:21 -0800 |
commit | 17801f1eaafae66d63f862b8e89ee53310ce9972 (patch) | |
tree | 2ff42f914cf67d823a3c6bcd0a33f5c6680036f3 /libs/rs | |
parent | 0ce62e0ae173ad59078df1b47cf63d593f5b2454 (diff) | |
download | frameworks_base-17801f1eaafae66d63f862b8e89ee53310ce9972.zip frameworks_base-17801f1eaafae66d63f862b8e89ee53310ce9972.tar.gz frameworks_base-17801f1eaafae66d63f862b8e89ee53310ce9972.tar.bz2 |
Plumbing for RS priority.
Change-Id: Ibddfd40407fd6d24ac829a76a9a1e2047c48c5fd
Diffstat (limited to 'libs/rs')
-rw-r--r-- | libs/rs/driver/rsdCore.cpp | 3 | ||||
-rw-r--r-- | libs/rs/driver/rsdCore.h | 1 | ||||
-rw-r--r-- | libs/rs/driver/rsdGL.cpp | 10 | ||||
-rw-r--r-- | libs/rs/driver/rsdGL.h | 2 | ||||
-rw-r--r-- | libs/rs/rsContext.cpp | 1 |
5 files changed, 17 insertions, 0 deletions
diff --git a/libs/rs/driver/rsdCore.cpp b/libs/rs/driver/rsdCore.cpp index b934895..9b79900 100644 --- a/libs/rs/driver/rsdCore.cpp +++ b/libs/rs/driver/rsdCore.cpp @@ -270,6 +270,9 @@ void SetPriority(const Context *rsc, int32_t priority) { for (uint32_t ct=0; ct < dc->mWorkers.mCount; ct++) { setpriority(PRIO_PROCESS, dc->mWorkers.mNativeThreadId[ct], priority); } + if (dc->mHasGraphics) { + rsdGLSetPriority(rsc, priority); + } } void Shutdown(Context *rsc) { diff --git a/libs/rs/driver/rsdCore.h b/libs/rs/driver/rsdCore.h index ce86d11..3698fab 100644 --- a/libs/rs/driver/rsdCore.h +++ b/libs/rs/driver/rsdCore.h @@ -46,6 +46,7 @@ typedef struct ScriptTLSStructRec { typedef struct RsdHalRec { uint32_t version_major; uint32_t version_minor; + bool mHasGraphics; struct Workers { volatile int mRunningCount; diff --git a/libs/rs/driver/rsdGL.cpp b/libs/rs/driver/rsdGL.cpp index b53a68c..80abb0e 100644 --- a/libs/rs/driver/rsdGL.cpp +++ b/libs/rs/driver/rsdGL.cpp @@ -359,6 +359,7 @@ bool rsdGLInit(const Context *rsc) { dc->gl.vertexArrayState = new RsdVertexArrayState(); dc->gl.vertexArrayState->init(dc->gl.gl.maxVertexAttribs); dc->gl.currentFrameBuffer = NULL; + dc->mHasGraphics = true; ALOGV("%p initGLThread end", rsc); rsc->setWatchdogGL(NULL, 0, NULL); @@ -419,6 +420,15 @@ void rsdGLSwap(const android::renderscript::Context *rsc) { RSD_CALL_GL(eglSwapBuffers, dc->gl.egl.display, dc->gl.egl.surface); } +void rsdGLSetPriority(const Context *rsc, int32_t priority) { + if (priority > 0) { + // Mark context as low priority. + ALOGV("low pri"); + } else { + ALOGV("normal pri"); + } +} + void rsdGLCheckError(const android::renderscript::Context *rsc, const char *msg, bool isFatal) { GLenum err = glGetError(); diff --git a/libs/rs/driver/rsdGL.h b/libs/rs/driver/rsdGL.h index fc33885..988a5df 100644 --- a/libs/rs/driver/rsdGL.h +++ b/libs/rs/driver/rsdGL.h @@ -82,6 +82,8 @@ bool rsdGLSetSurface(const android::renderscript::Context *rsc, void rsdGLSwap(const android::renderscript::Context *rsc); void rsdGLCheckError(const android::renderscript::Context *rsc, const char *msg, bool isFatal = false); +void rsdGLSetPriority(const android::renderscript::Context *rsc, + int32_t priority); #endif diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp index ad2ff0f..62b3c5c 100644 --- a/libs/rs/rsContext.cpp +++ b/libs/rs/rsContext.cpp @@ -347,6 +347,7 @@ void Context::setPriority(int32_t p) { #else setpriority(PRIO_PROCESS, mNativeThreadId, p); #endif + mHal.funcs.setPriority(this, mThreadPriority); } Context::Context() { |