media: venus: Correct P010 buffer alignment
authorFritz Koenig <frkoenig@chromium.org>
Fri, 10 Feb 2023 19:26:46 +0000 (11:26 -0800)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Wed, 12 Apr 2023 07:35:44 +0000 (09:35 +0200)
According to msm_media_info.h the correct alignment
for the stride of P010 buffers is 128.

Signed-off-by: Fritz Koenig <frkoenig@chromium.org>
Reviewed-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Signed-off-by: Stanimir Varbanov <stanimir.k.varbanov@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/platform/qcom/venus/helpers.c
drivers/media/platform/qcom/venus/vdec.c

index ab6a29f..a2ceab7 100644 (file)
@@ -988,8 +988,8 @@ static u32 get_framesize_raw_p010(u32 width, u32 height)
 {
        u32 y_plane, uv_plane, y_stride, uv_stride, y_sclines, uv_sclines;
 
-       y_stride = ALIGN(width * 2, 256);
-       uv_stride = ALIGN(width * 2, 256);
+       y_stride = ALIGN(width * 2, 128);
+       uv_stride = ALIGN(width * 2, 128);
        y_sclines = ALIGN(height, 32);
        uv_sclines = ALIGN((height + 1) >> 1, 16);
        y_plane = y_stride * y_sclines;
index 1b62c64..51a53bf 100644 (file)
@@ -204,8 +204,13 @@ vdec_try_fmt_common(struct venus_inst *inst, struct v4l2_format *f)
                                           pixmp->height);
 
        if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
+               unsigned int stride = pixmp->width;
+
+               if (pixmp->pixelformat == V4L2_PIX_FMT_P010)
+                       stride *= 2;
+
                pfmt[0].sizeimage = szimage;
-               pfmt[0].bytesperline = ALIGN(pixmp->width, 128);
+               pfmt[0].bytesperline = ALIGN(stride, 128);
        } else {
                pfmt[0].sizeimage = clamp_t(u32, pfmt[0].sizeimage, 0, SZ_8M);
                pfmt[0].sizeimage = max(pfmt[0].sizeimage, szimage);