From 0eafe1d30b608debca4b7120f6f2fbbaa89b9c22 Mon Sep 17 00:00:00 2001 From: Brandon Brnich Date: Tue, 13 Aug 2024 17:44:33 -0500 Subject: [PATCH] TEMP: media: chips-media: wave5: change bytes per line calc for NV12 Change back how driver calculates sizes for output buffers. Signed-off-by: Brandon Brnich --- .../platform/chips-media/wave5/wave5-vpu-enc.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c index de575afa79ea..c1822927448b 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c @@ -561,10 +561,16 @@ static int wave5_vpu_enc_try_fmt_out(struct file *file, void *fh, struct v4l2_fo frmsize = vpu_fmt->v4l2_frmsize; } - wave5_update_pix_fmt(&f->fmt.pix_mp, VPU_FMT_TYPE_RAW, - width, - height, - frmsize); + if (f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_NV12) { + f->fmt.pix_mp.width = width; + f->fmt.pix_mp.height = height; + f->fmt.pix_mp.plane_fmt[0].bytesperline = round_up(width, 32); + f->fmt.pix_mp.plane_fmt[0].sizeimage = round_up(width, 32) * height * 3 / 2; + } else + wave5_update_pix_fmt(&f->fmt.pix_mp, VPU_FMT_TYPE_RAW, + width, + height, + frmsize); return 0; } @@ -580,12 +586,14 @@ static int wave5_vpu_enc_s_fmt_out(struct file *file, void *fh, struct v4l2_form __func__, f->fmt.pix_mp.pixelformat, f->fmt.pix_mp.width, f->fmt.pix_mp.height, f->fmt.pix_mp.num_planes, f->fmt.pix_mp.field); + pr_info("before %u x %u\n", f->fmt.pix_mp.width, f->fmt.pix_mp.height); ret = wave5_vpu_enc_try_fmt_out(file, fh, f); if (ret) return ret; inst->src_fmt.width = f->fmt.pix_mp.width; inst->src_fmt.height = f->fmt.pix_mp.height; + pr_info("after %u x %u\n", inst->src_fmt.width, inst->src_fmt.height); inst->src_fmt.pixelformat = f->fmt.pix_mp.pixelformat; inst->src_fmt.field = f->fmt.pix_mp.field; inst->src_fmt.flags = f->fmt.pix_mp.flags; -- 2.34.1