Snap for 4448085 from 058a6f9bf2a2c85974e5f8001dc5d8d68969390d to oc-m3-release

Change-Id: I2cc4cf5a36e664b1e37cb01702300f943f0b75b5
diff --git a/msm8994/libgralloc/mapper.cpp b/msm8994/libgralloc/mapper.cpp
index 0b091fb..8df761e 100644
--- a/msm8994/libgralloc/mapper.cpp
+++ b/msm8994/libgralloc/mapper.cpp
@@ -73,7 +73,7 @@
                   hnd, hnd->fd_metadata, strerror(errno));
             return -errno;
         }
-        hnd->base_metadata = uint64_t(mappedAddress) + hnd->offset_metadata;
+        hnd->base_metadata = uint64_t(mappedAddress);
     }
     return 0;
 }
@@ -104,7 +104,7 @@
             return -errno;
         }
 
-        hnd->base = uint64_t(mappedAddress) + hnd->offset;
+        hnd->base = uint64_t(mappedAddress);
     } else {
         // Cannot map secure buffers or framebuffers, but still need to map
         // metadata for secure buffers.
diff --git a/msm8996/libgralloc/mapper.cpp b/msm8996/libgralloc/mapper.cpp
index 2ecb491..77e761d 100644
--- a/msm8996/libgralloc/mapper.cpp
+++ b/msm8996/libgralloc/mapper.cpp
@@ -73,7 +73,7 @@
                   hnd, hnd->fd_metadata, strerror(errno));
             return -errno;
         }
-        hnd->base_metadata = uint64_t(mappedAddress) + hnd->offset_metadata;
+        hnd->base_metadata = uint64_t(mappedAddress);
     }
     return 0;
 }
@@ -104,7 +104,7 @@
             return -errno;
         }
 
-        hnd->base = uint64_t(mappedAddress) + hnd->offset;
+        hnd->base = uint64_t(mappedAddress);
     } else {
         // Cannot map secure buffers or framebuffers, but still need to map
         // metadata for secure buffers.
diff --git a/msm8996/libgralloc1/gr_buf_mgr.cpp b/msm8996/libgralloc1/gr_buf_mgr.cpp
index 1a09b69..1c632a1 100644
--- a/msm8996/libgralloc1/gr_buf_mgr.cpp
+++ b/msm8996/libgralloc1/gr_buf_mgr.cpp
@@ -483,14 +483,14 @@
   int buffer_type = GetBufferType(gralloc_format);
   allocator_->GetBufferSizeAndDimensions(descriptor, &size, &alignedw, &alignedh);
   size = (bufferSize >= size) ? bufferSize : size;
-  size = size * layer_count;
 
   int err = 0;
   int flags = 0;
   auto page_size = UINT(getpagesize());
   AllocData data;
   data.align = GetDataAlignment(format, prod_usage, cons_usage);
-  data.size = ALIGN(size, data.align);
+  size = ALIGN(size, data.align) * layer_count;
+  data.size = size;
   data.handle = (uintptr_t) handle;
   data.uncached = allocator_->UseUncached(prod_usage, cons_usage);
 
diff --git a/msm8998/libgralloc1/gr_adreno_info.cpp b/msm8998/libgralloc1/gr_adreno_info.cpp
index 59a6f5f..1c833ed 100644
--- a/msm8998/libgralloc1/gr_adreno_info.cpp
+++ b/msm8998/libgralloc1/gr_adreno_info.cpp
@@ -54,8 +54,7 @@
     *reinterpret_cast<void **>(&LINK_adreno_get_gpu_pixel_alignment) =
         ::dlsym(libadreno_utils_, "get_gpu_pixel_alignment");
   } else {
-    ALOGE(" Failed to load libadreno_utils.so");
-    return false;
+    ALOGW(" Failed to load libadreno_utils.so");
   }
 
   // Check if the overriding property debug.gralloc.gfx_ubwc_disable_
@@ -141,6 +140,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__);
   }
 }
diff --git a/msm8998/libgralloc1/gr_allocator.cpp b/msm8998/libgralloc1/gr_allocator.cpp
index 589f772..899ba8e 100644
--- a/msm8998/libgralloc1/gr_allocator.cpp
+++ b/msm8998/libgralloc1/gr_allocator.cpp
@@ -84,9 +84,7 @@
   }
 
   adreno_helper_ = new AdrenoMemInfo();
-  if (!adreno_helper_->Init()) {
-    return false;
-  }
+  adreno_helper_->Init();
 
   return true;
 }
diff --git a/msm8998/libqdutils/qdMetaData.cpp b/msm8998/libqdutils/qdMetaData.cpp
index 783006d..0860c81 100644
--- a/msm8998/libqdutils/qdMetaData.cpp
+++ b/msm8998/libqdutils/qdMetaData.cpp
@@ -37,8 +37,8 @@
 
 static int validateAndMap(private_handle_t* handle) {
     if (private_handle_t::validate(handle)) {
-        ALOGE("%s: Private handle is invalid - handle:%p id: %" PRIu64,
-                __func__, handle, handle->id);
+        ALOGE("%s: Private handle is invalid - handle:%p",
+                __func__, handle);
         return -1;
     }
     if (handle->fd_metadata == -1) {