From ea2e4d37418c6ada5d3c8cd08b8e60348dd46790 Mon Sep 17 00:00:00 2001 From: Jon Parr Date: Thu, 11 Jun 2015 14:27:51 +0100 Subject: 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 (cherry picked from commit b268abd5528936d13a85b03f44458fe3a55cafad) --- rsContext.h | 8 ++++++++ rsDriverLoader.cpp | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/rsContext.h b/rsContext.h index 918e5e3f..09b7483f 100644 --- a/rsContext.h +++ b/rsContext.h @@ -290,6 +290,14 @@ public: 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 5bfb8e5c..7b728b62 100644 --- a/rsDriverLoader.cpp +++ b/rsDriverLoader.cpp @@ -207,7 +207,7 @@ bool Context::loadRuntime(const char* filename) { } // Only map in the actual driver name if we successfully load the runtime. - mDriverName = filename; + setDriverName(filename); return true; -- cgit v1.2.3