Skip to content

Commit 2f2f76d

Browse files
superna9999Bryan O'Donoghue
authored andcommitted
media: qcom: iris: vdec: update size and stride calculations for 10bit formats
Update the gen2 response and vdec s_fmt code to take in account the P010 and QC010 when calculating the width, height and stride. Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Tested-by: Wangao Wang <wangao.wang@oss.qualcomm.com> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
1 parent 3ea0343 commit 2f2f76d

2 files changed

Lines changed: 39 additions & 6 deletions

File tree

drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,9 +542,24 @@ static void iris_hfi_gen2_read_input_subcr_params(struct iris_inst *inst)
542542
pixmp_ip->width = width;
543543
pixmp_ip->height = height;
544544

545-
pixmp_op->width = ALIGN(width, 128);
546-
pixmp_op->height = ALIGN(height, 32);
547-
pixmp_op->plane_fmt[0].bytesperline = ALIGN(width, 128);
545+
switch (pixmp_op->pixelformat) {
546+
case V4L2_PIX_FMT_P010:
547+
pixmp_op->width = ALIGN(width, 128);
548+
pixmp_op->height = ALIGN(height, 32);
549+
pixmp_op->plane_fmt[0].bytesperline = ALIGN(width * 2, 256);
550+
break;
551+
case V4L2_PIX_FMT_QC10C:
552+
pixmp_op->width = roundup(width, 192);
553+
pixmp_op->height = ALIGN(height, 16);
554+
pixmp_op->plane_fmt[0].bytesperline = ALIGN(pixmp_op->width * 4 / 3, 256);
555+
break;
556+
case V4L2_PIX_FMT_NV12:
557+
case V4L2_PIX_FMT_QC08C:
558+
pixmp_op->width = ALIGN(width, 128);
559+
pixmp_op->height = ALIGN(height, 32);
560+
pixmp_op->plane_fmt[0].bytesperline = pixmp_op->width;
561+
break;
562+
}
548563
pixmp_op->plane_fmt[0].sizeimage = iris_get_buffer_size(inst, BUF_OUTPUT);
549564

550565
matrix_coeff = subsc_params.color_info & 0xFF;

drivers/media/platform/qcom/iris/iris_vdec.c

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,28 @@ int iris_vdec_s_fmt(struct iris_inst *inst, struct v4l2_format *f)
263263
fmt = inst->fmt_dst;
264264
fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
265265
fmt->fmt.pix_mp.pixelformat = f->fmt.pix_mp.pixelformat;
266-
fmt->fmt.pix_mp.width = ALIGN(f->fmt.pix_mp.width, 128);
267-
fmt->fmt.pix_mp.height = ALIGN(f->fmt.pix_mp.height, 32);
268266
fmt->fmt.pix_mp.num_planes = 1;
269-
fmt->fmt.pix_mp.plane_fmt[0].bytesperline = ALIGN(f->fmt.pix_mp.width, 128);
267+
switch (f->fmt.pix_mp.pixelformat) {
268+
case V4L2_PIX_FMT_P010:
269+
fmt->fmt.pix_mp.width = ALIGN(f->fmt.pix_mp.width, 128);
270+
fmt->fmt.pix_mp.height = ALIGN(f->fmt.pix_mp.height, 32);
271+
fmt->fmt.pix_mp.plane_fmt[0].bytesperline =
272+
ALIGN(f->fmt.pix_mp.width * 2, 256);
273+
break;
274+
case V4L2_PIX_FMT_QC10C:
275+
fmt->fmt.pix_mp.width = roundup(f->fmt.pix_mp.width, 192);
276+
fmt->fmt.pix_mp.height = ALIGN(f->fmt.pix_mp.height, 16);
277+
fmt->fmt.pix_mp.plane_fmt[0].bytesperline =
278+
ALIGN(f->fmt.pix_mp.width * 4 / 3, 256);
279+
break;
280+
case V4L2_PIX_FMT_NV12:
281+
case V4L2_PIX_FMT_QC08C:
282+
fmt->fmt.pix_mp.width = ALIGN(f->fmt.pix_mp.width, 128);
283+
fmt->fmt.pix_mp.height = ALIGN(f->fmt.pix_mp.height, 32);
284+
fmt->fmt.pix_mp.plane_fmt[0].bytesperline =
285+
ALIGN(f->fmt.pix_mp.width, 128);
286+
break;
287+
}
270288
fmt->fmt.pix_mp.plane_fmt[0].sizeimage = iris_get_buffer_size(inst, BUF_OUTPUT);
271289
inst->buffers[BUF_OUTPUT].min_count = iris_vpu_buf_count(inst, BUF_OUTPUT);
272290
inst->buffers[BUF_OUTPUT].size = fmt->fmt.pix_mp.plane_fmt[0].sizeimage;

0 commit comments

Comments
 (0)