public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: "Steve Longerbeam" <slongerbeam@gmail.com>,
	"Krzysztof Hałasa" <khalasa@piap.pl>,
	"Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Hans Verkuil" <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org,
	Steve Longerbeam <steve_longerbeam@mentor.com>
Subject: Re: [PATCH v2 04/10] media: imx: interweave only for sequential input/interlaced output fields
Date: Fri, 01 Jun 2018 15:33:30 +0200	[thread overview]
Message-ID: <1527860010.5913.8.camel@pengutronix.de> (raw)
In-Reply-To: <1527813049-3231-5-git-send-email-steve_longerbeam@mentor.com>

Hi Steve,

On Thu, 2018-05-31 at 17:30 -0700, Steve Longerbeam wrote:
> IDMAC interlaced scan, a.k.a. interweave, should be enabled at the
> IDMAC output pads only if the input field type is 'seq-bt' or 'seq-tb',
> and the IDMAC output pad field type is 'interlaced*'. Move this
> determination to a new macro idmac_interweave().
> 
> V4L2_FIELD_HAS_BOTH() macro should not be used on the input to determine
> enabling interlaced/interweave scan. That macro includes the 'interlaced'
> field types, and in those cases the data is already interweaved with
> top/bottom field lines.
> 
> The CSI will capture whole frames when the source specifies alternate
> field mode. So the CSI also enables interweave at the IDMAC output pad
> for alternate input field type.
> 
> Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
> ---
>  drivers/staging/media/imx/imx-ic-prpencvf.c | 22 ++++++++++++++++++----
>  drivers/staging/media/imx/imx-media-csi.c   | 22 ++++++++++++++++++----
>  2 files changed, 36 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c b/drivers/staging/media/imx/imx-ic-prpencvf.c
> index ae453fd..894db21 100644
> --- a/drivers/staging/media/imx/imx-ic-prpencvf.c
> +++ b/drivers/staging/media/imx/imx-ic-prpencvf.c
> @@ -132,6 +132,18 @@ static inline struct prp_priv *sd_to_priv(struct v4l2_subdev *sd)
>  	return ic_priv->task_priv;
>  }
>  
> +/*
> + * If the field type at IDMAC output pad is interlaced, and
> + * the input is sequential fields, the IDMAC output channel
> + * can accommodate by interweaving.
> + */
> +static inline bool idmac_interweave(enum v4l2_field outfield,
> +				    enum v4l2_field infield)
> +{
> +	return V4L2_FIELD_IS_INTERLACED(outfield) &&
> +		V4L2_FIELD_IS_SEQUENTIAL(infield);
> +}

This is ok in this patch, but we can't use this check in the following
TRY_FMT patch as there is no way to interweave
SEQ_TB -> INTERLACED_BT (because in SEQ_TB the B field is newer than T,
but in INTERLACED_BT it has to be older) or SEQ_BT -> INTERLACED_TB (the
other way around).

> +
>  static void prp_put_ipu_resources(struct prp_priv *priv)
>  {
>  	if (priv->ic)
> @@ -353,6 +365,7 @@ static int prp_setup_channel(struct prp_priv *priv,
>  	struct v4l2_mbus_framefmt *infmt;
>  	unsigned int burst_size;
>  	struct ipu_image image;
> +	bool interweave;
>  	int ret;
>  
>  	infmt = &priv->format_mbus[PRPENCVF_SINK_PAD];
> @@ -365,6 +378,9 @@ static int prp_setup_channel(struct prp_priv *priv,
>  	image.rect.width = image.pix.width;
>  	image.rect.height = image.pix.height;
>  
> +	interweave = (idmac_interweave(image.pix.field, infmt->field) &&
> +		      channel == priv->out_ch);
> +
>  	if (rot_swap_width_height) {
>  		swap(image.pix.width, image.pix.height);
>  		swap(image.rect.width, image.rect.height);
> @@ -405,9 +421,7 @@ static int prp_setup_channel(struct prp_priv *priv,
>  	if (rot_mode)
>  		ipu_cpmem_set_rotation(channel, rot_mode);
>  
> -	if (image.pix.field == V4L2_FIELD_NONE &&
> -	    V4L2_FIELD_HAS_BOTH(infmt->field) &&
> -	    channel == priv->out_ch)
> +	if (interweave)
>  		ipu_cpmem_interlaced_scan(channel, image.pix.bytesperline);

This only works for SEQ_TB -> INTERLACED_TB interweave.
For SEQ_BT -> INTERLACED_BT we have to start at +1 line offset and set
ipu_cpmem_interlaced_scan to -image.pix.bytesperline.

regards
Philipp

  reply	other threads:[~2018-06-01 13:33 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-01  0:30 [PATCH v2 00/10] imx-media: Fixes for interlaced capture Steve Longerbeam
2018-06-01  0:30 ` [PATCH v2 01/10] media: imx-csi: Pass sink pad field to ipu_csi_init_interface Steve Longerbeam
2018-06-01 13:22   ` Philipp Zabel
2018-06-02 16:30     ` Steve Longerbeam
2018-06-04  5:25       ` Krzysztof Hałasa
2018-06-04  8:32         ` Philipp Zabel
2018-06-04 16:47         ` Steve Longerbeam
2018-06-05  4:54           ` Krzysztof Hałasa
2018-06-01  0:30 ` [PATCH v2 02/10] gpu: ipu-csi: Check for field type alternate Steve Longerbeam
2018-06-01 13:26   ` Philipp Zabel
2018-06-01  0:30 ` [PATCH v2 03/10] media: videodev2.h: Add macros V4L2_FIELD_IS_{INTERLACED|SEQUENTIAL} Steve Longerbeam
2018-06-01  0:30 ` [PATCH v2 04/10] media: imx: interweave only for sequential input/interlaced output fields Steve Longerbeam
2018-06-01 13:33   ` Philipp Zabel [this message]
2018-06-02 16:32     ` Steve Longerbeam
2018-06-04  5:35     ` Krzysztof Hałasa
2018-06-04  8:27       ` Philipp Zabel
2018-06-05  0:56         ` Steve Longerbeam
2018-06-05  8:07           ` Philipp Zabel
2018-06-05 10:43             ` Krzysztof Hałasa
2018-06-05 19:00             ` Steve Longerbeam
2018-06-06  5:48               ` Krzysztof Hałasa
2018-06-06  9:05               ` Philipp Zabel
2018-06-07  3:37                 ` Steve Longerbeam
2018-06-07  7:43                   ` Krzysztof Hałasa
2018-06-06  6:26           ` Krzysztof Hałasa
2018-06-01  0:30 ` [PATCH v2 05/10] media: imx: interweave and odd-chroma-row skip are incompatible Steve Longerbeam
2018-06-01  0:30 ` [PATCH v2 06/10] media: imx: Fix field setting logic in try_fmt Steve Longerbeam
2018-06-01 13:34   ` Philipp Zabel
2018-06-02 16:32     ` Steve Longerbeam
2018-06-01  0:30 ` [PATCH v2 07/10] media: imx-csi: Allow skipping odd chroma rows for YVU420 Steve Longerbeam
2018-06-01 13:35   ` Philipp Zabel
2018-06-01  0:30 ` [PATCH v2 08/10] media: imx: vdic: rely on VDIC for correct field order Steve Longerbeam
2018-06-01  0:30 ` [PATCH v2 09/10] media: imx-csi: Move crop/compose reset after filling default mbus fields Steve Longerbeam
2018-06-01  0:30 ` [PATCH v2 10/10] media: imx.rst: Update doc to reflect fixes to interlaced capture Steve Longerbeam
2018-06-01 13:44   ` Philipp Zabel
2018-06-02 17:58     ` Steve Longerbeam
2018-06-02 18:44     ` Steve Longerbeam
2018-06-04  5:52       ` Krzysztof Hałasa
2018-06-04  8:34       ` Philipp Zabel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1527860010.5913.8.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=hverkuil@xs4all.nl \
    --cc=khalasa@piap.pl \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=slongerbeam@gmail.com \
    --cc=steve_longerbeam@mentor.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox