Skip to contentSkip to conversation

v4l: xilinx: dma: Update video format descriptor

PATCH Superseded Satish Kumar Nagireddy 2 participants 2 messages Feb 15, 2018 – Feb 16, 2018

Subsystems (3)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 6/9 v4l: xilinx: dma: Update video format descriptor

This patch updates video format descriptor to help information viz., number of planes per color format and chroma sub sampling factors.

This commit adds the various 8-bit and 10-bit that are supported to the table queried by drivers.

---
 drivers/media/platform/xilinx/xilinx-vip.c | 18 ++++++++++--------
 drivers/media/platform/xilinx/xilinx-vip.h | 11 ++++++++++-
 2 files changed, 20 insertions(+), 9 deletions(-)
drivers/media/platform/xilinx/xilinx-vip.c +10 -8
index d306f44..51b7ef6 100644
@@ -27,22 +27,24 @@
  */
 
 static const struct xvip_video_format xvip_video_formats[] = {
+       { XVIP_VF_YUV_420, 10, NULL, MEDIA_BUS_FMT_VYYUYY8_1X24,
+         1, 15, V4L2_PIX_FMT_XV15M, 2, 2, 1, 2, "4:2:0, 10-bit 2-plane non-cont" },
        { XVIP_VF_YUV_422, 8, NULL, MEDIA_BUS_FMT_UYVY8_1X16,
-         2, V4L2_PIX_FMT_YUYV, "4:2:2, packed, YUYV" },
+         2, 16, V4L2_PIX_FMT_YUYV, 1, 1, 2, 1, "4:2:2, packed, YUYV" },
        { XVIP_VF_YUV_444, 8, NULL, MEDIA_BUS_FMT_VUY8_1X24,
-         3, V4L2_PIX_FMT_YUV444, "4:4:4, packed, YUYV" },
+         3, 24, V4L2_PIX_FMT_VUY24, 1, 1, 1, 1, "4:4:4, packed, YUYV" },
        { XVIP_VF_RBG, 8, NULL, MEDIA_BUS_FMT_RBG888_1X24,
-         3, V4L2_PIX_FMT_RGB24, "24-bit RGB" },
+         3, 24, V4L2_PIX_FMT_RGB24, 1, 1, 1, 1, "24-bit RGB" },
        { XVIP_VF_MONO_SENSOR, 8, "mono", MEDIA_BUS_FMT_Y8_1X8,
-         1, V4L2_PIX_FMT_GREY, "Greyscale 8-bit" },
+         1, 8, V4L2_PIX_FMT_GREY, 1, 1, 1, 1, "Greyscale 8-bit" },
        { XVIP_VF_MONO_SENSOR, 8, "rggb", MEDIA_BUS_FMT_SRGGB8_1X8,
-         1, V4L2_PIX_FMT_SGRBG8, "Bayer 8-bit RGGB" },
+         1, 8, V4L2_PIX_FMT_SGRBG8, 1, 1, 1, 1, "Bayer 8-bit RGGB" },
        { XVIP_VF_MONO_SENSOR, 8, "grbg", MEDIA_BUS_FMT_SGRBG8_1X8,
-         1, V4L2_PIX_FMT_SGRBG8, "Bayer 8-bit GRBG" },
+         1, 8, V4L2_PIX_FMT_SGRBG8, 1, 1, 1, 1, "Bayer 8-bit GRBG" },
        { XVIP_VF_MONO_SENSOR, 8, "gbrg", MEDIA_BUS_FMT_SGBRG8_1X8,
-         1, V4L2_PIX_FMT_SGBRG8, "Bayer 8-bit GBRG" },
+         1, 8, V4L2_PIX_FMT_SGBRG8, 1, 1, 1, 1, "Bayer 8-bit GBRG" },
        { XVIP_VF_MONO_SENSOR, 8, "bggr", MEDIA_BUS_FMT_SBGGR8_1X8,
-         1, V4L2_PIX_FMT_SBGGR8, "Bayer 8-bit BGGR" },
+         1, 8, V4L2_PIX_FMT_SBGGR8, 1, 1, 1, 1, "Bayer 8-bit BGGR" },
 };
 
 /**
drivers/media/platform/xilinx/xilinx-vip.h +10 -1
index 42fee20..006dcf77 100644
@@ -109,8 +109,12 @@ struct xvip_device {
  * @width: AXI4 format width in bits per component
  * @pattern: CFA pattern for Mono/Sensor formats
  * @code: media bus format code
- * @bpp: bytes per pixel (when stored in memory)
+ * @bpl_factor: Bytes per line factor
  * @fourcc: V4L2 pixel format FCC identifier
+ * @num_planes: number of planes w.r.t. color format
+ * @buffers: number of buffers per format
+ * @hsub: Horizontal sampling factor of Chroma
+ * @vsub: Vertical sampling factor of Chroma
  * @description: format description, suitable for userspace
  */
 struct xvip_video_format {
@@ -118,8 +122,13 @@ struct xvip_video_format {
        unsigned int width;
        const char *pattern;
        unsigned int code;
+       unsigned int bpl_factor;
        unsigned int bpp;
        u32 fourcc;
+       u8 num_planes;
+       u8 buffers;
+       u8 hsub;
+       u8 vsub;
        const char *description;
 };
 

--
2.7.4

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

#1 lore raw
Quoted 18 lines · Satish Kumar Nagireddy

This patch updates video format descriptor to help information viz., number of planes per color format and chroma sub sampling factors.

This commit adds the various 8-bit and 10-bit that are supported to the table queried by drivers.

---
 drivers/media/platform/xilinx/xilinx-vip.c | 18 ++++++++++--------
 drivers/media/platform/xilinx/xilinx-vip.h | 11 ++++++++++-
 2 files changed, 20 insertions(+), 9 deletions(-)
drivers/media/platform/xilinx/xilinx-vip.c +0 -0
index d306f44..51b7ef6 100644

drivers/media/platform/xilinx/xilinx-vip.c line 31

Quoted 5 lines
drivers/media/platform/xilinx/xilinx-vip.c +2 -0
@@ -27,22 +27,24 @@
  */
 
 static const struct xvip_video_format xvip_video_formats[] = {
+	{ XVIP_VF_YUV_420, 10, NULL, MEDIA_BUS_FMT_VYYUYY8_1X24,
+	  1, 15, V4L2_PIX_FMT_XV15M, 2, 2, 1, 2, "4:2:0, 10-bit 2-plane non-cont" },

So is the pixel scaling from 8 bit to 10 bit done hardware? In long term, I think pixel format should be separate from bus formats.

Then why is bpp 15 for this? I think it's average of bpp from multiple planes. The format can be modeled more clearly with per plane information instead.

Quoted 32 lines
drivers/media/platform/xilinx/xilinx-vip.c +8 -8
 	{ XVIP_VF_YUV_422, 8, NULL, MEDIA_BUS_FMT_UYVY8_1X16,
-	  2, V4L2_PIX_FMT_YUYV, "4:2:2, packed, YUYV" },
+	  2, 16, V4L2_PIX_FMT_YUYV, 1, 1, 2, 1, "4:2:2, packed, YUYV" },
 	{ XVIP_VF_YUV_444, 8, NULL, MEDIA_BUS_FMT_VUY8_1X24,
-	  3, V4L2_PIX_FMT_YUV444, "4:4:4, packed, YUYV" },
+	  3, 24, V4L2_PIX_FMT_VUY24, 1, 1, 1, 1, "4:4:4, packed, YUYV" },
 	{ XVIP_VF_RBG, 8, NULL, MEDIA_BUS_FMT_RBG888_1X24,
-	  3, V4L2_PIX_FMT_RGB24, "24-bit RGB" },
+	  3, 24, V4L2_PIX_FMT_RGB24, 1, 1, 1, 1, "24-bit RGB" },
 	{ XVIP_VF_MONO_SENSOR, 8, "mono", MEDIA_BUS_FMT_Y8_1X8,
-	  1, V4L2_PIX_FMT_GREY, "Greyscale 8-bit" },
+	  1, 8, V4L2_PIX_FMT_GREY, 1, 1, 1, 1, "Greyscale 8-bit" },
 	{ XVIP_VF_MONO_SENSOR, 8, "rggb", MEDIA_BUS_FMT_SRGGB8_1X8,
-	  1, V4L2_PIX_FMT_SGRBG8, "Bayer 8-bit RGGB" },
+	  1, 8, V4L2_PIX_FMT_SGRBG8, 1, 1, 1, 1, "Bayer 8-bit RGGB" },
 	{ XVIP_VF_MONO_SENSOR, 8, "grbg", MEDIA_BUS_FMT_SGRBG8_1X8,
-	  1, V4L2_PIX_FMT_SGRBG8, "Bayer 8-bit GRBG" },
+	  1, 8, V4L2_PIX_FMT_SGRBG8, 1, 1, 1, 1, "Bayer 8-bit GRBG" },
 	{ XVIP_VF_MONO_SENSOR, 8, "gbrg", MEDIA_BUS_FMT_SGBRG8_1X8,
-	  1, V4L2_PIX_FMT_SGBRG8, "Bayer 8-bit GBRG" },
+	  1, 8, V4L2_PIX_FMT_SGBRG8, 1, 1, 1, 1, "Bayer 8-bit GBRG" },
 	{ XVIP_VF_MONO_SENSOR, 8, "bggr", MEDIA_BUS_FMT_SBGGR8_1X8,
-	  1, V4L2_PIX_FMT_SBGGR8, "Bayer 8-bit BGGR" },
+	  1, 8, V4L2_PIX_FMT_SBGGR8, 1, 1, 1, 1, "Bayer 8-bit BGGR" },
 };
 
 /**
drivers/media/platform/xilinx/xilinx-vip.h +0 -0
index 42fee20..006dcf77 100644

drivers/media/platform/xilinx/xilinx-vip.h struct xvip_device { · line 112

Quoted 4 lines
drivers/media/platform/xilinx/xilinx-vip.h +0 -1
@@ -109,8 +109,12 @@ struct xvip_device {
  * @width: AXI4 format width in bits per component
  * @pattern: CFA pattern for Mono/Sensor formats
  * @code: media bus format code
- * @bpp: bytes per pixel (when stored in memory)

This member is still there.

drivers/media/platform/xilinx/xilinx-vip.h struct xvip_device { · line 112

Quoted 1 line
drivers/media/platform/xilinx/xilinx-vip.h +1 -0
+ * @bpl_factor: Bytes per line factor

'bpl_factor' is not needed in my opinion.

I think you meant to add bpp here. Then it seems like bpp definition is changed to bits per pixel in the table, and that should come with changes in code where it's used, ex, 'bpp' to 'bpp / 8'.

Thanks,
-hyun

Quoted 25 lines
drivers/media/platform/xilinx/xilinx-vip.h +9 -0
  * @fourcc: V4L2 pixel format FCC identifier
+ * @num_planes: number of planes w.r.t. color format
+ * @buffers: number of buffers per format
+ * @hsub: Horizontal sampling factor of Chroma
+ * @vsub: Vertical sampling factor of Chroma
  * @description: format description, suitable for userspace
  */
 struct xvip_video_format {
@@ -118,8 +122,13 @@ struct xvip_video_format {
 	unsigned int width;
 	const char *pattern;
 	unsigned int code;
+	unsigned int bpl_factor;
 	unsigned int bpp;
 	u32 fourcc;
+	u8 num_planes;
+	u8 buffers;
+	u8 hsub;
+	u8 vsub;
 	const char *description;
 };
 
Signature · 1 line
2.7.4