linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: imx: prpencvf: enable double write reduction
@ 2017-07-22 21:21 Steve Longerbeam
  2017-07-22 22:04 ` Steve Longerbeam
  2017-07-24  7:21 ` Philipp Zabel
  0 siblings, 2 replies; 4+ messages in thread
From: Steve Longerbeam @ 2017-07-22 21:21 UTC (permalink / raw)
  To: Philipp Zabel, Mauro Carvalho Chehab, Greg Kroah-Hartman
  Cc: linux-media, devel, linux-kernel, Steve Longerbeam

For the write channels with 4:2:0 subsampled YUV formats, avoid chroma
overdraw by only writing chroma for even lines. Reduces necessary write
memory bandwidth by at least 25% (more with rotation enabled).

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
---
 drivers/staging/media/imx/imx-ic-prpencvf.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c b/drivers/staging/media/imx/imx-ic-prpencvf.c
index ed363fe..42c5045 100644
--- a/drivers/staging/media/imx/imx-ic-prpencvf.c
+++ b/drivers/staging/media/imx/imx-ic-prpencvf.c
@@ -374,6 +374,17 @@ static int prp_setup_channel(struct prp_priv *priv,
 	image.phys0 = addr0;
 	image.phys1 = addr1;
 
+	if (channel == priv->out_ch || channel == priv->rot_out_ch) {
+		switch (image.pix.pixelformat) {
+		case V4L2_PIX_FMT_YUV420:
+		case V4L2_PIX_FMT_YVU420:
+		case V4L2_PIX_FMT_NV12:
+			/* Skip writing U and V components to odd rows */
+			ipu_cpmem_skip_odd_chroma_rows(channel);
+			break;
+		}
+	}
+
 	ret = ipu_cpmem_set_image(channel, &image);
 	if (ret)
 		return ret;
-- 
2.7.4

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

* Re: [PATCH] media: imx: prpencvf: enable double write reduction
  2017-07-22 21:21 [PATCH] media: imx: prpencvf: enable double write reduction Steve Longerbeam
@ 2017-07-22 22:04 ` Steve Longerbeam
  2017-07-24  7:21   ` Philipp Zabel
  2017-07-24  7:21 ` Philipp Zabel
  1 sibling, 1 reply; 4+ messages in thread
From: Steve Longerbeam @ 2017-07-22 22:04 UTC (permalink / raw)
  To: Philipp Zabel, Mauro Carvalho Chehab, Greg Kroah-Hartman
  Cc: linux-media, devel, linux-kernel

Hi Philipp,

This is the same as your patch to CSI, applied to ic-prpencvf.

I'm not really sure what this cpmem bit is doing. The U/V planes
in memory are already subsampled by 2 in both width and height.
This must be referring to what the IDMAC is transferring on the bus,
but why would it place duplicate U/V samples on the bus in the first
place?

Anyway, thanks for the heads-up on this.

Steve


On 07/22/2017 02:21 PM, Steve Longerbeam wrote:
> For the write channels with 4:2:0 subsampled YUV formats, avoid chroma
> overdraw by only writing chroma for even lines. Reduces necessary write
> memory bandwidth by at least 25% (more with rotation enabled).
>
> Signed-off-by: Steve Longerbeam<steve_longerbeam@mentor.com>
> ---
>   drivers/staging/media/imx/imx-ic-prpencvf.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
>
> diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c b/drivers/staging/media/imx/imx-ic-prpencvf.c
> index ed363fe..42c5045 100644
> --- a/drivers/staging/media/imx/imx-ic-prpencvf.c
> +++ b/drivers/staging/media/imx/imx-ic-prpencvf.c
> @@ -374,6 +374,17 @@ static int prp_setup_channel(struct prp_priv *priv,
>   	image.phys0 = addr0;
>   	image.phys1 = addr1;
>   
> +	if (channel == priv->out_ch || channel == priv->rot_out_ch) {
> +		switch (image.pix.pixelformat) {
> +		case V4L2_PIX_FMT_YUV420:
> +		case V4L2_PIX_FMT_YVU420:
> +		case V4L2_PIX_FMT_NV12:
> +			/* Skip writing U and V components to odd rows */
> +			ipu_cpmem_skip_odd_chroma_rows(channel);
> +			break;
> +		}
> +	}
> +
>   	ret = ipu_cpmem_set_image(channel, &image);
>   	if (ret)
>   		return ret;

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

* Re: [PATCH] media: imx: prpencvf: enable double write reduction
  2017-07-22 22:04 ` Steve Longerbeam
@ 2017-07-24  7:21   ` Philipp Zabel
  0 siblings, 0 replies; 4+ messages in thread
From: Philipp Zabel @ 2017-07-24  7:21 UTC (permalink / raw)
  To: Steve Longerbeam
  Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman, linux-media, devel,
	linux-kernel

Hi Steve,

On Sat, 2017-07-22 at 15:04 -0700, Steve Longerbeam wrote:
> Hi Philipp,
> 
> This is the same as your patch to CSI, applied to ic-prpencvf.
> 
> I'm not really sure what this cpmem bit is doing. The U/V planes
> in memory are already subsampled by 2 in both width and height.
> This must be referring to what the IDMAC is transferring on the bus,

Right, the IDMAC is just receiving AYUV 4:4:4 pixels from the FIFO, the
CPMEM settings decide how they are written to the AXI bus. If this bit
is not enabled, all pixels are written fully, even though chroma samples
of even and odd lines end up in the same place for 4:2:0 chroma
subsampled output formats. If the bit is set, the chroma writes for odd
lines are skipped, so there is no overdraw.

Unfortunately this does not work for reading, unless there is a line
buffer (which only the VDIC has), because otherwise odd lines end up
without chroma information. This one of the reasons that YUY2 is the
most memory efficient format to read, not NV12.

> but why would it place duplicate U/V samples on the bus in the first
> place?

Don't ask me why the hardware was designed this way :)
I see no reason to ever disable this bit for YUV420 or NV12 write
channels.

> Anyway, thanks for the heads-up on this.

regards
Philipp

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

* Re: [PATCH] media: imx: prpencvf: enable double write reduction
  2017-07-22 21:21 [PATCH] media: imx: prpencvf: enable double write reduction Steve Longerbeam
  2017-07-22 22:04 ` Steve Longerbeam
@ 2017-07-24  7:21 ` Philipp Zabel
  1 sibling, 0 replies; 4+ messages in thread
From: Philipp Zabel @ 2017-07-24  7:21 UTC (permalink / raw)
  To: Steve Longerbeam
  Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman, linux-media, devel,
	linux-kernel, Steve Longerbeam

On Sat, 2017-07-22 at 14:21 -0700, Steve Longerbeam wrote:
> For the write channels with 4:2:0 subsampled YUV formats, avoid chroma
> overdraw by only writing chroma for even lines. Reduces necessary write
> memory bandwidth by at least 25% (more with rotation enabled).
> 
> Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>

Acked-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp

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

end of thread, other threads:[~2017-07-24  7:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-22 21:21 [PATCH] media: imx: prpencvf: enable double write reduction Steve Longerbeam
2017-07-22 22:04 ` Steve Longerbeam
2017-07-24  7:21   ` Philipp Zabel
2017-07-24  7:21 ` Philipp Zabel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).