diff options
author | Lingfeng Yang <lfy@google.com> | 2017-07-07 09:07:09 -0700 |
---|---|---|
committer | Lingfeng Yang <lfy@google.com> | 2017-07-07 10:00:53 -0700 |
commit | 1374537c2af65d9ec610637a1a6a5efb9ffacf40 (patch) | |
tree | 073aae16a8f2bd9119bfad8cd3ad8abff32e39e7 | |
parent | 1e33902f57025a91e978460017be38655f1463b4 (diff) | |
download | device_generic_goldfish-opengl-1374537c2af65d9ec610637a1a6a5efb9ffacf40.tar.gz device_generic_goldfish-opengl-1374537c2af65d9ec610637a1a6a5efb9ffacf40.tar.bz2 device_generic_goldfish-opengl-1374537c2af65d9ec610637a1a6a5efb9ffacf40.zip |
Fix guest rendering
gralloc.default.so's location can depend on a bunch of stuff.
It is still present in more recent google apis system image builds,
but it is in system not vendor.
This CL just looks for both and picks the one that works.
Change-Id: Ibdac761a9666f22ec38a67d0b31694f20c9250f5
-rw-r--r-- | system/gralloc/gralloc.cpp | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/system/gralloc/gralloc.cpp b/system/gralloc/gralloc.cpp index ae0a3243..7c51667d 100644 --- a/system/gralloc/gralloc.cpp +++ b/system/gralloc/gralloc.cpp @@ -1486,6 +1486,15 @@ struct private_module_t HAL_MODULE_INFO_SYM = { * * If not, then load gralloc.default instead as a fallback. */ + +#if __LP64__ +static const char kGrallocDefaultSystemPath[] = "/system/lib64/hw/gralloc.default.so"; +static const char kGrallocDefaultVendorPath[] = "/vendor/lib64/hw/gralloc.default.so"; +#else +static const char kGrallocDefaultSystemPath[] = "/system/lib/hw/gralloc.default.so"; +static const char kGrallocDefaultVendorPath[] = "/vendor/lib/hw/gralloc.default.so"; +#endif + static void fallback_init(void) { @@ -1499,12 +1508,17 @@ fallback_init(void) if (atoi(prop) == 1) { return; } - ALOGD("Emulator without host-side GPU emulation detected."); -#if __LP64__ - module = dlopen("/vendor/lib64/hw/gralloc.default.so", RTLD_LAZY|RTLD_LOCAL); -#else - module = dlopen("/vendor/lib/hw/gralloc.default.so", RTLD_LAZY|RTLD_LOCAL); -#endif + ALOGD("Emulator without host-side GPU emulation detected. " + "Loading gralloc.default.so from %s...", + kGrallocDefaultVendorPath); + module = dlopen(kGrallocDefaultVendorPath, RTLD_LAZY | RTLD_LOCAL); + if (!module) { + // vendor folder didn't work. try system + ALOGD("gralloc.default.so not found in /vendor. Trying %s...", + kGrallocDefaultSystemPath); + module = dlopen(kGrallocDefaultSystemPath, RTLD_LAZY | RTLD_LOCAL); + } + if (module != NULL) { sFallback = reinterpret_cast<gralloc_module_t*>(dlsym(module, HAL_MODULE_INFO_SYM_AS_STR)); if (sFallback == NULL) { @@ -1512,6 +1526,6 @@ fallback_init(void) } } if (sFallback == NULL) { - ALOGE("Could not find software fallback module!?"); + ALOGE("FATAL: Could not find gralloc.default.so!"); } } |