diff mbox

[v3,1/3] videodev2.h, v4l2-ioctl: add IPU3 raw10 color format

Message ID 1497385036-1002-2-git-send-email-yong.zhi@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Zhi, Yong June 13, 2017, 8:17 p.m. UTC
Add IPU3 specific formats:

	V4L2_PIX_FMT_IPU3_SBGGR10
	V4L2_PIX_FMT_IPU3_SGBRG10
	V4L2_PIX_FMT_IPU3_SGRBG10
	V4L2_PIX_FMT_IPU3_SRGGB10

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
---
 drivers/media/v4l2-core/v4l2-ioctl.c | 4 ++++
 include/uapi/linux/videodev2.h       | 5 +++++
 2 files changed, 9 insertions(+)

Comments

Alan Cox June 14, 2017, 1:48 p.m. UTC | #1
On Tue, 13 Jun 2017 15:17:14 -0500
Yong Zhi <yong.zhi@intel.com> wrote:

> Add IPU3 specific formats:
> 
> 	V4L2_PIX_FMT_IPU3_SBGGR10
> 	V4L2_PIX_FMT_IPU3_SGBRG10
> 	V4L2_PIX_FMT_IPU3_SGRBG10
> 	V4L2_PIX_FMT_IPU3_SRGGB10

As I said before these are just more bitpacked bayer formats with no
reason to encode them as IPUv3 specific names.

Alan
Zhi, Yong June 14, 2017, 3:21 p.m. UTC | #2
> -----Original Message-----
> From: Alan Cox [mailto:gnomes@lxorguk.ukuu.org.uk]
> Sent: Wednesday, June 14, 2017 6:49 AM
> To: Zhi, Yong <yong.zhi@intel.com>
> Cc: linux-media@vger.kernel.org; sakari.ailus@linux.intel.com; Zheng, Jian
> Xu <jian.xu.zheng@intel.com>; tfiga@chromium.org; Mani, Rajmohan
> <rajmohan.mani@intel.com>; Toivonen, Tuukka
> <tuukka.toivonen@intel.com>; Yang, Hyungwoo
> <hyungwoo.yang@intel.com>; Mohandass, Divagar
> <divagar.mohandass@intel.com>
> Subject: Re: [PATCH v3 1/3] videodev2.h, v4l2-ioctl: add IPU3 raw10 color
> format
> 
> On Tue, 13 Jun 2017 15:17:14 -0500
> Yong Zhi <yong.zhi@intel.com> wrote:
> 
> > Add IPU3 specific formats:
> >
> > 	V4L2_PIX_FMT_IPU3_SBGGR10
> > 	V4L2_PIX_FMT_IPU3_SGBRG10
> > 	V4L2_PIX_FMT_IPU3_SGRBG10
> > 	V4L2_PIX_FMT_IPU3_SRGGB10
> 
> As I said before these are just more bitpacked bayer formats with no reason
> to encode them as IPUv3 specific names.
> 
> Alan

Ack, will update for next version.
Sakari Ailus June 14, 2017, 10:38 p.m. UTC | #3
On Wed, Jun 14, 2017 at 02:48:40PM +0100, Alan Cox wrote:
> On Tue, 13 Jun 2017 15:17:14 -0500
> Yong Zhi <yong.zhi@intel.com> wrote:
> 
> > Add IPU3 specific formats:
> > 
> > 	V4L2_PIX_FMT_IPU3_SBGGR10
> > 	V4L2_PIX_FMT_IPU3_SGBRG10
> > 	V4L2_PIX_FMT_IPU3_SGRBG10
> > 	V4L2_PIX_FMT_IPU3_SRGGB10
> 
> As I said before these are just more bitpacked bayer formats with no
> reason to encode them as IPUv3 specific names.

I must have missed that comment --- the format is pretty unusual still.
Basically it rams as much pixels into a 256-bit DMA word as there's room and
then leaves the rest of the DMA word empty (6 bits in this case).

The newer IPUs do not use this format AFAIK (they do use other unusual
formats though). I haven't seen such formats being used by other non-IPU
hardware either.

I think I'd keep this IPU specific unless there's an indication the same
formats might be used elsewhere. The other packed formats that have been
defined in V4L2 are hardware independent.

Cc Hans, too.
diff mbox

Patch

diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 4f27cfa..9de6ba0 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1202,6 +1202,10 @@  static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
 	case V4L2_PIX_FMT_SGBRG10P:	descr = "10-bit Bayer GBGB/RGRG Packed"; break;
 	case V4L2_PIX_FMT_SGRBG10P:	descr = "10-bit Bayer GRGR/BGBG Packed"; break;
 	case V4L2_PIX_FMT_SRGGB10P:	descr = "10-bit Bayer RGRG/GBGB Packed"; break;
+	case V4L2_PIX_FMT_IPU3_SBGGR10: descr = "10-bit bayer BGGR IPU3 Packed"; break;
+	case V4L2_PIX_FMT_IPU3_SGBRG10: descr = "10-bit bayer GBRG IPU3 Packed"; break;
+	case V4L2_PIX_FMT_IPU3_SGRBG10: descr = "10-bit bayer GRBG IPU3 Packed"; break;
+	case V4L2_PIX_FMT_IPU3_SRGGB10: descr = "10-bit bayer RGGB IPU3 Packed"; break;
 	case V4L2_PIX_FMT_SBGGR10ALAW8:	descr = "8-bit Bayer BGBG/GRGR (A-law)"; break;
 	case V4L2_PIX_FMT_SGBRG10ALAW8:	descr = "8-bit Bayer GBGB/RGRG (A-law)"; break;
 	case V4L2_PIX_FMT_SGRBG10ALAW8:	descr = "8-bit Bayer GRGR/BGBG (A-law)"; break;
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 2b8feb8..7bfa6ad 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -663,6 +663,11 @@  struct v4l2_pix_format {
 #define V4L2_PIX_FMT_MT21C    v4l2_fourcc('M', 'T', '2', '1') /* Mediatek compressed block mode  */
 #define V4L2_PIX_FMT_INZI     v4l2_fourcc('I', 'N', 'Z', 'I') /* Intel Planar Greyscale 10-bit and Depth 16-bit */
 
+#define V4L2_PIX_FMT_IPU3_SBGGR10	v4l2_fourcc('i', 'p', '3', 'b') /* IPU3 packed 10-bit BGGR bayer */
+#define V4L2_PIX_FMT_IPU3_SGBRG10	v4l2_fourcc('i', 'p', '3', 'g') /* IPU3 packed 10-bit GBRG bayer */
+#define V4L2_PIX_FMT_IPU3_SGRBG10	v4l2_fourcc('i', 'p', '3', 'G') /* IPU3 packed 10-bit GRBG bayer */
+#define V4L2_PIX_FMT_IPU3_SRGGB10	v4l2_fourcc('i', 'p', '3', 'r') /* IPU3 packed 10-bit RGGB bayer */
+
 /* SDR formats - used only for Software Defined Radio devices */
 #define V4L2_SDR_FMT_CU8          v4l2_fourcc('C', 'U', '0', '8') /* IQ u8 */
 #define V4L2_SDR_FMT_CU16LE       v4l2_fourcc('C', 'U', '1', '6') /* IQ u16le */