summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-06-04 07:14:54 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-06-04 07:14:54 +0000
commitcfc366534c0bc31a50172142d0ef75242b2e5c13 (patch)
tree1e3982f2a48e974c2f4e387af2a578a340774c36
parenta553ac7a9d8383dd2405282dffbe5a6a2619c9c8 (diff)
parent871b18c89d347c8726f7350dee0e3fdb3705fb16 (diff)
downloadrs-oreo-r2-release.tar.gz
Change-Id: I43cfe70848f39de298e8ae197533bfb5b70035a9
-rw-r--r--cpp/rsDispatch.h2
-rw-r--r--rsApiContext.cpp12
-rw-r--r--rsContext.cpp4
-rw-r--r--rsContext.h4
-rw-r--r--rsDriverLoader.cpp15
5 files changed, 21 insertions, 16 deletions
diff --git a/cpp/rsDispatch.h b/cpp/rsDispatch.h
index ab579361..1bcd954b 100644
--- a/cpp/rsDispatch.h
+++ b/cpp/rsDispatch.h
@@ -29,6 +29,7 @@ typedef RsDevice (*DeviceCreateFnPtr) ();
typedef void (*DeviceDestroyFnPtr) (RsDevice dev);
typedef void (*DeviceSetConfigFnPtr) (RsDevice dev, RsDeviceParam p, int32_t value);
typedef RsContext (*ContextCreateFnPtr)(RsDevice vdev, uint32_t version, uint32_t sdkVersion, RsContextType ct, uint32_t flags);
+typedef RsContext (*ContextCreateVendorFnPtr)(RsDevice vdev, uint32_t version, uint32_t sdkVersion, RsContextType ct, uint32_t flags, const char* vendorDriverName);
typedef void (*GetNameFnPtr)(RsContext, void * obj, const char **name);
typedef RsClosure (*ClosureCreateFnPtr)(RsContext, RsScriptKernelID, RsAllocation, RsScriptFieldID*, size_t, int64_t*, size_t, int*, size_t, RsClosure*, size_t, RsScriptFieldID*, size_t);
typedef RsClosure (*InvokeClosureCreateFnPtr)(RsContext, RsScriptInvokeID, const void*, const size_t, const RsScriptFieldID*, const size_t, const int64_t*, const size_t, const int*, const size_t);
@@ -177,6 +178,7 @@ struct dispatchTable {
ClosureSetArgFnPtr ClosureSetArg;
ClosureSetGlobalFnPtr ClosureSetGlobal;
ContextCreateFnPtr ContextCreate;
+ ContextCreateVendorFnPtr ContextCreateVendor;
ContextDeinitToClientFnPtr ContextDeinitToClient;
ContextDestroyFnPtr ContextDestroy;
ContextDumpFnPtr ContextDump;
diff --git a/rsApiContext.cpp b/rsApiContext.cpp
index 11609851..53d9e4a7 100644
--- a/rsApiContext.cpp
+++ b/rsApiContext.cpp
@@ -25,16 +25,22 @@ using android::renderscript::Context;
using android::renderscript::Device;
using android::renderscript::ObjectBase;
-extern "C" RsContext rsContextCreate(RsDevice vdev, uint32_t version, uint32_t sdkVersion,
- RsContextType ct, uint32_t flags) {
+extern "C" RsContext rsContextCreateVendor(RsDevice vdev, uint32_t version, uint32_t sdkVersion,
+ RsContextType ct, uint32_t flags,
+ const char* vendorDriverName) {
Device * dev = static_cast<Device *>(vdev);
- Context *rsc = Context::createContext(dev, nullptr, ct, flags);
+ Context *rsc = Context::createContext(dev, nullptr, ct, flags, vendorDriverName);
if (rsc) {
rsc->setTargetSdkVersion(sdkVersion);
}
return rsc;
}
+extern "C" RsContext rsContextCreate(RsDevice vdev, uint32_t version, uint32_t sdkVersion,
+ RsContextType ct, uint32_t flags) {
+ return rsContextCreateVendor(vdev, version, sdkVersion, ct, flags, nullptr);
+}
+
extern "C" void rsaContextSetNativeLibDir(RsContext con, char *libDir, size_t length) {
#ifdef RS_COMPATIBILITY_LIB
Context *rsc = static_cast<Context *>(con);
diff --git a/rsContext.cpp b/rsContext.cpp
index f6686a92..f69f5ee1 100644
--- a/rsContext.cpp
+++ b/rsContext.cpp
@@ -460,7 +460,8 @@ void Context::setCacheDir(const char * cacheDir_arg, uint32_t length) {
}
Context * Context::createContext(Device *dev, const RsSurfaceConfig *sc,
- RsContextType ct, uint32_t flags) {
+ RsContextType ct, uint32_t flags,
+ const char* vendorDriverName) {
Context * rsc = new Context();
if (flags & RS_CONTEXT_LOW_LATENCY) {
@@ -471,6 +472,7 @@ Context * Context::createContext(Device *dev, const RsSurfaceConfig *sc,
}
rsc->mContextType = ct;
rsc->mHal.flags = flags;
+ rsc->mVendorDriverName = vendorDriverName;
if (!rsc->initContext(dev, sc)) {
delete rsc;
diff --git a/rsContext.h b/rsContext.h
index 10574ded..17a890bf 100644
--- a/rsContext.h
+++ b/rsContext.h
@@ -81,7 +81,8 @@ public:
static Context * createContext(Device *, const RsSurfaceConfig *sc,
RsContextType ct = RS_CONTEXT_TYPE_NORMAL,
- uint32_t flags = 0);
+ uint32_t flags = 0,
+ const char* vendorDriverName = nullptr);
static Context * createContextLite();
~Context();
@@ -352,6 +353,7 @@ private:
// Since this is always just a static string, we don't have to
// allocate, copy, or free any memory here.
const char* mDriverName;
+ const char* mVendorDriverName;
std::vector<ObjectBase *> mNames;
diff --git a/rsDriverLoader.cpp b/rsDriverLoader.cpp
index 48ff9907..e432a4f9 100644
--- a/rsDriverLoader.cpp
+++ b/rsDriverLoader.cpp
@@ -240,21 +240,14 @@ bool Context::loadDriver(bool forceDefault, bool forceRSoV) {
ALOGE("Failed to load the RSoV driver!");
}
-#ifdef OVERRIDE_RS_DRIVER
-#define XSTR(S) #S
-#define STR(S) XSTR(S)
-#define OVERRIDE_RS_DRIVER_STRING STR(OVERRIDE_RS_DRIVER)
- if (!forceDefault) {
- if (loadRuntime(OVERRIDE_RS_DRIVER_STRING)) {
- ALOGV("Successfully loaded runtime: %s", OVERRIDE_RS_DRIVER_STRING);
+ if (!forceDefault && mVendorDriverName != nullptr) {
+ if (loadRuntime(mVendorDriverName)) {
+ ALOGV("Successfully loaded runtime: %s", mVendorDriverName);
loadDefault = false;
} else {
- ALOGE("Failed to load runtime %s, loading default", OVERRIDE_RS_DRIVER_STRING);
+ ALOGE("Failed to load runtime %s, loading default", mVendorDriverName);
}
}
-#undef XSTR
-#undef STR
-#endif // OVERRIDE_RS_DRIVER
if (loadDefault) {
if (!loadRuntime("libRSDriver.so")) {