From 3a7be7f54914c646e6ec55d884a46da3a0196f02 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Thu, 25 Mar 2021 18:34:50 +0000 Subject: [PATCH 0288/1085] staging/bcm2835-camera: Add support for H264 levels 4.1 and 4.2 Whilst the hardware can't achieve the limits of level 4.2 under all situations, it can exceed level 4.0. Allow selection of levels 4.1 and 4.2. Signed-off-by: Dave Stevenson --- .../vc04_services/bcm2835-camera/controls.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) --- a/drivers/staging/vc04_services/bcm2835-camera/controls.c +++ b/drivers/staging/vc04_services/bcm2835-camera/controls.c @@ -704,6 +704,8 @@ static int ctrl_set_video_encode_profile case V4L2_MPEG_VIDEO_H264_LEVEL_3_1: case V4L2_MPEG_VIDEO_H264_LEVEL_3_2: case V4L2_MPEG_VIDEO_H264_LEVEL_4_0: + case V4L2_MPEG_VIDEO_H264_LEVEL_4_1: + case V4L2_MPEG_VIDEO_H264_LEVEL_4_2: dev->capture.enc_level = ctrl->val; break; default: @@ -769,6 +771,17 @@ static int ctrl_set_video_encode_profile case V4L2_MPEG_VIDEO_H264_LEVEL_4_0: param.level = MMAL_VIDEO_LEVEL_H264_4; break; + /* + * Note that the hardware spec is level 4.0. Achieving levels + * above that depend on exactly the resolution and frame rate + * being requested. + */ + case V4L2_MPEG_VIDEO_H264_LEVEL_4_1: + param.level = MMAL_VIDEO_LEVEL_H264_41; + break; + case V4L2_MPEG_VIDEO_H264_LEVEL_4_2: + param.level = MMAL_VIDEO_LEVEL_H264_42; + break; default: /* Should never get here */ break; @@ -1218,8 +1231,10 @@ static const struct bcm2835_mmal_v4l2_ct BIT(V4L2_MPEG_VIDEO_H264_LEVEL_3_0) | BIT(V4L2_MPEG_VIDEO_H264_LEVEL_3_1) | BIT(V4L2_MPEG_VIDEO_H264_LEVEL_3_2) | - BIT(V4L2_MPEG_VIDEO_H264_LEVEL_4_0)), - .max = V4L2_MPEG_VIDEO_H264_LEVEL_4_0, + BIT(V4L2_MPEG_VIDEO_H264_LEVEL_4_0) | + BIT(V4L2_MPEG_VIDEO_H264_LEVEL_4_1) | + BIT(V4L2_MPEG_VIDEO_H264_LEVEL_4_2)), + .max = V4L2_MPEG_VIDEO_H264_LEVEL_4_2, .def = V4L2_MPEG_VIDEO_H264_LEVEL_4_0, .step = 1, .imenu = NULL,