aaf302f72a9e3aa0ae3374d4d9406076fa66aaf4
[openwrt/staging/linusw.git] /
1 From 8c85b83a8dc6c62fa20b87f2fe51b80a3bafc169 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Thu, 25 Mar 2021 18:34:50 +0000
4 Subject: [PATCH] staging/bcm2835-camera: Add support for H264 levels
5 4.1 and 4.2
6
7 Whilst the hardware can't achieve the limits of level 4.2 under
8 all situations, it can exceed level 4.0.
9
10 Allow selection of levels 4.1 and 4.2.
11
12 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
13 ---
14 .../vc04_services/bcm2835-camera/controls.c | 19 +++++++++++++++++--
15 1 file changed, 17 insertions(+), 2 deletions(-)
16
17 --- a/drivers/staging/vc04_services/bcm2835-camera/controls.c
18 +++ b/drivers/staging/vc04_services/bcm2835-camera/controls.c
19 @@ -709,6 +709,8 @@ static int ctrl_set_video_encode_profile
20 case V4L2_MPEG_VIDEO_H264_LEVEL_3_1:
21 case V4L2_MPEG_VIDEO_H264_LEVEL_3_2:
22 case V4L2_MPEG_VIDEO_H264_LEVEL_4_0:
23 + case V4L2_MPEG_VIDEO_H264_LEVEL_4_1:
24 + case V4L2_MPEG_VIDEO_H264_LEVEL_4_2:
25 dev->capture.enc_level = ctrl->val;
26 break;
27 default:
28 @@ -774,6 +776,17 @@ static int ctrl_set_video_encode_profile
29 case V4L2_MPEG_VIDEO_H264_LEVEL_4_0:
30 param.level = MMAL_VIDEO_LEVEL_H264_4;
31 break;
32 + /*
33 + * Note that the hardware spec is level 4.0. Achieving levels
34 + * above that depend on exactly the resolution and frame rate
35 + * being requested.
36 + */
37 + case V4L2_MPEG_VIDEO_H264_LEVEL_4_1:
38 + param.level = MMAL_VIDEO_LEVEL_H264_41;
39 + break;
40 + case V4L2_MPEG_VIDEO_H264_LEVEL_4_2:
41 + param.level = MMAL_VIDEO_LEVEL_H264_42;
42 + break;
43 default:
44 /* Should never get here */
45 break;
46 @@ -1224,8 +1237,10 @@ static const struct bm2835_mmal_v4l2_ctr
47 BIT(V4L2_MPEG_VIDEO_H264_LEVEL_3_0) |
48 BIT(V4L2_MPEG_VIDEO_H264_LEVEL_3_1) |
49 BIT(V4L2_MPEG_VIDEO_H264_LEVEL_3_2) |
50 - BIT(V4L2_MPEG_VIDEO_H264_LEVEL_4_0)),
51 - .max = V4L2_MPEG_VIDEO_H264_LEVEL_4_0,
52 + BIT(V4L2_MPEG_VIDEO_H264_LEVEL_4_0) |
53 + BIT(V4L2_MPEG_VIDEO_H264_LEVEL_4_1) |
54 + BIT(V4L2_MPEG_VIDEO_H264_LEVEL_4_2)),
55 + .max = V4L2_MPEG_VIDEO_H264_LEVEL_4_2,
56 .def = V4L2_MPEG_VIDEO_H264_LEVEL_4_0,
57 .step = 1,
58 .imenu = NULL,