Merge cherrypicks of [15919265, 15919266, 15919267, 15919014, 15919015, 15919110, 15919205, 15919286] into sc-d1-release

Change-Id: I65b760b0ffebbfe9bd142e0808e59b11ba63bc8a
diff --git a/gralloc4/src/core/mali_gralloc_bufferallocation.cpp b/gralloc4/src/core/mali_gralloc_bufferallocation.cpp
index fe2349b..e928637 100644
--- a/gralloc4/src/core/mali_gralloc_bufferallocation.cpp
+++ b/gralloc4/src/core/mali_gralloc_bufferallocation.cpp
@@ -446,7 +446,7 @@
 {
 	if (plane == 0)
 	{
-		*byte_stride = GRALLOC_ALIGN(luma_stride, stride_align);
+		*byte_stride = GRALLOC_ALIGN(luma_stride, GRALLOC_ALIGN(stride_align, 32));
 	}
 	else
 	{
@@ -456,7 +456,7 @@
 		 * 2. Multiple of 16px (16 bytes)
 		 */
 		*byte_stride = luma_stride / 2;
-		assert(*byte_stride == GRALLOC_ALIGN(*byte_stride, stride_align / 2));
+		assert(*byte_stride == GRALLOC_ALIGN(*byte_stride, GRALLOC_ALIGN(stride_align / 2, 16)));
 		assert(*byte_stride & 15 == 0);
 	}
 }