minigbm: i915: align YV12 to HW requirements
As per drm_gralloc we need to:
(1) align the Y plane to 128 bytes so the chroma planes would be
aligned to 64 bytes boundaries.
(2) Have no tiling with YV12.
BUG=chromium:616275
TEST=DecodeEditEncodeTest#testVideoEdit720p
passes on cyan. Run YT app.
Change-Id: I339163c94d4481991702b8bfd232a70f3a275506
Reviewed-on: https://chromium-review.googlesource.com/456403
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/i915.c b/i915.c
index 4acceb4..915a4ce 100644
--- a/i915.c
+++ b/i915.c
@@ -260,6 +260,16 @@
else
tiling_mode = I915_TILING_Y;
+ /*
+ * Align the Y plane to 128 bytes so the chroma planes would be aligned
+ * to 64 byte boundaries. This is an Intel HW requirement.
+ */
+ if (format == DRM_FORMAT_YVU420 ||
+ format == DRM_FORMAT_YVU420_ANDROID) {
+ width = ALIGN(width, 128);
+ tiling_mode = I915_TILING_NONE;
+ }
+
i915_align_dimensions(bo->drv, tiling_mode, &width, &height, bpp);
drv_bo_from_format(bo, width, height, format);