media: mx3: Add support for missing video formats
Subsystems (5)
A message that is not in the archive (sent off-list or not yet received): [email protected]
RFC 1/1 media: mx3: Add support for missing video formats
Hi all,
This is an RFC for a patch completing full video capture support on i.MX3x.
It adds missing video formats and automatic format associations according to the underlying sensor capabilities.
It also fixes a spurious IPU interrupt issue that I have encountered on i.MX31 with earlier kernel versions. This might already have been fixed by some of the changes that occurred in the IPU driver since then, but I still have to test if my fix is still useful or not. Anyway, this should of course be split away to a separate patch.
This patch has been successfully tested with i.MX35 and MT9M131, as well as some not yet mainline OmniVision sensor drivers, using all sensor-and-SoC-supported formats.
This patch still has to be rebased against the latest kernel and refactored in the following way:
1. Media formats.
2. IPU formats.
3. IPU spurious interrupt fix (if still required).
4. mx3_camera formats.
Comments are welcome, especially regarding possible conflicts with other IPU users.
Best regards,
Beno?t
--- .../arch/arm/plat-mxc/include/mach/ipu.h | 16 +- .../drivers/dma/ipu/ipu_idmac.c | 241 ++++++++++++++--- .../drivers/media/video/mx3_camera.c | 264 +++++++++++++------ .../drivers/media/video/soc_mediabus.c | 276 ++++++++++++++------ .../include/linux/v4l2-mediabus.h | 11 +- .../include/media/soc_mediabus.h | 30 ++- 6 files changed, 626 insertions(+), 212 deletions(-)
arch/arm/plat-mxc/include/mach/ipu.h +9 -7
@@ -68,25 +68,27 @@ enum pixel_fmt {IPU_PIX_FMT_GENERIC ,IPU_PIX_FMT_RGB332 ,IPU_PIX_FMT_YUV420P , +IPU_PIX_FMT_YVU420P ,IPU_PIX_FMT_YUV422P , -IPU_PIX_FMT_YUV420P2 ,IPU_PIX_FMT_YVU422P ,/* 2 bytes */ +IPU_PIX_FMT_GENERIC_16 , +IPU_PIX_FMT_RGB444 , +IPU_PIX_FMT_RGB555 ,IPU_PIX_FMT_RGB565 , -IPU_PIX_FMT_RGB666 , -IPU_PIX_FMT_BGR666 , -IPU_PIX_FMT_YUYV ,IPU_PIX_FMT_UYVY ,/* 3 bytes */ -IPU_PIX_FMT_RGB24 , +IPU_PIX_FMT_BGR666 , +IPU_PIX_FMT_RGB666 ,IPU_PIX_FMT_BGR24 , +IPU_PIX_FMT_RGB24 ,/* 4 bytes */ IPU_PIX_FMT_GENERIC_32 , -IPU_PIX_FMT_RGB32 ,IPU_PIX_FMT_BGR32 , -IPU_PIX_FMT_ABGR32 , +IPU_PIX_FMT_RGB32 ,IPU_PIX_FMT_BGRA32 ,IPU_PIX_FMT_RGBA32 , + IPU_PIX_FMT_ABGR32, }; enum ipu_color_space {
drivers/dma/ipu/ipu_idmac.c +208 -33
359 lines not on this page · raw message
drivers/media/video/mx3_camera.c +182 -82
387 lines not on this page · raw message
drivers/media/video/soc_mediabus.c +192 -84
410 lines not on this page · raw message
include/linux/v4l2-mediabus.h +8 -3
@@ -37,7 +37,8 @@enum v4l2_mbus_pixelcode {V4L2_MBUS_FMT_FIXED =0x0001 , -/* RGB - next is 0x1009 */ +/* RGB - next is 0x100c */ +V4L2_MBUS_FMT_RGB332_1X8 =0x1009 ,V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE =0x1001 ,V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE =0x1002 ,V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE =0x1003 ,
@@ -46,8 +47,10 @@ enum v4l2_mbus_pixelcode {V4L2_MBUS_FMT_BGR565_2X8_LE =0x1006 ,V4L2_MBUS_FMT_RGB565_2X8_BE =0x1007 ,V4L2_MBUS_FMT_RGB565_2X8_LE =0x1008 , +V4L2_MBUS_FMT_RGB24_3X8_BE =0x100a , +V4L2_MBUS_FMT_RGB24_3X8_LE =0x100b , -/* YUV (including grey) - next is 0x2014 */ +/* YUV (including grey) - next is 0x2015 */ V4L2_MBUS_FMT_Y8_1X8 =0x2001 ,V4L2_MBUS_FMT_UYVY8_1_5X8 =0x2002 , V4L2_MBUS_FMT_VYUY8_1_5X8 = 0x2003,
@@ -65,10 +68,11 @@ enum v4l2_mbus_pixelcode {V4L2_MBUS_FMT_VYUY8_1X16 =0x2010 ,V4L2_MBUS_FMT_YUYV8_1X16 =0x2011 ,V4L2_MBUS_FMT_YVYU8_1X16 =0x2012 , +V4L2_MBUS_FMT_Y16_1X16 =0x2014 ,V4L2_MBUS_FMT_YUYV10_1X20 =0x200d ,V4L2_MBUS_FMT_YVYU10_1X20 =0x200e , -/* Bayer - next is 0x3015 */ +/* Bayer - next is 0x3016 */ V4L2_MBUS_FMT_SBGGR8_1X8 =0x3001 ,V4L2_MBUS_FMT_SGBRG8_1X8 =0x3013 , V4L2_MBUS_FMT_SGRBG8_1X8 = 0x3002,
@@ -89,6 +93,7 @@ enum v4l2_mbus_pixelcode {V4L2_MBUS_FMT_SGBRG12_1X12 =0x3010 ,V4L2_MBUS_FMT_SGRBG12_1X12 =0x3011 ,V4L2_MBUS_FMT_SRGGB12_1X12 =0x3012 , +V4L2_MBUS_FMT_SBGGR16_1X16 =0x3015 ,/* JPEG compressed formats - next is 0x4002 */ V4L2_MBUS_FMT_JPEG_1X8 = 0x4001,
include/media/soc_mediabus.h +27 -3
@@ -18,22 +18,46 @@* enum soc_mbus_packing - data packing types on the media-bus * @SOC_MBUS_PACKING_NONE: no packing, bit-for-bit transfer to RAM, one * sample represents one pixel +* @SOC_MBUS_PACKING_1X8_PADHI: 8 bits transferred in 1 8-bit sample, in the +* possibly incomplete byte high bits are padding +* @SOC_MBUS_PACKING_1X8_PADLO: as above, but low bits are padding +* @SOC_MBUS_PACKING_EXTEND8: sample width (e.g., 4 bits) has to be extended +* to 8 bits +* @SOC_MBUS_PACKING_1_5X8: used for packed YUV 4:2:0 formats, where 4 +* pixels occupy 6 bytes in RAM * @SOC_MBUS_PACKING_2X8_PADHI: 16 bits transferred in 2 8-bit samples, in the * possibly incomplete byte high bits are padding * @SOC_MBUS_PACKING_2X8_PADLO: as above, but low bits are padding * @SOC_MBUS_PACKING_EXTEND16: sample width (e.g., 10 bits) has to be extended * to 16 bits +* @SOC_MBUS_PACKING_3X8_PADHI: 24 bits transferred in 3 8-bit samples, in the +* possibly incomplete byte high bits are padding +* @SOC_MBUS_PACKING_3X8_PADLO: as above, but low bits are padding +* @SOC_MBUS_PACKING_EXTEND24: sample width (e.g., 10 bits) has to be extended +* to 24 bits +* @SOC_MBUS_PACKING_4X8_PADHI: 32 bits transferred in 4 8-bit samples, in the +* possibly incomplete byte high bits are padding +* @SOC_MBUS_PACKING_4X8_PADLO: as above, but low bits are padding +* @SOC_MBUS_PACKING_EXTEND32: sample width (e.g., 10 bits) has to be extended +* to 32 bits * @SOC_MBUS_PACKING_VARIABLE: compressed formats with variable packing -* @SOC_MBUS_PACKING_1_5X8: used for packed YUV 4:2:0 formats, where 4 -* pixels occupy 6 bytes in RAM */ enum soc_mbus_packing {SOC_MBUS_PACKING_NONE , +SOC_MBUS_PACKING_1X8_PADHI , +SOC_MBUS_PACKING_1X8_PADLO , +SOC_MBUS_PACKING_EXTEND8 , +SOC_MBUS_PACKING_1_5X8 ,SOC_MBUS_PACKING_2X8_PADHI ,SOC_MBUS_PACKING_2X8_PADLO ,SOC_MBUS_PACKING_EXTEND16 , +SOC_MBUS_PACKING_3X8_PADHI , +SOC_MBUS_PACKING_3X8_PADLO , +SOC_MBUS_PACKING_EXTEND24 , +SOC_MBUS_PACKING_4X8_PADHI , +SOC_MBUS_PACKING_4X8_PADLO , +SOC_MBUS_PACKING_EXTEND32 ,SOC_MBUS_PACKING_VARIABLE , -SOC_MBUS_PACKING_1_5X8 , };/**
Hi Benoît,
Quoted 35 lines · On Wednesday 17 October 2012 14:41:24 Benoît Thébaudeau wrote:
Hi all,
This is an RFC for a patch completing full video capture support on i.MX3x.
It adds missing video formats and automatic format associations according to the underlying sensor capabilities.
It also fixes a spurious IPU interrupt issue that I have encountered on i.MX31 with earlier kernel versions. This might already have been fixed by some of the changes that occurred in the IPU driver since then, but I still have to test if my fix is still useful or not. Anyway, this should of course be split away to a separate patch.
This patch has been successfully tested with i.MX35 and MT9M131, as well as some not yet mainline OmniVision sensor drivers, using all sensor-and-SoC-supported formats.
This patch still has to be rebased against the latest kernel and refactored in the following way:
1. Media formats.
2. IPU formats.
3. IPU spurious interrupt fix (if still required).
4.mx3_cameraformats.Comments are welcome, especially regarding possible conflicts with other IPU users.
Best regards,
BenoîtCc Mauro Carvalho Chehab <[email protected]>Cc <[email protected]>Cc Sascha Hauer <[email protected]>Cc <[email protected]>Signed-off-by Benoît Thébaudeau <[email protected]>
Quoted 7 lines
--- .../arch/arm/plat-mxc/include/mach/ipu.h | 16 +- .../drivers/dma/ipu/ipu_idmac.c | 241 ++++++++++++++--- .../drivers/media/video/mx3_camera.c | 264 +++++++++++------ .../drivers/media/video/soc_mediabus.c | 276 ++++++++++++----- .../include/linux/v4l2-mediabus.h | 11 +- .../include/media/soc_mediabus.h | 30 ++-
Could you please split this patch in 3 patches ? The first one should add the missing formats in include/linux/v4l2-mediabus.h, the second one in drivers/media/video/soc_mediabus.c and include/media/soc_mediabus.h, and the third one would include the mx3 changes. That will make review easier.
Please also update Documentation/DocBook/media/v4l/subdev-formats.xml with a description of the new media bus formats.
Quoted 1 line
6 files changed, 626 insertions(+), 212 deletions(-)
[snip]
Quoted 15 lines
(quoted diff) +0
-0
linux-3.4.5/include/linux/v4l2-mediabus.hindex 5ea7f75..57a9fc9 100644include/linux/v4l2-mediabus.h +2
-1@@ -37,7 +37,8 @@enum v4l2_mbus_pixelcode {V4L2_MBUS_FMT_FIXED =0x0001 , -/* RGB - next is 0x1009 */ +/* RGB - next is 0x100c */ +V4L2_MBUS_FMT_RGB332_1X8 =0x1009 ,V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE =0x1001 ,V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE =0x1002 ,V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE =0x1003 ,
include/linux/v4l2-mediabus.h enum v4l2_mbus_pixelcode { · line 51
Quoted 5 lines
include/linux/v4l2-mediabus.h +2
-0@@ -46,8 +47,10 @@ enum v4l2_mbus_pixelcode {V4L2_MBUS_FMT_BGR565_2X8_LE =0x1006 ,V4L2_MBUS_FMT_RGB565_2X8_BE =0x1007 ,V4L2_MBUS_FMT_RGB565_2X8_LE =0x1008 , +V4L2_MBUS_FMT_RGB24_3X8_BE =0x100a , + V4L2_MBUS_FMT_RGB24_3X8_LE = 0x100b,
I think I would call those V4L2_MBUS_FMT_RGB24_3X8 and V4L2_MBUS_FMT_BGR24_3X8 instead.
Quoted 19 lines
include/linux/v4l2-mediabus.h +3
-2-/* YUV (including grey) - next is 0x2014 */ +/* YUV (including grey) - next is 0x2015 */ V4L2_MBUS_FMT_Y8_1X8 =0x2001 ,V4L2_MBUS_FMT_UYVY8_1_5X8 =0x2002 , V4L2_MBUS_FMT_VYUY8_1_5X8 = 0x2003,@@ -65,10 +68,11 @@ enum v4l2_mbus_pixelcode {V4L2_MBUS_FMT_VYUY8_1X16 =0x2010 ,V4L2_MBUS_FMT_YUYV8_1X16 =0x2011 ,V4L2_MBUS_FMT_YVYU8_1X16 =0x2012 , +V4L2_MBUS_FMT_Y16_1X16 =0x2014 ,V4L2_MBUS_FMT_YUYV10_1X20 =0x200d ,V4L2_MBUS_FMT_YVYU10_1X20 =0x200e , -/* Bayer - next is 0x3015 */ +/* Bayer - next is 0x3016 */ V4L2_MBUS_FMT_SBGGR8_1X8 =0x3001 ,V4L2_MBUS_FMT_SGBRG8_1X8 =0x3013 , V4L2_MBUS_FMT_SGRBG8_1X8 = 0x3002,
include/linux/v4l2-mediabus.h enum v4l2_mbus_pixelcode { · line 96
Quoted 4 lines
include/linux/v4l2-mediabus.h +1
-0@@ -89,6 +93,7 @@ enum v4l2_mbus_pixelcode {V4L2_MBUS_FMT_SGBRG12_1X12 =0x3010 ,V4L2_MBUS_FMT_SGRBG12_1X12 =0x3011 ,V4L2_MBUS_FMT_SRGGB12_1X12 =0x3012 , + V4L2_MBUS_FMT_SBGGR16_1X16 = 0x3015,
What about the other 3 Bayer patterns ?
Quoted 2 lines
include/linux/v4l2-mediabus.h +0
-0/* JPEG compressed formats - next is 0x4002 */ V4L2_MBUS_FMT_JPEG_1X8 = 0x4001,
Signature · 3 lines
Regards, Laurent Pinchart