minigbm: rockchip: align to 128 bytes
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>
diff --git a/rockchip.c b/rockchip.c
index 468d054..42d3f76 100644
--- a/rockchip.c
+++ b/rockchip.c
@@ -188,10 +188,17 @@
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);
}