OSDN Git Service

minigbm: align width so that stride aligns to 256
authorSatyajit Sahu <satyajit.sahu@amd.com>
Thu, 4 Oct 2018 04:49:50 +0000 (10:19 +0530)
committerMauro Rossi <issor.oruam@gmail.com>
Sun, 26 Jan 2020 21:39:42 +0000 (22:39 +0100)
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>
amdgpu.c

index 5679920..cb8c323 100644 (file)
--- a/amdgpu.c
+++ b/amdgpu.c
@@ -140,6 +140,13 @@ static int amdgpu_create_bo(struct bo *bo, uint32_t width, uint32_t height, uint
        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);