libgrallocutils: Support defaults in AdrenoMemInfo
Support defaults in AdrenoMemInfo for cases where libadreno_utils.so
is unavailable.
Change-Id: I0e671f15ec4671488cdeb421f662efa66bc25738
CRs-fixed: 2082006
diff --git a/libgralloc1/gr_adreno_info.cpp b/libgralloc1/gr_adreno_info.cpp
index ecac238..f71f1d2 100644
--- a/libgralloc1/gr_adreno_info.cpp
+++ b/libgralloc1/gr_adreno_info.cpp
@@ -48,16 +48,12 @@
lock_guard<mutex> obj(s_lock);
if (!s_instance) {
s_instance = new AdrenoMemInfo();
- if (!s_instance->Init()) {
- delete s_instance;
- s_instance = nullptr;
- }
}
return s_instance;
}
-bool AdrenoMemInfo::Init() {
+AdrenoMemInfo::AdrenoMemInfo() {
libadreno_utils_ = ::dlopen("libadreno_utils.so", RTLD_NOW);
if (libadreno_utils_) {
*reinterpret_cast<void **>(&LINK_adreno_compute_aligned_width_and_height) =
@@ -74,7 +70,6 @@
::dlsym(libadreno_utils_, "get_gpu_pixel_alignment");
} else {
ALOGE(" Failed to load libadreno_utils.so");
- return false;
}
// Check if the overriding property debug.gralloc.gfx_ubwc_disable
@@ -91,8 +86,6 @@
(!strncasecmp(property, "true", PROPERTY_VALUE_MAX)))) {
map_fb_ = true;
}
-
- return true;
}
AdrenoMemInfo::~AdrenoMemInfo() {
@@ -170,6 +163,8 @@
width, height, format, 0, raster_mode, padding_threshold,
reinterpret_cast<int *>(aligned_w), reinterpret_cast<int *>(aligned_h), &bytesPerPixel);
} else {
+ *aligned_w = (unsigned int)ALIGN(width, 32);
+ *aligned_h = (unsigned int)ALIGN(height, 32);
ALOGW("%s: Warning!! compute_compressedfmt_aligned_width_and_height not found", __FUNCTION__);
}
}