All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 8/9] v4l: xilinx: dma: Add scaling and padding factor functions
@ 2018-02-15  6:42 Satish Kumar Nagireddy
  2018-02-16 17:05 ` 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

scaling_factor function returns multiplying factor to calculate
bytes per component based on color format.
For eg. scaling factor of YUV420 8 bit format is 1
so multiplying factor is 1 (8/8)
scaling factor of YUV420 10 bit format is 1.25 (10/8)

padding_factor function returns multiplying factor to calculate
actual width of video according to color format.
For eg. padding factor of YUV420 8 bit format: 8 bits per 1 component
no padding bits here, so multiplying factor is 1
padding factor of YUV422 10 bit format: 32 bits per 3 components
each component is 10 bit and the factor is 32/30

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

diff --git a/drivers/media/platform/xilinx/xilinx-vip.c b/drivers/media/platform/xilinx/xilinx-vip.c
index 51b7ef6..7543b75 100644
--- a/drivers/media/platform/xilinx/xilinx-vip.c
+++ b/drivers/media/platform/xilinx/xilinx-vip.c
@@ -94,6 +94,49 @@ const struct xvip_video_format *xvip_get_format_by_fourcc(u32 fourcc)
 EXPORT_SYMBOL_GPL(xvip_get_format_by_fourcc);

 /**
+ * xvip_bpl_scaling_factor - Retrieve bpl scaling factor for a 4CC
+ * @fourcc: the format 4CC
+ *
+ * Return: Return numerator and denominator values by address
+ */
+void xvip_bpl_scaling_factor(u32 fourcc, u32 *numerator, u32 *denominator)
+{
+       switch (fourcc) {
+       case V4L2_PIX_FMT_XV15M:
+               *numerator = 10;
+               *denominator = 8;
+               break;
+       default:
+               *numerator   = 1;
+               *denominator = 1;
+               break;
+       }
+}
+EXPORT_SYMBOL_GPL(xvip_bpl_scaling_factor);
+
+/**
+ * xvip_width_padding_factor - Retrieve width's padding factor for a 4CC
+ * @fourcc: the format 4CC
+ *
+ * Return: Return numerator and denominator values by address
+ */
+void xvip_width_padding_factor(u32 fourcc, u32 *numerator, u32 *denominator)
+{
+       switch (fourcc) {
+       case V4L2_PIX_FMT_XV15M:
+               /* 32 bits are required per 30 bits of data */
+               *numerator = 32;
+               *denominator = 30;
+               break;
+       default:
+               *numerator   = 1;
+               *denominator = 1;
+               break;
+       }
+}
+EXPORT_SYMBOL_GPL(xvip_width_padding_factor);
+
+/**
  * xvip_of_get_format - Parse a device tree node and return format information
  * @node: the device tree node
  *
diff --git a/drivers/media/platform/xilinx/xilinx-vip.h b/drivers/media/platform/xilinx/xilinx-vip.h
index 006dcf77..26fada7 100644
--- a/drivers/media/platform/xilinx/xilinx-vip.h
+++ b/drivers/media/platform/xilinx/xilinx-vip.h
@@ -135,6 +135,8 @@ struct xvip_video_format {
 const struct xvip_video_format *xvip_get_format_by_code(unsigned int code);
 const struct xvip_video_format *xvip_get_format_by_fourcc(u32 fourcc);
 const struct xvip_video_format *xvip_of_get_format(struct device_node *node);
+void xvip_bpl_scaling_factor(u32 fourcc, u32 *numerator, u32 *denominator);
+void xvip_width_padding_factor(u32 fourcc, u32 *numerator, u32 *denominator);
 void xvip_set_format_size(struct v4l2_mbus_framefmt *format,
                          const struct v4l2_subdev_format *fmt);
 int xvip_enum_mbus_code(struct v4l2_subdev *subdev,
--
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 8/9] v4l: xilinx: dma: Add scaling and padding factor functions
  2018-02-15  6:42 [PATCH v3 8/9] v4l: xilinx: dma: Add scaling and padding factor functions Satish Kumar Nagireddy
@ 2018-02-16 17:05 ` Hyun Kwon
  0 siblings, 0 replies; 2+ messages in thread
From: Hyun Kwon @ 2018-02-16 17:05 UTC (permalink / raw)
  To: Satish Kumar Nagireddy
  Cc: linux-media, laurent.pinchart, michal.simek, Hyun Kwon,
	Satish Kumar Nagireddy

Hi Satish,

Thanks for the patch.

On Wed, 2018-02-14 at 22:42:50 -0800, Satish Kumar Nagireddy wrote:
> scaling_factor function returns multiplying factor to calculate
> bytes per component based on color format.
> For eg. scaling factor of YUV420 8 bit format is 1
> so multiplying factor is 1 (8/8)
> scaling factor of YUV420 10 bit format is 1.25 (10/8)
> 
> padding_factor function returns multiplying factor to calculate
> actual width of video according to color format.
> For eg. padding factor of YUV420 8 bit format: 8 bits per 1 component
> no padding bits here, so multiplying factor is 1
> padding factor of YUV422 10 bit format: 32 bits per 3 components
> each component is 10 bit and the factor is 32/30
> 
> Signed-off-by: Satish Kumar Nagireddy <satishna@xilinx.com>
> ---
>  drivers/media/platform/xilinx/xilinx-vip.c | 43 ++++++++++++++++++++++++++++++
>  drivers/media/platform/xilinx/xilinx-vip.h |  2 ++
>  2 files changed, 45 insertions(+)
> 
> diff --git a/drivers/media/platform/xilinx/xilinx-vip.c b/drivers/media/platform/xilinx/xilinx-vip.c
> index 51b7ef6..7543b75 100644
> --- a/drivers/media/platform/xilinx/xilinx-vip.c
> +++ b/drivers/media/platform/xilinx/xilinx-vip.c
> @@ -94,6 +94,49 @@ const struct xvip_video_format *xvip_get_format_by_fourcc(u32 fourcc)
>  EXPORT_SYMBOL_GPL(xvip_get_format_by_fourcc);
>  
>  /**
> + * xvip_bpl_scaling_factor - Retrieve bpl scaling factor for a 4CC
> + * @fourcc: the format 4CC
> + *
> + * Return: Return numerator and denominator values by address
> + */
> +void xvip_bpl_scaling_factor(u32 fourcc, u32 *numerator, u32 *denominator)
> +{
> +	switch (fourcc) {
> +	case V4L2_PIX_FMT_XV15M:
> +		*numerator = 10;
> +		*denominator = 8;
> +		break;
> +	default:
> +		*numerator   = 1;
> +		*denominator = 1;
> +		break;
> +	}
> +}
> +EXPORT_SYMBOL_GPL(xvip_bpl_scaling_factor);
> +
> +/**
> + * xvip_width_padding_factor - Retrieve width's padding factor for a 4CC
> + * @fourcc: the format 4CC
> + *
> + * Return: Return numerator and denominator values by address
> + */
> +void xvip_width_padding_factor(u32 fourcc, u32 *numerator, u32 *denominator)
> +{
> +	switch (fourcc) {
> +	case V4L2_PIX_FMT_XV15M:
> +		/* 32 bits are required per 30 bits of data */
> +		*numerator = 32;
> +		*denominator = 30;
> +		break;
> +	default:
> +		*numerator   = 1;
> +		*denominator = 1;
> +		break;
> +	}
> +}
> +EXPORT_SYMBOL_GPL(xvip_width_padding_factor);

Could you please take a look at the link below?
https://lists.freedesktop.org/archives/dri-devel/2018-February/165313.html

This approach has been replaced with the macro-pixel concept in DRM patch set.
The set is still on going, but in my opinion that's simpler, ex, as
all needed information can be added to the table. Similar approach may be
useful here.

Thanks,
-hyun

> +
> +/**
>   * xvip_of_get_format - Parse a device tree node and return format information
>   * @node: the device tree node
>   *
> diff --git a/drivers/media/platform/xilinx/xilinx-vip.h b/drivers/media/platform/xilinx/xilinx-vip.h
> index 006dcf77..26fada7 100644
> --- a/drivers/media/platform/xilinx/xilinx-vip.h
> +++ b/drivers/media/platform/xilinx/xilinx-vip.h
> @@ -135,6 +135,8 @@ struct xvip_video_format {
>  const struct xvip_video_format *xvip_get_format_by_code(unsigned int code);
>  const struct xvip_video_format *xvip_get_format_by_fourcc(u32 fourcc);
>  const struct xvip_video_format *xvip_of_get_format(struct device_node *node);
> +void xvip_bpl_scaling_factor(u32 fourcc, u32 *numerator, u32 *denominator);
> +void xvip_width_padding_factor(u32 fourcc, u32 *numerator, u32 *denominator);
>  void xvip_set_format_size(struct v4l2_mbus_framefmt *format,
>  			  const struct v4l2_subdev_format *fmt);
>  int xvip_enum_mbus_code(struct v4l2_subdev *subdev,
> -- 
> 2.7.4
> 

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

end of thread, other threads:[~2018-02-16 17:05 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 8/9] v4l: xilinx: dma: Add scaling and padding factor functions Satish Kumar Nagireddy
2018-02-16 17:05 ` Hyun Kwon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.