From b03e9c85d004ed9bb6468029a0660040ce768a05 Mon Sep 17 00:00:00 2001 From: Fritz Koenig Date: Wed, 9 Sep 2020 15:22:46 -0700 Subject: [PATCH] minigbm/msm: Correct NV12 UBWC buffer allocation V4L2 is the consumer of these buffers and sets up the allocation in get_framesize_raw_nv12_ubwc(). There was a mismatch where V4L2 was aligning the uv buffer differently than minigbm. BUG=b:166157708 TEST=video_decode_accelerator_tests with 856x480 video Change-Id: Idb9fb689a56639dbc73753d453e7e6e5daeb6700 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2402146 Tested-by: Fritz Koenig Commit-Queue: Fritz Koenig Reviewed-by: Gurchetan Singh --- msm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/msm.c b/msm.c index ac23b73..b291090 100644 --- a/msm.c +++ b/msm.c @@ -83,11 +83,14 @@ static void msm_calculate_layout(struct bo *bo) y_stride = ALIGN(width, VENUS_STRIDE_ALIGN); uv_stride = ALIGN(width, VENUS_STRIDE_ALIGN); y_scanline = ALIGN(height, VENUS_SCANLINE_ALIGN * 2); - uv_scanline = ALIGN(DIV_ROUND_UP(height, 2), VENUS_SCANLINE_ALIGN); + uv_scanline = ALIGN(DIV_ROUND_UP(height, 2), + VENUS_SCANLINE_ALIGN * (bo->meta.tiling ? 2 : 1)); y_plane = y_stride * y_scanline; uv_plane = uv_stride * uv_scanline; if (bo->meta.tiling == MSM_UBWC_TILING) { + y_plane = ALIGN(y_plane, PLANE_SIZE_ALIGN); + uv_plane = ALIGN(uv_plane, PLANE_SIZE_ALIGN); y_plane += get_ubwc_meta_size(width, height, 32, 8); uv_plane += get_ubwc_meta_size(width >> 1, height >> 1, 16, 8); extra_padding = NV12_UBWC_PADDING(y_stride); -- 2.11.0