OSDN Git Service

mediatek: Align height to 16 bytes for NV12
authorMoja Hsu <mojahsu@google.com>
Wed, 2 Oct 2019 06:47:10 +0000 (14:47 +0800)
committerCommit Bot <commit-bot@chromium.org>
Wed, 8 Jan 2020 04:44:25 +0000 (04:44 +0000)
We want to use the same buffer from camera to JPEG hardware encoder so
align the height of camera usage buffer 16 that is required by the JPEG
hardware encoder.

BUG=b:141516308
TEST=Check if data offset is correct. Take picture with CCA.

Change-Id: I0db10762494423f7c4a340725015839803b40af4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1984211
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Hsu Wei-Cheng <mojahsu@chromium.org>
Commit-Queue: Hsu Wei-Cheng <mojahsu@chromium.org>

mediatek.c

index 5581e8f..36d8115 100644 (file)
@@ -128,6 +128,15 @@ static int mediatek_bo_create_with_modifiers(struct bo *bo, uint32_t width, uint
 
                drv_bo_from_format_and_padding(bo, stride, aligned_height, format, padding);
        } else {
+#ifdef MTK_MT8183
+               /*
+                * JPEG Encoder Accelerator requires 16x16 alignment. We want the buffer
+                * from camera can be put in JEA directly so align the height to 16
+                * bytes.
+                */
+               if (format == DRM_FORMAT_NV12)
+                       height = ALIGN(height, 16);
+#endif
                drv_bo_from_format(bo, stride, height, format);
        }