Plumbing for RS priority.
Change-Id: Ibddfd40407fd6d24ac829a76a9a1e2047c48c5fd
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -347,6 +347,7 @@ void Context::setPriority(int32_t p) {
|
||||
#else
|
||||
setpriority(PRIO_PROCESS, mNativeThreadId, p);
|
||||
#endif
|
||||
mHal.funcs.setPriority(this, mThreadPriority);
|
||||
}
|
||||
|
||||
Context::Context() {
|
||||
|
||||
Reference in New Issue
Block a user