OSDN Git Service

minigbm/msm: Correct NV12 UBWC buffer allocation
authorFritz Koenig <frkoenig@chromium.org>
Wed, 9 Sep 2020 22:22:46 +0000 (15:22 -0700)
committerCommit Bot <commit-bot@chromium.org>
Sun, 13 Sep 2020 20:56:11 +0000 (20:56 +0000)
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 <frkoenig@chromium.org>
Commit-Queue: Fritz Koenig <frkoenig@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
msm.c

diff --git a/msm.c b/msm.c
index ac23b73..b291090 100644 (file)
--- 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);