2df09e2f33b157e1371849fefd996dc23923a306
[openwrt/staging/noltari.git] /
1 From 9a021facd450a55231938131702cbc8b4e9c92e7 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Thu, 7 Jan 2021 11:37:10 +0000
4 Subject: [PATCH] staging/bcm2835-isp: 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-isp/bcm2835-isp-fmts.h | 127 ++++++++++++++++++
13 .../bcm2835-isp/bcm2835-v4l2-isp.c | 4 +-
14 2 files changed, 129 insertions(+), 2 deletions(-)
15
16 --- a/drivers/staging/vc04_services/bcm2835-isp/bcm2835-isp-fmts.h
17 +++ b/drivers/staging/vc04_services/bcm2835-isp/bcm2835-isp-fmts.h
18 @@ -298,6 +298,106 @@ static const struct bcm2835_isp_fmt supp
19 .colorspace = V4L2_COLORSPACE_RAW,
20 .step_size = 2,
21 }, {
22 + /* Bayer formats unpacked to 16bpp */
23 + /* 10 bit */
24 + .fourcc = V4L2_PIX_FMT_SRGGB10,
25 + .depth = 16,
26 + .bytesperline_align = 32,
27 + .mmal_fmt = MMAL_ENCODING_BAYER_SRGGB10,
28 + .size_multiplier_x2 = 2,
29 + .colorspace = V4L2_COLORSPACE_RAW,
30 + .step_size = 2,
31 + }, {
32 + .fourcc = V4L2_PIX_FMT_SBGGR10,
33 + .depth = 16,
34 + .bytesperline_align = 32,
35 + .mmal_fmt = MMAL_ENCODING_BAYER_SBGGR10,
36 + .size_multiplier_x2 = 2,
37 + .colorspace = V4L2_COLORSPACE_RAW,
38 + .step_size = 2,
39 + }, {
40 + .fourcc = V4L2_PIX_FMT_SGRBG10,
41 + .depth = 16,
42 + .bytesperline_align = 32,
43 + .mmal_fmt = MMAL_ENCODING_BAYER_SGRBG10,
44 + .size_multiplier_x2 = 2,
45 + .colorspace = V4L2_COLORSPACE_RAW,
46 + .step_size = 2,
47 + }, {
48 + .fourcc = V4L2_PIX_FMT_SGBRG10,
49 + .depth = 16,
50 + .bytesperline_align = 32,
51 + .mmal_fmt = MMAL_ENCODING_BAYER_SGBRG10,
52 + .size_multiplier_x2 = 2,
53 + .colorspace = V4L2_COLORSPACE_RAW,
54 + .step_size = 2,
55 + }, {
56 + /* 12 bit */
57 + .fourcc = V4L2_PIX_FMT_SRGGB12,
58 + .depth = 16,
59 + .bytesperline_align = 32,
60 + .mmal_fmt = MMAL_ENCODING_BAYER_SRGGB12,
61 + .size_multiplier_x2 = 2,
62 + .colorspace = V4L2_COLORSPACE_RAW,
63 + .step_size = 2,
64 + }, {
65 + .fourcc = V4L2_PIX_FMT_SBGGR12,
66 + .depth = 16,
67 + .bytesperline_align = 32,
68 + .mmal_fmt = MMAL_ENCODING_BAYER_SBGGR12,
69 + .size_multiplier_x2 = 2,
70 + .colorspace = V4L2_COLORSPACE_RAW,
71 + .step_size = 2,
72 + }, {
73 + .fourcc = V4L2_PIX_FMT_SGRBG12,
74 + .depth = 16,
75 + .bytesperline_align = 32,
76 + .mmal_fmt = MMAL_ENCODING_BAYER_SGRBG12,
77 + .size_multiplier_x2 = 2,
78 + .colorspace = V4L2_COLORSPACE_RAW,
79 + .step_size = 2,
80 + }, {
81 + .fourcc = V4L2_PIX_FMT_SGBRG12,
82 + .depth = 16,
83 + .bytesperline_align = 32,
84 + .mmal_fmt = MMAL_ENCODING_BAYER_SGBRG12,
85 + .size_multiplier_x2 = 2,
86 + .colorspace = V4L2_COLORSPACE_RAW,
87 + .step_size = 2,
88 + }, {
89 + /* 14 bit */
90 + .fourcc = V4L2_PIX_FMT_SRGGB14,
91 + .depth = 16,
92 + .bytesperline_align = 32,
93 + .mmal_fmt = MMAL_ENCODING_BAYER_SRGGB14,
94 + .size_multiplier_x2 = 2,
95 + .colorspace = V4L2_COLORSPACE_RAW,
96 + .step_size = 2,
97 + }, {
98 + .fourcc = V4L2_PIX_FMT_SBGGR14,
99 + .depth = 16,
100 + .bytesperline_align = 32,
101 + .mmal_fmt = MMAL_ENCODING_BAYER_SBGGR14,
102 + .size_multiplier_x2 = 2,
103 + .colorspace = V4L2_COLORSPACE_RAW,
104 + .step_size = 2,
105 + }, {
106 + .fourcc = V4L2_PIX_FMT_SGRBG14,
107 + .depth = 16,
108 + .bytesperline_align = 32,
109 + .mmal_fmt = MMAL_ENCODING_BAYER_SGRBG14,
110 + .size_multiplier_x2 = 2,
111 + .colorspace = V4L2_COLORSPACE_RAW,
112 + .step_size = 2,
113 + }, {
114 + .fourcc = V4L2_PIX_FMT_SGBRG14,
115 + .depth = 16,
116 + .bytesperline_align = 32,
117 + .mmal_fmt = MMAL_ENCODING_BAYER_SGBRG14,
118 + .size_multiplier_x2 = 2,
119 + .colorspace = V4L2_COLORSPACE_RAW,
120 + .step_size = 2,
121 + }, {
122 /* Monochrome MIPI formats */
123 /* 8 bit */
124 .fourcc = V4L2_PIX_FMT_GREY,
125 @@ -343,6 +443,33 @@ static const struct bcm2835_isp_fmt supp
126 .size_multiplier_x2 = 2,
127 .colorspace = V4L2_COLORSPACE_RAW,
128 .step_size = 2,
129 + }, {
130 + /* 10 bit as 16bpp */
131 + .fourcc = V4L2_PIX_FMT_Y10,
132 + .depth = 16,
133 + .bytesperline_align = 32,
134 + .mmal_fmt = MMAL_ENCODING_Y10,
135 + .size_multiplier_x2 = 2,
136 + .colorspace = V4L2_COLORSPACE_RAW,
137 + .step_size = 2,
138 + }, {
139 + /* 12 bit as 16bpp */
140 + .fourcc = V4L2_PIX_FMT_Y12,
141 + .depth = 16,
142 + .bytesperline_align = 32,
143 + .mmal_fmt = MMAL_ENCODING_Y12,
144 + .size_multiplier_x2 = 2,
145 + .colorspace = V4L2_COLORSPACE_RAW,
146 + .step_size = 2,
147 + }, {
148 + /* 14 bit as 16bpp */
149 + .fourcc = V4L2_PIX_FMT_Y14,
150 + .depth = 16,
151 + .bytesperline_align = 32,
152 + .mmal_fmt = MMAL_ENCODING_Y14,
153 + .size_multiplier_x2 = 2,
154 + .colorspace = V4L2_COLORSPACE_RAW,
155 + .step_size = 2,
156 }, {
157 .fourcc = V4L2_META_FMT_BCM2835_ISP_STATS,
158 .mmal_fmt = MMAL_ENCODING_BRCM_STATS,
159 --- a/drivers/staging/vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c
160 +++ b/drivers/staging/vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c
161 @@ -1146,11 +1146,11 @@ static const struct v4l2_ioctl_ops bcm28
162 * Size of the array to provide to the VPU when asking for the list of supported
163 * formats.
164 *
165 - * The ISP component currently advertises 44 input formats, so add a small
166 + * The ISP component currently advertises 62 input formats, so add a small
167 * overhead on that. Should the component advertise more formats then the excess
168 * will be dropped and a warning logged.
169 */
170 -#define MAX_SUPPORTED_ENCODINGS 50
171 +#define MAX_SUPPORTED_ENCODINGS 70
172
173 /* Populate node->supported_fmts with the formats supported by those ports. */
174 static int bcm2835_isp_get_supported_fmts(struct bcm2835_isp_node *node)