summaryrefslogtreecommitdiff
path: root/libs/rs
diff options
context:
space:
mode:
author Android (Google) Code Review <android-gerrit@google.com> 2009-09-24 20:50:39 -0400
committer Android (Google) Code Review <android-gerrit@google.com> 2009-09-24 20:50:39 -0400
commitcc89ef3d6e9b1f9be657c9158ad04b8de104434c (patch)
tree45c82f24c81723288c6168ad837f121fc5663573 /libs/rs
parent0665ae22aa51183d6ff5fdd0abeee0344306e89d (diff)
parent65e7aa56f56097418d617663683544c25b3988ea (diff)
Merge change 26971 into eclair
* changes: Implement pause/resume for the RS thread.
Diffstat (limited to 'libs/rs')
-rw-r--r--libs/rs/rs.spec6
-rw-r--r--libs/rs/rsContext.cpp24
-rw-r--r--libs/rs/rsContext.h4
3 files changed, 33 insertions, 1 deletions
diff --git a/libs/rs/rs.spec b/libs/rs/rs.spec
index 8cdf2b7549a8..a393e2f22c5a 100644
--- a/libs/rs/rs.spec
+++ b/libs/rs/rs.spec
@@ -30,6 +30,12 @@ ContextSetDefineI32 {
param int32_t value
}
+ContextPause {
+ }
+
+ContextResume {
+ }
+
AssignName {
param void *obj
param const char *name
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index e3236c4b921d..2fe762c3df30 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -251,7 +251,7 @@ void * Context::threadProc(void *vrsc)
mDraw &= (rsc->mRootScript.get() != NULL);
if (mDraw) {
- mDraw = rsc->runRootScript();
+ mDraw = rsc->runRootScript() && !rsc->mPaused;
if (rsc->logTimes) {
rsc->timerSet(RS_TIMER_CLEAR_SWAP);
}
@@ -285,6 +285,7 @@ Context::Context(Device *dev, Surface *sur, bool useDepth)
mRunning = false;
mExit = false;
mUseDepth = useDepth;
+ mPaused = false;
int status;
pthread_attr_t threadAttr;
@@ -328,6 +329,7 @@ Context::~Context()
{
LOGV("Context::~Context");
mExit = true;
+ mPaused = false;
void *res;
mIO.shutdown();
@@ -342,6 +344,16 @@ Context::~Context()
objDestroyOOBDestroy();
}
+void Context::pause()
+{
+ mPaused = true;
+}
+
+void Context::resume()
+{
+ mPaused = false;
+}
+
void Context::setRootScript(Script *s)
{
mRootScript.set(s);
@@ -578,6 +590,16 @@ void rsi_ContextSetDefineI32(Context *rsc, const char* name, int32_t value)
rsc->addFloatDefine(name, value);
}
+void rsi_ContextPause(Context *rsc)
+{
+ rsc->pause();
+}
+
+void rsi_ContextResume(Context *rsc)
+{
+ rsc->resume();
+}
+
}
}
diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h
index 8cabf8787ae3..0a886cd6a131 100644
--- a/libs/rs/rsContext.h
+++ b/libs/rs/rsContext.h
@@ -88,6 +88,9 @@ public:
void setupCheck();
void allocationCheck(const Allocation *);
+ void pause();
+ void resume();
+
void assignName(ObjectBase *obj, const char *name, uint32_t len);
void removeName(ObjectBase *obj);
ObjectBase * lookupName(const char *name) const;
@@ -171,6 +174,7 @@ protected:
bool mRunning;
bool mExit;
bool mUseDepth;
+ bool mPaused;
pthread_t mThreadId;