summaryrefslogtreecommitdiff
path: root/rsContext.cpp
diff options
context:
space:
mode:
authorTim Murray <timmurray@google.com>2012-11-06 14:36:38 -0800
committerTim Murray <timmurray@google.com>2012-11-06 14:36:38 -0800
commit0e92fa3775b3537c29a7a0ca603d892548936038 (patch)
tree90f820385669dc0f2bbb30be8fd29c3616a5d3e3 /rsContext.cpp
parent2eb76f62569f8d2f3aaa2072f1466157ee15ab99 (diff)
downloadrs-0e92fa3775b3537c29a7a0ca603d892548936038.tar.gz
Add flag for enabling CPU-only execution.
Change-Id: I5f6ba33899716ddd82ed2e6325b0a7a9fd8a9ffe
Diffstat (limited to 'rsContext.cpp')
-rw-r--r--rsContext.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/rsContext.cpp b/rsContext.cpp
index b2396d6f..d3709bad 100644
--- a/rsContext.cpp
+++ b/rsContext.cpp
@@ -275,6 +275,8 @@ void * Context::threadProc(void *vrsc) {
if (getProp("debug.rs.default-CPU-driver") != 0) {
ALOGE("Skipping override driver and loading default CPU driver");
+ } else if (rsc->mForceCpu) {
+ ALOGV("Application requested CPU execution");
} else {
if (loadRuntime(OVERRIDE_RS_DRIVER_STRING, rsc)) {
ALOGE("Successfully loaded runtime: %s", OVERRIDE_RS_DRIVER_STRING);
@@ -441,11 +443,19 @@ Context::Context() {
mDPI = 96;
mIsContextLite = false;
memset(&watchdog, 0, sizeof(watchdog));
+ mForceCpu = false;
}
Context * Context::createContext(Device *dev, const RsSurfaceConfig *sc) {
+ return createContext(dev, sc, false);
+}
+
+Context * Context::createContext(Device *dev, const RsSurfaceConfig *sc,
+ bool forceCpu) {
Context * rsc = new Context();
+ rsc->mForceCpu = forceCpu;
+
if (!rsc->initContext(dev, sc)) {
delete rsc;
return NULL;
@@ -809,9 +819,14 @@ void rsi_ContextDeinitToClient(Context *rsc) {
RsContext rsContextCreate(RsDevice vdev, uint32_t version,
uint32_t sdkVersion) {
+ return rsContextCreate(vdev, version, sdkVersion, false);
+}
+
+RsContext rsContextCreate(RsDevice vdev, uint32_t version,
+ uint32_t sdkVersion, bool forceCpu) {
ALOGV("rsContextCreate dev=%p", vdev);
Device * dev = static_cast<Device *>(vdev);
- Context *rsc = Context::createContext(dev, NULL);
+ Context *rsc = Context::createContext(dev, NULL, forceCpu);
if (rsc) {
rsc->setTargetSdkVersion(sdkVersion);
}