221b01db03885682f67b9649f9793926771e90d7
[openwrt/staging/linusw.git] /
1 From 0bc0dd69488ae3e0ef593596586d84639b93bf4d Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Thu, 7 Jan 2021 10:45:16 +0000
4 Subject: [PATCH] staging/bcm2835-codec: Add the unpacked (16bpp) raw
5 formats
6
7 Now that the firmware supports the unpacked (16bpp) variants
8 of the MIPI raw formats, add the mappings.
9
10 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
11 ---
12 .../bcm2835-codec/bcm2835-v4l2-codec.c | 128 +++++++++++++++++-
13 1 file changed, 126 insertions(+), 2 deletions(-)
14
15 --- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
16 +++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
17 @@ -381,6 +381,106 @@ static const struct bcm2835_codec_fmt su
18 .size_multiplier_x2 = 2,
19 .is_bayer = true,
20 }, {
21 + /* Bayer formats unpacked to 16bpp */
22 + /* 10 bit */
23 + .fourcc = V4L2_PIX_FMT_SRGGB10,
24 + .depth = 16,
25 + .bytesperline_align = 32,
26 + .flags = 0,
27 + .mmal_fmt = MMAL_ENCODING_BAYER_SRGGB10,
28 + .size_multiplier_x2 = 2,
29 + .is_bayer = true,
30 + }, {
31 + .fourcc = V4L2_PIX_FMT_SBGGR10,
32 + .depth = 16,
33 + .bytesperline_align = 32,
34 + .flags = 0,
35 + .mmal_fmt = MMAL_ENCODING_BAYER_SBGGR10,
36 + .size_multiplier_x2 = 2,
37 + .is_bayer = true,
38 + }, {
39 + .fourcc = V4L2_PIX_FMT_SGRBG10,
40 + .depth = 16,
41 + .bytesperline_align = 32,
42 + .flags = 0,
43 + .mmal_fmt = MMAL_ENCODING_BAYER_SGRBG10,
44 + .size_multiplier_x2 = 2,
45 + .is_bayer = true,
46 + }, {
47 + .fourcc = V4L2_PIX_FMT_SGBRG10,
48 + .depth = 16,
49 + .bytesperline_align = 32,
50 + .flags = 0,
51 + .mmal_fmt = MMAL_ENCODING_BAYER_SGBRG10,
52 + .size_multiplier_x2 = 2,
53 + .is_bayer = true,
54 + }, {
55 + /* 12 bit */
56 + .fourcc = V4L2_PIX_FMT_SRGGB12,
57 + .depth = 16,
58 + .bytesperline_align = 32,
59 + .flags = 0,
60 + .mmal_fmt = MMAL_ENCODING_BAYER_SRGGB12,
61 + .size_multiplier_x2 = 2,
62 + .is_bayer = true,
63 + }, {
64 + .fourcc = V4L2_PIX_FMT_SBGGR12,
65 + .depth = 16,
66 + .bytesperline_align = 32,
67 + .flags = 0,
68 + .mmal_fmt = MMAL_ENCODING_BAYER_SBGGR12,
69 + .size_multiplier_x2 = 2,
70 + .is_bayer = true,
71 + }, {
72 + .fourcc = V4L2_PIX_FMT_SGRBG12,
73 + .depth = 16,
74 + .bytesperline_align = 32,
75 + .flags = 0,
76 + .mmal_fmt = MMAL_ENCODING_BAYER_SGRBG12,
77 + .size_multiplier_x2 = 2,
78 + .is_bayer = true,
79 + }, {
80 + .fourcc = V4L2_PIX_FMT_SGBRG12,
81 + .depth = 16,
82 + .bytesperline_align = 32,
83 + .flags = 0,
84 + .mmal_fmt = MMAL_ENCODING_BAYER_SGBRG12,
85 + .size_multiplier_x2 = 2,
86 + .is_bayer = true,
87 + }, {
88 + /* 14 bit */
89 + .fourcc = V4L2_PIX_FMT_SRGGB14,
90 + .depth = 16,
91 + .bytesperline_align = 32,
92 + .flags = 0,
93 + .mmal_fmt = MMAL_ENCODING_BAYER_SRGGB14,
94 + .size_multiplier_x2 = 2,
95 + .is_bayer = true,
96 + }, {
97 + .fourcc = V4L2_PIX_FMT_SBGGR14,
98 + .depth = 16,
99 + .bytesperline_align = 32,
100 + .flags = 0,
101 + .mmal_fmt = MMAL_ENCODING_BAYER_SBGGR14,
102 + .size_multiplier_x2 = 2,
103 + .is_bayer = true,
104 + }, {
105 + .fourcc = V4L2_PIX_FMT_SGRBG14,
106 + .depth = 16,
107 + .bytesperline_align = 32,
108 + .flags = 0,
109 + .mmal_fmt = MMAL_ENCODING_BAYER_SGRBG14,
110 + .size_multiplier_x2 = 2,
111 + .is_bayer = true,
112 + }, {
113 + .fourcc = V4L2_PIX_FMT_SGBRG14,
114 + .depth = 16,
115 + .bytesperline_align = 32,
116 + .flags = 0,
117 + .mmal_fmt = MMAL_ENCODING_BAYER_SGBRG14,
118 + .size_multiplier_x2 = 2,
119 + .is_bayer = true,
120 + }, {
121 /* Monochrome MIPI formats */
122 /* 8 bit */
123 .fourcc = V4L2_PIX_FMT_GREY,
124 @@ -422,6 +522,30 @@ static const struct bcm2835_codec_fmt su
125 .mmal_fmt = MMAL_ENCODING_Y16,
126 .size_multiplier_x2 = 2,
127 }, {
128 + /* 10 bit as 16bpp */
129 + .fourcc = V4L2_PIX_FMT_Y10,
130 + .depth = 16,
131 + .bytesperline_align = 32,
132 + .flags = 0,
133 + .mmal_fmt = MMAL_ENCODING_Y10,
134 + .size_multiplier_x2 = 2,
135 + }, {
136 + /* 12 bit as 16bpp */
137 + .fourcc = V4L2_PIX_FMT_Y12,
138 + .depth = 16,
139 + .bytesperline_align = 32,
140 + .flags = 0,
141 + .mmal_fmt = MMAL_ENCODING_Y12,
142 + .size_multiplier_x2 = 2,
143 + }, {
144 + /* 14 bit as 16bpp */
145 + .fourcc = V4L2_PIX_FMT_Y14,
146 + .depth = 16,
147 + .bytesperline_align = 32,
148 + .flags = 0,
149 + .mmal_fmt = MMAL_ENCODING_Y14,
150 + .size_multiplier_x2 = 2,
151 + }, {
152 /* Compressed formats */
153 .fourcc = V4L2_PIX_FMT_H264,
154 .depth = 0,
155 @@ -2681,10 +2805,10 @@ static const struct v4l2_m2m_ops m2m_ops
156
157 /* Size of the array to provide to the VPU when asking for the list of supported
158 * formats.
159 - * The ISP component currently advertises 44 input formats, so add a small
160 + * The ISP component currently advertises 62 input formats, so add a small
161 * overhead on that.
162 */
163 -#define MAX_SUPPORTED_ENCODINGS 50
164 +#define MAX_SUPPORTED_ENCODINGS 70
165
166 /* Populate dev->supported_fmts with the formats supported by those ports. */
167 static int bcm2835_codec_get_supported_fmts(struct bcm2835_codec_dev *dev)