1 From 262f0a84a1d213c703c4f527d569687bec912fe4 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Fri, 15 Feb 2019 11:36:14 +0000
4 Subject: [PATCH 360/725] staging: bcm2835_codec: Add an option for ignoring
7 This is a workaround for GStreamer currently not identifying Bayer
8 as a raw format, therefore any device that supports it does not
9 match the criteria for v4l2convert.
11 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
13 .../bcm2835-codec/bcm2835-v4l2-codec.c | 29 ++++++++++++++++++-
14 1 file changed, 28 insertions(+), 1 deletion(-)
16 --- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
17 +++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
18 @@ -58,6 +58,15 @@ static int isp_video_nr = 12;
19 module_param(isp_video_nr, int, 0644);
20 MODULE_PARM_DESC(isp_video_nr, "isp video device number");
23 + * Workaround for GStreamer v4l2convert component not considering Bayer formats
24 + * as raw, and therefore not considering a V4L2 device that supports them as
25 + * as a suitable candidate.
27 +static bool disable_bayer;
28 +module_param(disable_bayer, bool, 0644);
29 +MODULE_PARM_DESC(disable_bayer, "Disable support for Bayer formats");
31 static unsigned int debug;
32 module_param(debug, uint, 0644);
33 MODULE_PARM_DESC(debug, "activates debug info (0-3)");
34 @@ -105,6 +114,7 @@ struct bcm2835_codec_fmt {
37 int size_multiplier_x2;
41 static const struct bcm2835_codec_fmt supported_formats[] = {
42 @@ -203,6 +213,7 @@ static const struct bcm2835_codec_fmt su
44 .mmal_fmt = MMAL_ENCODING_BAYER_SRGGB8,
45 .size_multiplier_x2 = 2,
48 .fourcc = V4L2_PIX_FMT_SBGGR8,
50 @@ -210,6 +221,7 @@ static const struct bcm2835_codec_fmt su
52 .mmal_fmt = MMAL_ENCODING_BAYER_SBGGR8,
53 .size_multiplier_x2 = 2,
56 .fourcc = V4L2_PIX_FMT_SGRBG8,
58 @@ -217,6 +229,7 @@ static const struct bcm2835_codec_fmt su
60 .mmal_fmt = MMAL_ENCODING_BAYER_SGRBG8,
61 .size_multiplier_x2 = 2,
64 .fourcc = V4L2_PIX_FMT_SGBRG8,
66 @@ -224,6 +237,7 @@ static const struct bcm2835_codec_fmt su
68 .mmal_fmt = MMAL_ENCODING_BAYER_SGBRG8,
69 .size_multiplier_x2 = 2,
73 .fourcc = V4L2_PIX_FMT_SRGGB10P,
74 @@ -232,6 +246,7 @@ static const struct bcm2835_codec_fmt su
76 .mmal_fmt = MMAL_ENCODING_BAYER_SRGGB10P,
77 .size_multiplier_x2 = 2,
80 .fourcc = V4L2_PIX_FMT_SBGGR10P,
82 @@ -239,6 +254,7 @@ static const struct bcm2835_codec_fmt su
84 .mmal_fmt = MMAL_ENCODING_BAYER_SBGGR10P,
85 .size_multiplier_x2 = 2,
88 .fourcc = V4L2_PIX_FMT_SGRBG10P,
90 @@ -246,6 +262,7 @@ static const struct bcm2835_codec_fmt su
92 .mmal_fmt = MMAL_ENCODING_BAYER_SGRBG10P,
93 .size_multiplier_x2 = 2,
96 .fourcc = V4L2_PIX_FMT_SGBRG10P,
98 @@ -253,6 +270,7 @@ static const struct bcm2835_codec_fmt su
100 .mmal_fmt = MMAL_ENCODING_BAYER_SGBRG10P,
101 .size_multiplier_x2 = 2,
105 .fourcc = V4L2_PIX_FMT_SRGGB12P,
106 @@ -261,6 +279,7 @@ static const struct bcm2835_codec_fmt su
108 .mmal_fmt = MMAL_ENCODING_BAYER_SRGGB12P,
109 .size_multiplier_x2 = 2,
112 .fourcc = V4L2_PIX_FMT_SBGGR12P,
114 @@ -268,6 +287,7 @@ static const struct bcm2835_codec_fmt su
116 .mmal_fmt = MMAL_ENCODING_BAYER_SBGGR12P,
117 .size_multiplier_x2 = 2,
120 .fourcc = V4L2_PIX_FMT_SGRBG12P,
122 @@ -275,6 +295,7 @@ static const struct bcm2835_codec_fmt su
124 .mmal_fmt = MMAL_ENCODING_BAYER_SGRBG12P,
125 .size_multiplier_x2 = 2,
128 .fourcc = V4L2_PIX_FMT_SGBRG12P,
130 @@ -282,6 +303,7 @@ static const struct bcm2835_codec_fmt su
132 .mmal_fmt = MMAL_ENCODING_BAYER_SGBRG12P,
133 .size_multiplier_x2 = 2,
137 .fourcc = V4L2_PIX_FMT_SRGGB16,
138 @@ -290,6 +312,7 @@ static const struct bcm2835_codec_fmt su
140 .mmal_fmt = MMAL_ENCODING_BAYER_SRGGB16,
141 .size_multiplier_x2 = 2,
144 .fourcc = V4L2_PIX_FMT_SBGGR16,
146 @@ -297,6 +320,7 @@ static const struct bcm2835_codec_fmt su
148 .mmal_fmt = MMAL_ENCODING_BAYER_SBGGR16,
149 .size_multiplier_x2 = 2,
152 .fourcc = V4L2_PIX_FMT_SGRBG16,
154 @@ -304,6 +328,7 @@ static const struct bcm2835_codec_fmt su
156 .mmal_fmt = MMAL_ENCODING_BAYER_SGRBG16,
157 .size_multiplier_x2 = 2,
160 .fourcc = V4L2_PIX_FMT_SGBRG16,
162 @@ -311,6 +336,7 @@ static const struct bcm2835_codec_fmt su
164 .mmal_fmt = MMAL_ENCODING_BAYER_SGBRG16,
165 .size_multiplier_x2 = 2,
168 /* Compressed formats */
169 .fourcc = V4L2_PIX_FMT_H264,
170 @@ -438,7 +464,8 @@ static const struct bcm2835_codec_fmt *g
173 for (i = 0; i < ARRAY_SIZE(supported_formats); i++) {
174 - if (supported_formats[i].mmal_fmt == mmal_fmt)
175 + if (supported_formats[i].mmal_fmt == mmal_fmt &&
176 + (!disable_bayer || !supported_formats[i].is_bayer))
177 return &supported_formats[i];