OSDN Git Service

minigbm: rockchip: align to 128 bytes
authorGurchetan Singh <gurchetansingh@chromium.org>
Fri, 24 Mar 2017 01:47:06 +0000 (18:47 -0700)
committerchrome-bot <chrome-bot@chromium.org>
Fri, 31 Mar 2017 04:21:54 +0000 (21:21 -0700)
cmemp_heap_partition in the mali driver checks if every plane is
64-byte aligned. Since we expose a fd for every plane in the
cros gralloc handle, we hit this case. We need to enforce this
alignment on our YV12 allocations.

BUG=chromium:616275
TEST=
android.media.cts.VideoEncoderTest#testGoogH264FlexArbitraryH

passes on veyron_minnie-cheets.

Change-Id: If6375eddd18fd216e7f07eb2cc47090d838f82ab
Reviewed-on: https://chromium-review.googlesource.com/459104
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
rockchip.c

index 468d054..42d3f76 100644 (file)
@@ -188,10 +188,17 @@ static int rockchip_bo_create_with_modifiers(struct bo *bo,
                uint32_t stride;
                /*
                 * Since the ARM L1 cache line size is 64 bytes, align to that
-                * as a performance optimization.
+                * as a performance optimization. For YV12, the Mali cmem allocator
+                * requires that chroma planes are aligned to 64-bytes, so align the
+                * luma plane to 128 bytes.
                 */
                stride = drv_stride_from_format(format, width, 0);
-               stride = ALIGN(stride, 64);
+               if (format == DRM_FORMAT_YVU420 ||
+                   format == DRM_FORMAT_YVU420_ANDROID)
+                       stride = ALIGN(stride, 128);
+               else
+                       stride = ALIGN(stride, 64);
+
                drv_bo_from_format(bo, stride, height, format);
        }