OSDN Git Service

minigbm: i915: align YV12 to HW requirements
authorGurchetan Singh <gurchetansingh@chromium.org>
Thu, 16 Mar 2017 20:14:30 +0000 (13:14 -0700)
committerchrome-bot <chrome-bot@chromium.org>
Tue, 21 Mar 2017 02:30:09 +0000 (19:30 -0700)
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>
i915.c

diff --git a/i915.c b/i915.c
index 4acceb4..915a4ce 100644 (file)
--- a/i915.c
+++ b/i915.c
@@ -260,6 +260,16 @@ static int i915_bo_create(struct bo *bo, uint32_t width, uint32_t height,
        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);