OSDN Git Service

minigbm:amdgpu: align stride to 256
authorSatyajit Sahu <satyajit.sahu@amd.com>
Thu, 31 Jan 2019 04:28:24 +0000 (09:58 +0530)
committerMauro Rossi <issor.oruam@gmail.com>
Sun, 26 Jan 2020 21:48:04 +0000 (22:48 +0100)
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 <satyajit.sahu@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/1457777
Tested-by: Drew Davenport <ddavenport@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
amdgpu.c

index 749f6f3..38ae2fc 100644 (file)
--- 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);
        }