Allow drivers to alter the default driver name on rsdHalInit
Bug: 20894432
Permit partner drivers via Context::setDriverName to choose their
own mDriverName rather than the default OVERRIDE_RS_DRIVER string.
This can only be done once from within rsdHalInit otherwise it will
be ignored and the default behaviour will apply.
Change-Id: I49b81e60f7983a81f0e71fbef4b46f9bfc834849
diff --git a/rsContext.h b/rsContext.h
index 918e5e3..09b7483 100644
--- a/rsContext.h
+++ b/rsContext.h
@@ -290,6 +290,14 @@
return mDriverName;
}
+ // Set a new driver name, should be called from within
+ // rsdHalInit in order to alter default behaviour.
+ void setDriverName(const char * name) {
+ if (!mDriverName) {
+ mDriverName = name;
+ }
+ }
+
protected:
diff --git a/rsDriverLoader.cpp b/rsDriverLoader.cpp
index 5bfb8e5..7b728b6 100644
--- a/rsDriverLoader.cpp
+++ b/rsDriverLoader.cpp
@@ -207,7 +207,7 @@
}
// Only map in the actual driver name if we successfully load the runtime.
- mDriverName = filename;
+ setDriverName(filename);
return true;