diff options
| author | 2019-02-14 12:28:12 -0800 | |
|---|---|---|
| committer | 2019-02-21 00:21:36 -0800 | |
| commit | 6ef8494cf4dddd031a47d11be1a2de532111ae93 (patch) | |
| tree | 2eaf5b9d0626807e8dc3675074c3e159150ffe27 /libs/graphicsenv/GraphicsEnv.cpp | |
| parent | 974085a26a4d64169ed6cd55afc9dc3745b93a0e (diff) | |
Game Driver: add required sphal libraries to game driver namespace
Bug: 124448366
Test: Build, flash and boot. Verify if those libraries are loaded.
Change-Id: I2673c47ee75c08d283efdec650a082b742c45768
Diffstat (limited to 'libs/graphicsenv/GraphicsEnv.cpp')
| -rw-r--r-- | libs/graphicsenv/GraphicsEnv.cpp | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/libs/graphicsenv/GraphicsEnv.cpp b/libs/graphicsenv/GraphicsEnv.cpp index 6e5324ee47..13c0d876c0 100644 --- a/libs/graphicsenv/GraphicsEnv.cpp +++ b/libs/graphicsenv/GraphicsEnv.cpp @@ -146,14 +146,18 @@ int GraphicsEnv::getCanLoadSystemLibraries() { return 0; } -void GraphicsEnv::setDriverPath(const std::string path) { - if (!mDriverPath.empty()) { - ALOGV("ignoring attempt to change driver path from '%s' to '%s'", mDriverPath.c_str(), - path.c_str()); +void GraphicsEnv::setDriverPathAndSphalLibraries(const std::string path, + const std::string sphalLibraries) { + if (!mDriverPath.empty() || !mSphalLibraries.empty()) { + ALOGV("ignoring attempt to change driver path from '%s' to '%s' or change sphal libraries " + "from '%s' to '%s'", + mDriverPath.c_str(), path.c_str(), mSphalLibraries.c_str(), sphalLibraries.c_str()); return; } - ALOGV("setting driver path to '%s'", path.c_str()); + ALOGV("setting driver path to '%s' and sphal libraries to '%s'", path.c_str(), + sphalLibraries.c_str()); mDriverPath = path; + mSphalLibraries = sphalLibraries; } void GraphicsEnv::setGpuStats(const std::string& driverPackageName, @@ -536,6 +540,23 @@ android_namespace_t* GraphicsEnv::getDriverNamespace() { mDriverNamespace = nullptr; return; } + + if (mSphalLibraries.empty()) return; + + // Make additional libraries in sphal to be accessible + auto sphalNamespace = android_get_exported_namespace("sphal"); + if (!sphalNamespace) { + ALOGE("Depend on these libraries[%s] in sphal, but failed to get sphal namespace", + mSphalLibraries.c_str()); + mDriverNamespace = nullptr; + return; + } + + if (!android_link_namespaces(mDriverNamespace, sphalNamespace, mSphalLibraries.c_str())) { + ALOGE("Failed to link sphal namespace[%s]", dlerror()); + mDriverNamespace = nullptr; + return; + } }); return mDriverNamespace; |