diff mbox

[07/15] media: staging/imx: add 10 bit bayer support

Message ID 20180419101812.30688-8-rui.silva@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Rui Miguel Silva April 19, 2018, 10:18 a.m. UTC
Some sensors can only output 10 bit bayer formats, like the OV2680. Add support
for that in imx-media.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
---
 drivers/staging/media/imx/imx-media-utils.c | 24 +++++++++++++++++++++
 1 file changed, 24 insertions(+)

Comments

Philipp Zabel April 19, 2018, 1:38 p.m. UTC | #1
On Thu, 2018-04-19 at 11:18 +0100, Rui Miguel Silva wrote:
> Some sensors can only output 10 bit bayer formats, like the OV2680. Add support
> for that in imx-media.
> 
> Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
> ---
>  drivers/staging/media/imx/imx-media-utils.c | 24 +++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c
> index fab98fc0d6a0..99527daba29a 100644
> --- a/drivers/staging/media/imx/imx-media-utils.c
> +++ b/drivers/staging/media/imx/imx-media-utils.c
> @@ -118,6 +118,30 @@ static const struct imx_media_pixfmt rgb_formats[] = {
>  		.cs     = IPUV3_COLORSPACE_RGB,
>  		.bpp    = 8,
>  		.bayer  = true,
> +	}, {
> +		.fourcc = V4L2_PIX_FMT_SBGGR10,
> +		.codes  = {MEDIA_BUS_FMT_SBGGR10_1X10},
> +		.cs     = IPUV3_COLORSPACE_RGB,
> +		.bpp    = 16,
> +		.bayer  = true,
> +	}, {
> +		.fourcc = V4L2_PIX_FMT_SGBRG10,
> +		.codes  = {MEDIA_BUS_FMT_SGBRG10_1X10},
> +		.cs     = IPUV3_COLORSPACE_RGB,
> +		.bpp    = 16,
> +		.bayer  = true,
> +	}, {
> +		.fourcc = V4L2_PIX_FMT_SGRBG10,
> +		.codes  = {MEDIA_BUS_FMT_SGRBG10_1X10},
> +		.cs     = IPUV3_COLORSPACE_RGB,
> +		.bpp    = 16,
> +		.bayer  = true,
> +	}, {
> +		.fourcc = V4L2_PIX_FMT_SRGGB10,
> +		.codes  = {MEDIA_BUS_FMT_SRGGB10_1X10},
> +		.cs     = IPUV3_COLORSPACE_RGB,
> +		.bpp    = 16,
> +		.bayer  = true,

This will break 10-bit bayer formats on i.MX6, which currently stores
them in memory expanded to 16-bit, as listed in the entries below:

>  	}, {
>  		.fourcc = V4L2_PIX_FMT_SBGGR16,
>  		.codes  = {

regards
Philipp
Rui Miguel Silva April 19, 2018, 2:20 p.m. UTC | #2
Hi Philip,
Thanks for the review.

On Thu 19 Apr 2018 at 13:38, Philipp Zabel wrote:
> On Thu, 2018-04-19 at 11:18 +0100, Rui Miguel Silva wrote:
>> Some sensors can only output 10 bit bayer formats, like the 
>> OV2680. Add support
>> for that in imx-media.
>> 
>> Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
>> ---
>>  drivers/staging/media/imx/imx-media-utils.c | 24 
>>  +++++++++++++++++++++
>>  1 file changed, 24 insertions(+)
>> 
>> diff --git a/drivers/staging/media/imx/imx-media-utils.c 
>> b/drivers/staging/media/imx/imx-media-utils.c
>> index fab98fc0d6a0..99527daba29a 100644
>> --- a/drivers/staging/media/imx/imx-media-utils.c
>> +++ b/drivers/staging/media/imx/imx-media-utils.c
>> @@ -118,6 +118,30 @@ static const struct imx_media_pixfmt 
>> rgb_formats[] = {
>>  		.cs     = IPUV3_COLORSPACE_RGB,
>>  		.bpp    = 8,
>>  		.bayer  = true,
>> +	}, {
>> +		.fourcc = V4L2_PIX_FMT_SBGGR10,
>> +		.codes  = {MEDIA_BUS_FMT_SBGGR10_1X10},
>> +		.cs     = IPUV3_COLORSPACE_RGB,
>> +		.bpp    = 16,
>> +		.bayer  = true,
>> +	}, {
>> +		.fourcc = V4L2_PIX_FMT_SGBRG10,
>> +		.codes  = {MEDIA_BUS_FMT_SGBRG10_1X10},
>> +		.cs     = IPUV3_COLORSPACE_RGB,
>> +		.bpp    = 16,
>> +		.bayer  = true,
>> +	}, {
>> +		.fourcc = V4L2_PIX_FMT_SGRBG10,
>> +		.codes  = {MEDIA_BUS_FMT_SGRBG10_1X10},
>> +		.cs     = IPUV3_COLORSPACE_RGB,
>> +		.bpp    = 16,
>> +		.bayer  = true,
>> +	}, {
>> +		.fourcc = V4L2_PIX_FMT_SRGGB10,
>> +		.codes  = {MEDIA_BUS_FMT_SRGGB10_1X10},
>> +		.cs     = IPUV3_COLORSPACE_RGB,
>> +		.bpp    = 16,
>> +		.bayer  = true,
>
> This will break 10-bit bayer formats on i.MX6, which currently 
> stores
> them in memory expanded to 16-bit, as listed in the entries 
> below:

Oh, I see... i.MX7 also store it expanded, I will change my code 
to use
the format array as it is for i.MX6.

Thanks,
---
Cheers,
	Rui
diff mbox

Patch

diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c
index fab98fc0d6a0..99527daba29a 100644
--- a/drivers/staging/media/imx/imx-media-utils.c
+++ b/drivers/staging/media/imx/imx-media-utils.c
@@ -118,6 +118,30 @@  static const struct imx_media_pixfmt rgb_formats[] = {
 		.cs     = IPUV3_COLORSPACE_RGB,
 		.bpp    = 8,
 		.bayer  = true,
+	}, {
+		.fourcc = V4L2_PIX_FMT_SBGGR10,
+		.codes  = {MEDIA_BUS_FMT_SBGGR10_1X10},
+		.cs     = IPUV3_COLORSPACE_RGB,
+		.bpp    = 16,
+		.bayer  = true,
+	}, {
+		.fourcc = V4L2_PIX_FMT_SGBRG10,
+		.codes  = {MEDIA_BUS_FMT_SGBRG10_1X10},
+		.cs     = IPUV3_COLORSPACE_RGB,
+		.bpp    = 16,
+		.bayer  = true,
+	}, {
+		.fourcc = V4L2_PIX_FMT_SGRBG10,
+		.codes  = {MEDIA_BUS_FMT_SGRBG10_1X10},
+		.cs     = IPUV3_COLORSPACE_RGB,
+		.bpp    = 16,
+		.bayer  = true,
+	}, {
+		.fourcc = V4L2_PIX_FMT_SRGGB10,
+		.codes  = {MEDIA_BUS_FMT_SRGGB10_1X10},
+		.cs     = IPUV3_COLORSPACE_RGB,
+		.bpp    = 16,
+		.bayer  = true,
 	}, {
 		.fourcc = V4L2_PIX_FMT_SBGGR16,
 		.codes  = {