public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 6/9] v4l: xilinx: dma: Update video format descriptor
@ 2018-02-15  6:42 Satish Kumar Nagireddy
  2018-02-16 17:02 ` Hyun Kwon
  0 siblings, 1 reply; 2+ messages in thread
From: Satish Kumar Nagireddy @ 2018-02-15  6:42 UTC (permalink / raw)
  To: linux-media, laurent.pinchart, michal.simek, hyun.kwon
  Cc: 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.

Signed-off-by: Satish Kumar Nagireddy <satishna@xilinx.com>
---
 drivers/media/platform/xilinx/xilinx-vip.c | 18 ++++++++++--------
 drivers/media/platform/xilinx/xilinx-vip.h | 11 ++++++++++-
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/drivers/media/platform/xilinx/xilinx-vip.c b/drivers/media/platform/xilinx/xilinx-vip.c
index d306f44..51b7ef6 100644
--- a/drivers/media/platform/xilinx/xilinx-vip.c
+++ b/drivers/media/platform/xilinx/xilinx-vip.c
@@ -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" },
 };

 /**
diff --git a/drivers/media/platform/xilinx/xilinx-vip.h b/drivers/media/platform/xilinx/xilinx-vip.h
index 42fee20..006dcf77 100644
--- a/drivers/media/platform/xilinx/xilinx-vip.h
+++ b/drivers/media/platform/xilinx/xilinx-vip.h
@@ -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.

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v3 6/9] v4l: xilinx: dma: Update video format descriptor
  2018-02-15  6:42 [PATCH v3 6/9] v4l: xilinx: dma: Update video format descriptor Satish Kumar Nagireddy
@ 2018-02-16 17:02 ` Hyun Kwon
  0 siblings, 0 replies; 2+ messages in thread
From: Hyun Kwon @ 2018-02-16 17:02 UTC (permalink / raw)
  To: Satish Kumar Nagireddy
  Cc: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com,
	michal.simek@xilinx.com, Hyun Kwon, Satish Kumar Nagireddy

On Wed, 2018-02-14 at 22:42:36 -0800, Satish Kumar Nagireddy wrote:
> 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.
> 
> Signed-off-by: Satish Kumar Nagireddy <satishna@xilinx.com>
> ---
>  drivers/media/platform/xilinx/xilinx-vip.c | 18 ++++++++++--------
>  drivers/media/platform/xilinx/xilinx-vip.h | 11 ++++++++++-
>  2 files changed, 20 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/media/platform/xilinx/xilinx-vip.c b/drivers/media/platform/xilinx/xilinx-vip.c
> index d306f44..51b7ef6 100644
> --- a/drivers/media/platform/xilinx/xilinx-vip.c
> +++ b/drivers/media/platform/xilinx/xilinx-vip.c
> @@ -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.

>  	{ 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" },
>  };
>  
>  /**
> diff --git a/drivers/media/platform/xilinx/xilinx-vip.h b/drivers/media/platform/xilinx/xilinx-vip.h
> index 42fee20..006dcf77 100644
> --- a/drivers/media/platform/xilinx/xilinx-vip.h
> +++ b/drivers/media/platform/xilinx/xilinx-vip.h
> @@ -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.

> + * @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

>   * @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
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-02-16 17:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-15  6:42 [PATCH v3 6/9] v4l: xilinx: dma: Update video format descriptor Satish Kumar Nagireddy
2018-02-16 17:02 ` Hyun Kwon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox