map stride is bigger than the allocation stride. Currently
gralloc_lock does not consider map_stride. Align the width so
that stride get alinged to 256.
BUG=b:
115946221
TEST= CtsNativeHardwareTestCases GpuColorOutputCpuRead* tests
Change-Id: I0e1ccfba4ec981702498a76fa5a0b2c662b6e728
Signed-off-by: Satyajit Sahu <satyajit.sahu@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/
1242767
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Deepak Sharma <deepak.sharma@amd.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
if (!combo)
return -EINVAL;
+ /* Currently Gralloc does not handle a different map_stride. So to work around,
+ * aligning the stride to 256 to make bo_stride same as map_stride. b/115946221.
+ */
+#ifdef __ANDROID__
+ uint32_t bytes_per_pixel = drv_bytes_per_pixel_from_format(format, 0);
+ width = ALIGN(width, 256 / bytes_per_pixel);
+#endif
if (combo->metadata.tiling == TILE_TYPE_DRI)
return dri_bo_create(bo, width, height, format, use_flags);