aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-4.19/950-0309-staging-bcm2835_codec-Add-an-option-for-ignoring-Bay.patch
blob: fcdcc4ab4821f72138390fb3b8056a9537f1451f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
From a126fcc4ff38718e2e714fbb78db3ca1c4f8e564 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.org>
Date: Fri, 15 Feb 2019 11:36:14 +0000
Subject: [PATCH] staging: bcm2835_codec: Add an option for ignoring
 Bayer formats.

This is a workaround for GStreamer currently not identifying Bayer
as a raw format, therefore any device that supports it does not
match the criteria for v4l2convert.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
---
 .../bcm2835-codec/bcm2835-v4l2-codec.c        | 29 ++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

--- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
+++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
@@ -58,6 +58,15 @@ static int isp_video_nr = 12;
 module_param(isp_video_nr, int, 0644);
 MODULE_PARM_DESC(isp_video_nr, "isp video device number");
 
+/*
+ * Workaround for GStreamer v4l2convert component not considering Bayer formats
+ * as raw, and therefore not considering a V4L2 device that supports them as
+ * as a suitable candidate.
+ */
+static bool disable_bayer;
+module_param(disable_bayer, bool, 0644);
+MODULE_PARM_DESC(disable_bayer, "Disable support for Bayer formats");
+
 static unsigned int debug;
 module_param(debug, uint, 0644);
 MODULE_PARM_DESC(debug, "activates debug info (0-3)");
@@ -105,6 +114,7 @@ struct bcm2835_codec_fmt {
 	u32	flags;
 	u32	mmal_fmt;
 	int	size_multiplier_x2;
+	bool	is_bayer;
 };
 
 static const struct bcm2835_codec_fmt supported_formats[] = {
@@ -203,6 +213,7 @@ static const struct bcm2835_codec_fmt su
 		.flags			= 0,
 		.mmal_fmt		= MMAL_ENCODING_BAYER_SRGGB8,
 		.size_multiplier_x2	= 2,
+		.is_bayer		= true,
 	}, {
 		.fourcc			= V4L2_PIX_FMT_SBGGR8,
 		.depth			= 8,
@@ -210,6 +221,7 @@ static const struct bcm2835_codec_fmt su
 		.flags			= 0,
 		.mmal_fmt		= MMAL_ENCODING_BAYER_SBGGR8,
 		.size_multiplier_x2	= 2,
+		.is_bayer		= true,
 	}, {
 		.fourcc			= V4L2_PIX_FMT_SGRBG8,
 		.depth			= 8,
@@ -217,6 +229,7 @@ static const struct bcm2835_codec_fmt su
 		.flags			= 0,
 		.mmal_fmt		= MMAL_ENCODING_BAYER_SGRBG8,
 		.size_multiplier_x2	= 2,
+		.is_bayer		= true,
 	}, {
 		.fourcc			= V4L2_PIX_FMT_SGBRG8,
 		.depth			= 8,
@@ -224,6 +237,7 @@ static const struct bcm2835_codec_fmt su
 		.flags			= 0,
 		.mmal_fmt		= MMAL_ENCODING_BAYER_SGBRG8,
 		.size_multiplier_x2	= 2,
+		.is_bayer		= true,
 	}, {
 		/* 10 bit */
 		.fourcc			= V4L2_PIX_FMT_SRGGB10P,
@@ -232,6 +246,7 @@ static const struct bcm2835_codec_fmt su
 		.flags			= 0,
 		.mmal_fmt		= MMAL_ENCODING_BAYER_SRGGB10P,
 		.size_multiplier_x2	= 2,
+		.is_bayer		= true,
 	}, {
 		.fourcc			= V4L2_PIX_FMT_SBGGR10P,
 		.depth			= 10,
@@ -239,6 +254,7 @@ static const struct bcm2835_codec_fmt su
 		.flags			= 0,
 		.mmal_fmt		= MMAL_ENCODING_BAYER_SBGGR10P,
 		.size_multiplier_x2	= 2,
+		.is_bayer		= true,
 	}, {
 		.fourcc			= V4L2_PIX_FMT_SGRBG10P,
 		.depth			= 10,
@@ -246,6 +262,7 @@ static const struct bcm2835_codec_fmt su
 		.flags			= 0,
 		.mmal_fmt		= MMAL_ENCODING_BAYER_SGRBG10P,
 		.size_multiplier_x2	= 2,
+		.is_bayer		= true,
 	}, {
 		.fourcc			= V4L2_PIX_FMT_SGBRG10P,
 		.depth			= 10,
@@ -253,6 +270,7 @@ static const struct bcm2835_codec_fmt su
 		.flags			= 0,
 		.mmal_fmt		= MMAL_ENCODING_BAYER_SGBRG10P,
 		.size_multiplier_x2	= 2,
+		.is_bayer		= true,
 	}, {
 		/* 12 bit */
 		.fourcc			= V4L2_PIX_FMT_SRGGB12P,
@@ -261,6 +279,7 @@ static const struct bcm2835_codec_fmt su
 		.flags			= 0,
 		.mmal_fmt		= MMAL_ENCODING_BAYER_SRGGB12P,
 		.size_multiplier_x2	= 2,
+		.is_bayer		= true,
 	}, {
 		.fourcc			= V4L2_PIX_FMT_SBGGR12P,
 		.depth			= 12,
@@ -268,6 +287,7 @@ static const struct bcm2835_codec_fmt su
 		.flags			= 0,
 		.mmal_fmt		= MMAL_ENCODING_BAYER_SBGGR12P,
 		.size_multiplier_x2	= 2,
+		.is_bayer		= true,
 	}, {
 		.fourcc			= V4L2_PIX_FMT_SGRBG12P,
 		.depth			= 12,
@@ -275,6 +295,7 @@ static const struct bcm2835_codec_fmt su
 		.flags			= 0,
 		.mmal_fmt		= MMAL_ENCODING_BAYER_SGRBG12P,
 		.size_multiplier_x2	= 2,
+		.is_bayer		= true,
 	}, {
 		.fourcc			= V4L2_PIX_FMT_SGBRG12P,
 		.depth			= 12,
@@ -282,6 +303,7 @@ static const struct bcm2835_codec_fmt su
 		.flags			= 0,
 		.mmal_fmt		= MMAL_ENCODING_BAYER_SGBRG12P,
 		.size_multiplier_x2	= 2,
+		.is_bayer		= true,
 	}, {
 		/* 16 bit */
 		.fourcc			= V4L2_PIX_FMT_SRGGB16,
@@ -290,6 +312,7 @@ static const struct bcm2835_codec_fmt su
 		.flags			= 0,
 		.mmal_fmt		= MMAL_ENCODING_BAYER_SRGGB16,
 		.size_multiplier_x2	= 2,
+		.is_bayer		= true,
 	}, {
 		.fourcc			= V4L2_PIX_FMT_SBGGR16,
 		.depth			= 16,
@@ -297,6 +320,7 @@ static const struct bcm2835_codec_fmt su
 		.flags			= 0,
 		.mmal_fmt		= MMAL_ENCODING_BAYER_SBGGR16,
 		.size_multiplier_x2	= 2,
+		.is_bayer		= true,
 	}, {
 		.fourcc			= V4L2_PIX_FMT_SGRBG16,
 		.depth			= 16,
@@ -304,6 +328,7 @@ static const struct bcm2835_codec_fmt su
 		.flags			= 0,
 		.mmal_fmt		= MMAL_ENCODING_BAYER_SGRBG16,
 		.size_multiplier_x2	= 2,
+		.is_bayer		= true,
 	}, {
 		.fourcc			= V4L2_PIX_FMT_SGBRG16,
 		.depth			= 16,
@@ -311,6 +336,7 @@ static const struct bcm2835_codec_fmt su
 		.flags			= 0,
 		.mmal_fmt		= MMAL_ENCODING_BAYER_SGBRG16,
 		.size_multiplier_x2	= 2,
+		.is_bayer		= true,
 	}, {
 		/* Compressed formats */
 		.fourcc			= V4L2_PIX_FMT_H264,
@@ -438,7 +464,8 @@ static const struct bcm2835_codec_fmt *g
 	unsigned int i;
 
 	for (i = 0; i < ARRAY_SIZE(supported_formats); i++) {
-		if (supported_formats[i].mmal_fmt == mmal_fmt)
+		if (supported_formats[i].mmal_fmt == mmal_fmt &&
+		    (!disable_bayer || !supported_formats[i].is_bayer))
 			return &supported_formats[i];
 	}
 	return NULL;