Skip to content

Commit 15fe06f

Browse files
Aakarsh JainHans Verkuil
authored andcommitted
media: s5p-mfc: Add support for UHD encoding.
MFC driver had restriction on max resolution of 1080p, updated it for UHD. Added corresponding support to set recommended profile and level for H264 in UHD scenario. Cc: linux-fsd@tesla.com Signed-off-by: Smitha T Murthy <smithatmurthy@gmail.com> Signed-off-by: Aakarsh Jain <aakarsh.jain@samsung.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
1 parent c639899 commit 15fe06f

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,9 +1461,12 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f)
14611461
mfc_err("Unsupported format by this MFC version.\n");
14621462
return -EINVAL;
14631463
}
1464-
1465-
v4l_bound_align_image(&pix_fmt_mp->width, 8, 1920, 1,
1466-
&pix_fmt_mp->height, 4, 1080, 1, 0);
1464+
if (IS_MFCV12(dev))
1465+
v4l_bound_align_image(&pix_fmt_mp->width, 8, 3840, 1, &pix_fmt_mp
1466+
->height, 4, 2160, 1, 0);
1467+
else
1468+
v4l_bound_align_image(&pix_fmt_mp->width, 8, 1920, 1, &pix_fmt_mp
1469+
->height, 4, 1080, 1, 0);
14671470
} else {
14681471
mfc_err("invalid buf type\n");
14691472
return -EINVAL;

drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,6 +1071,18 @@ static int s5p_mfc_set_enc_params_h264(struct s5p_mfc_ctx *ctx)
10711071
reg |= ((p->num_b_frame & 0x3) << 16);
10721072
writel(reg, mfc_regs->e_gop_config);
10731073

1074+
/* UHD encoding case */
1075+
if (ctx->img_width == 3840 && ctx->img_height == 2160) {
1076+
if (p_h264->level < 51) {
1077+
mfc_debug(2, "Set Level 5.1 for UHD\n");
1078+
p_h264->level = 51;
1079+
}
1080+
if (p_h264->profile != 0x2) {
1081+
mfc_debug(2, "Set High profile for UHD\n");
1082+
p_h264->profile = 0x2;
1083+
}
1084+
}
1085+
10741086
/* profile & level */
10751087
reg = 0;
10761088
/** level */

0 commit comments

Comments
 (0)