From 8b68e2a1121c2075cf72ce2da02cd82bd39d14a7 Mon Sep 17 00:00:00 2001 From: Satyajit Sahu Date: Thu, 31 Jan 2019 09:58:24 +0530 Subject: [PATCH] minigbm:amdgpu: align stride to 256 Previously stride was alinged to 256 only in linear path and android. Now it is aligned to 256 for all cases. BUG=b:122049612 TEST=suspend_stress_test Change-Id: I757f2d056176fe5ebfd858a017273cf02bad6020 Signed-off-by: Satyajit Sahu Reviewed-on: https://chromium-review.googlesource.com/1457777 Tested-by: Drew Davenport Reviewed-by: Gurchetan Singh --- amdgpu.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/amdgpu.c b/amdgpu.c index 749f6f3..38ae2fc 100644 --- a/amdgpu.c +++ b/amdgpu.c @@ -140,6 +140,7 @@ static int amdgpu_create_bo(struct bo *bo, uint32_t width, uint32_t height, uint return -EINVAL; if (combo->metadata.tiling == TILE_TYPE_DRI) { + bool needs_alignment = false; #ifdef __ANDROID__ /* * Currently, the gralloc API doesn't differentiate between allocation time and map @@ -148,11 +149,18 @@ static int amdgpu_create_bo(struct bo *bo, uint32_t width, uint32_t height, uint * * See b/115946221,b/117942643 */ - if (use_flags & (BO_USE_SW_MASK)) { + if (use_flags & (BO_USE_SW_MASK)) + needs_alignment = true; +#endif + // See b/122049612 + if (use_flags & (BO_USE_SCANOUT)) + needs_alignment = true; + + if (needs_alignment) { uint32_t bytes_per_pixel = drv_bytes_per_pixel_from_format(format, 0); width = ALIGN(width, 256 / bytes_per_pixel); } -#endif + return dri_bo_create(bo, width, height, format, use_flags); } -- 2.11.0