All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: jacopo mondi <jacopo@jmondi.org>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-renesas-soc@vger.kernel.org,
	Kieran Bingham <kieran.bingham@ideasonboard.com>
Subject: Re: [PATCH v2 7/8] v4l: vsp1: Integrate DISCOM in display pipeline
Date: Sat, 28 Apr 2018 19:57:19 +0300	[thread overview]
Message-ID: <5979699.LE7rGvgjD7@avalon> (raw)
In-Reply-To: <20180428110026.GE18201@w540>

Hi Jacopo,

On Saturday, 28 April 2018 14:00:26 EEST jacopo mondi wrote:
> On Mon, Apr 23, 2018 at 01:34:29AM +0300, Laurent Pinchart wrote:
> > The DISCOM is used to compute CRCs on display frames. Integrate it in
> > the display pipeline at the output of the blending unit to process
> > output frames.
> > 
> > Computing CRCs on input frames is possible by positioning the DISCOM at
> > a different point in the pipeline. This use case isn't supported at the
> > moment and could be implemented by extending the API between the VSP1
> > and DU drivers if needed.
> > 
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> > 
> >  drivers/media/platform/vsp1/vsp1_drm.c | 115 +++++++++++++++++++++++++++-
> >  drivers/media/platform/vsp1/vsp1_drm.h |  12 ++++
> >  2 files changed, 124 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/media/platform/vsp1/vsp1_drm.c
> > b/drivers/media/platform/vsp1/vsp1_drm.c index 5fc31578f9b0..7864b43a90e1
> > 100644
> > --- a/drivers/media/platform/vsp1/vsp1_drm.c
> > +++ b/drivers/media/platform/vsp1/vsp1_drm.c

[snip]

> > @@ -48,10 +54,65 @@ static void vsp1_du_pipeline_frame_end(struct
> > vsp1_pipeline *pipe,> 
> >   * Pipeline Configuration
> >   */
> > 
> > +/*
> > + * Insert the UIF in the pipeline between the prev and next entities. If
> > no UIF + * is available connect the two entities directly.
> > + */
> > +static int vsp1_du_insert_uif(struct vsp1_device *vsp1,
> > +			      struct vsp1_pipeline *pipe,
> > +			      struct vsp1_entity *uif,
> > +			      struct vsp1_entity *prev, unsigned int prev_pad,
> > +			      struct vsp1_entity *next, unsigned int next_pad)
> > +{
> > +	int ret;
> > +
> > +	if (uif) {
> > +		struct v4l2_subdev_format format;
> > +
> > +		prev->sink = uif;
> > +		prev->sink_pad = UIF_PAD_SINK;
> > +
> > +		memset(&format, 0, sizeof(format));
> > +		format.which = V4L2_SUBDEV_FORMAT_ACTIVE;
> > +		format.pad = prev_pad;
> > +
> > +		ret = v4l2_subdev_call(&prev->subdev, pad, get_fmt, NULL,
> > +				       &format);
> > +		if (ret < 0)
> > +			return ret;
> > +
> > +		format.pad = UIF_PAD_SINK;
> > +
> > +		ret = v4l2_subdev_call(&uif->subdev, pad, set_fmt, NULL,
> > +				       &format);
> > +		if (ret < 0)
> > +			return ret;
> > +
> > +		dev_dbg(vsp1->dev, "%s: set format %ux%u (%x) on UIF sink\n",
> > +			__func__, format.format.width, format.format.height,
> > +			format.format.code);
> > +
> > +		/*
> > +		 * The UIF doesn't mangle the format between its sink and
> > +		 * source pads, so there is no need to retrieve the format on
> > +		 * its source pad.
> > +		 */
> > +
> > +		uif->sink = next;
> > +		uif->sink_pad = next_pad;
> > +	} else {
> > +		prev->sink = next;
> > +		prev->sink_pad = next_pad;
> 
> Isn't the !uif case better handled in the caller? See below...
> Or otherwise, if you prefer handling it here, shouldn't the
> indentation be reduced with

I don't think it's better handled in the caller, I prefer keeping the entities 
linking code in a single place. I'll reduce the indentation.

>         if (!uif) {
> 		prev->sink = next;
> 		prev->sink_pad = next_pad;
>                 return 0;
>         }
> 
> > +	}
> > +
> > +	return 0;
> > +}

[snip]

> > @@ -367,6 +441,31 @@ static int vsp1_du_pipeline_setup_inputs(struct
> > vsp1_device *vsp1,
> >  		}
> >  	}
> > 
> > +	/* Insert and configure the UIF at the BRx output if available. */
> > +	uif = drm_pipe->crc.source == VSP1_DU_CRC_OUTPUT ? drm_pipe->uif : 
NULL;
> > +	if (uif)
> > +		use_uif = true;
> > +	ret = vsp1_du_insert_uif(vsp1, pipe, uif,
> > +				 pipe->brx, pipe->brx->source_pad,
> > +				 &pipe->output->entity, 0);
> > +	if (ret < 0)
> > +		dev_err(vsp1->dev, "%s: failed to setup UIF after %s\n",
> > +			__func__, BRX_NAME(pipe->brx));
> > +
> > +	/*
> > +	 * If the UIF is not in use schedule it for removal by setting its pipe
> > +	 * pointer to NULL, vsp1_du_pipeline_configure() will remove it from 
the
> > +	 * hardware pipeline and from the pipeline's list of entities. 
Otherwise
> > +	 * make sure it is present in the pipeline's list of entities if it
> > +	 * wasn't already.
> > +	 */
> > +	if (!use_uif) {
> 
> ... here. If you don't use uif, don't call vspi1_du_insert_uif().
> True, you have to link entities explicitly here if there is not uif,
> but I may be missing where this was happening before this code was
> added.
> 
> > +		drm_pipe->uif->pipe = NULL;
> > +	} else if (!drm_pipe->uif->pipe) {
> > +		drm_pipe->uif->pipe = pipe;
> > +		list_add_tail(&drm_pipe->uif->list_pipe, &pipe->entities);
> > +	}
> > +
> >  	return 0;
> >  }
> > 
> > @@ -748,6 +847,9 @@ void vsp1_du_atomic_flush(struct device *dev, unsigned
> > int pipe_index,> 
> >  	struct vsp1_drm_pipeline *drm_pipe = &vsp1->drm->pipe[pipe_index];
> >  	struct vsp1_pipeline *pipe = &drm_pipe->pipe;
> > 
> > +	drm_pipe->crc.source = cfg->crc.source;
> > +	drm_pipe->crc.index = cfg->crc.index;
> > +
> >  	vsp1_du_pipeline_setup_inputs(vsp1, pipe);
> >  	vsp1_du_pipeline_configure(pipe);
> >  	mutex_unlock(&vsp1->drm->lock);
> > @@ -816,6 +918,13 @@ int vsp1_drm_init(struct vsp1_device *vsp1)
> > 
> >  		pipe->lif->pipe = pipe;
> >  		list_add_tail(&pipe->lif->list_pipe, &pipe->entities);
> > +
> > +		/*
> > +		 * CRC computation is initially disabled, don't add the UIF to
> > +		 * the pipeline.
> > +		 */
> > +		if (i < vsp1->info->uif_count)
> 
> Why 'initially disabled'? This seems to me to conditionally enable the
> UIF unit. Or is the lif count always the same as the uif count?

Setting drm_pipe->uif isn't adding the UIF to the pipeline, that would be done 
by adding it to the pipe->entities list and setting the uif->pipe pointer.

> > +			drm_pipe->uif = &vsp1->uif[i]->entity;
> >  	}

-- 
Regards,

Laurent Pinchart

WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: jacopo mondi <jacopo@jmondi.org>
Cc: linux-renesas-soc@vger.kernel.org,
	Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	Kieran Bingham <kieran.bingham@ideasonboard.com>,
	dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org
Subject: Re: [PATCH v2 7/8] v4l: vsp1: Integrate DISCOM in display pipeline
Date: Sat, 28 Apr 2018 19:57:19 +0300	[thread overview]
Message-ID: <5979699.LE7rGvgjD7@avalon> (raw)
In-Reply-To: <20180428110026.GE18201@w540>

Hi Jacopo,

On Saturday, 28 April 2018 14:00:26 EEST jacopo mondi wrote:
> On Mon, Apr 23, 2018 at 01:34:29AM +0300, Laurent Pinchart wrote:
> > The DISCOM is used to compute CRCs on display frames. Integrate it in
> > the display pipeline at the output of the blending unit to process
> > output frames.
> > 
> > Computing CRCs on input frames is possible by positioning the DISCOM at
> > a different point in the pipeline. This use case isn't supported at the
> > moment and could be implemented by extending the API between the VSP1
> > and DU drivers if needed.
> > 
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> > 
> >  drivers/media/platform/vsp1/vsp1_drm.c | 115 +++++++++++++++++++++++++++-
> >  drivers/media/platform/vsp1/vsp1_drm.h |  12 ++++
> >  2 files changed, 124 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/media/platform/vsp1/vsp1_drm.c
> > b/drivers/media/platform/vsp1/vsp1_drm.c index 5fc31578f9b0..7864b43a90e1
> > 100644
> > --- a/drivers/media/platform/vsp1/vsp1_drm.c
> > +++ b/drivers/media/platform/vsp1/vsp1_drm.c

[snip]

> > @@ -48,10 +54,65 @@ static void vsp1_du_pipeline_frame_end(struct
> > vsp1_pipeline *pipe,> 
> >   * Pipeline Configuration
> >   */
> > 
> > +/*
> > + * Insert the UIF in the pipeline between the prev and next entities. If
> > no UIF + * is available connect the two entities directly.
> > + */
> > +static int vsp1_du_insert_uif(struct vsp1_device *vsp1,
> > +			      struct vsp1_pipeline *pipe,
> > +			      struct vsp1_entity *uif,
> > +			      struct vsp1_entity *prev, unsigned int prev_pad,
> > +			      struct vsp1_entity *next, unsigned int next_pad)
> > +{
> > +	int ret;
> > +
> > +	if (uif) {
> > +		struct v4l2_subdev_format format;
> > +
> > +		prev->sink = uif;
> > +		prev->sink_pad = UIF_PAD_SINK;
> > +
> > +		memset(&format, 0, sizeof(format));
> > +		format.which = V4L2_SUBDEV_FORMAT_ACTIVE;
> > +		format.pad = prev_pad;
> > +
> > +		ret = v4l2_subdev_call(&prev->subdev, pad, get_fmt, NULL,
> > +				       &format);
> > +		if (ret < 0)
> > +			return ret;
> > +
> > +		format.pad = UIF_PAD_SINK;
> > +
> > +		ret = v4l2_subdev_call(&uif->subdev, pad, set_fmt, NULL,
> > +				       &format);
> > +		if (ret < 0)
> > +			return ret;
> > +
> > +		dev_dbg(vsp1->dev, "%s: set format %ux%u (%x) on UIF sink\n",
> > +			__func__, format.format.width, format.format.height,
> > +			format.format.code);
> > +
> > +		/*
> > +		 * The UIF doesn't mangle the format between its sink and
> > +		 * source pads, so there is no need to retrieve the format on
> > +		 * its source pad.
> > +		 */
> > +
> > +		uif->sink = next;
> > +		uif->sink_pad = next_pad;
> > +	} else {
> > +		prev->sink = next;
> > +		prev->sink_pad = next_pad;
> 
> Isn't the !uif case better handled in the caller? See below...
> Or otherwise, if you prefer handling it here, shouldn't the
> indentation be reduced with

I don't think it's better handled in the caller, I prefer keeping the entities 
linking code in a single place. I'll reduce the indentation.

>         if (!uif) {
> 		prev->sink = next;
> 		prev->sink_pad = next_pad;
>                 return 0;
>         }
> 
> > +	}
> > +
> > +	return 0;
> > +}

[snip]

> > @@ -367,6 +441,31 @@ static int vsp1_du_pipeline_setup_inputs(struct
> > vsp1_device *vsp1,
> >  		}
> >  	}
> > 
> > +	/* Insert and configure the UIF at the BRx output if available. */
> > +	uif = drm_pipe->crc.source == VSP1_DU_CRC_OUTPUT ? drm_pipe->uif : 
NULL;
> > +	if (uif)
> > +		use_uif = true;
> > +	ret = vsp1_du_insert_uif(vsp1, pipe, uif,
> > +				 pipe->brx, pipe->brx->source_pad,
> > +				 &pipe->output->entity, 0);
> > +	if (ret < 0)
> > +		dev_err(vsp1->dev, "%s: failed to setup UIF after %s\n",
> > +			__func__, BRX_NAME(pipe->brx));
> > +
> > +	/*
> > +	 * If the UIF is not in use schedule it for removal by setting its pipe
> > +	 * pointer to NULL, vsp1_du_pipeline_configure() will remove it from 
the
> > +	 * hardware pipeline and from the pipeline's list of entities. 
Otherwise
> > +	 * make sure it is present in the pipeline's list of entities if it
> > +	 * wasn't already.
> > +	 */
> > +	if (!use_uif) {
> 
> ... here. If you don't use uif, don't call vspi1_du_insert_uif().
> True, you have to link entities explicitly here if there is not uif,
> but I may be missing where this was happening before this code was
> added.
> 
> > +		drm_pipe->uif->pipe = NULL;
> > +	} else if (!drm_pipe->uif->pipe) {
> > +		drm_pipe->uif->pipe = pipe;
> > +		list_add_tail(&drm_pipe->uif->list_pipe, &pipe->entities);
> > +	}
> > +
> >  	return 0;
> >  }
> > 
> > @@ -748,6 +847,9 @@ void vsp1_du_atomic_flush(struct device *dev, unsigned
> > int pipe_index,> 
> >  	struct vsp1_drm_pipeline *drm_pipe = &vsp1->drm->pipe[pipe_index];
> >  	struct vsp1_pipeline *pipe = &drm_pipe->pipe;
> > 
> > +	drm_pipe->crc.source = cfg->crc.source;
> > +	drm_pipe->crc.index = cfg->crc.index;
> > +
> >  	vsp1_du_pipeline_setup_inputs(vsp1, pipe);
> >  	vsp1_du_pipeline_configure(pipe);
> >  	mutex_unlock(&vsp1->drm->lock);
> > @@ -816,6 +918,13 @@ int vsp1_drm_init(struct vsp1_device *vsp1)
> > 
> >  		pipe->lif->pipe = pipe;
> >  		list_add_tail(&pipe->lif->list_pipe, &pipe->entities);
> > +
> > +		/*
> > +		 * CRC computation is initially disabled, don't add the UIF to
> > +		 * the pipeline.
> > +		 */
> > +		if (i < vsp1->info->uif_count)
> 
> Why 'initially disabled'? This seems to me to conditionally enable the
> UIF unit. Or is the lif count always the same as the uif count?

Setting drm_pipe->uif isn't adding the UIF to the pipeline, that would be done 
by adding it to the pipe->entities list and setting the uif->pipe pointer.

> > +			drm_pipe->uif = &vsp1->uif[i]->entity;
> >  	}

-- 
Regards,

Laurent Pinchart



_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-04-28 16:57 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-22 22:34 [PATCH v2 0/8] R-Car DU: Support CRC calculation Laurent Pinchart
2018-04-22 22:34 ` Laurent Pinchart
2018-04-22 22:34 ` [PATCH v2 1/8] v4l: vsp1: Use SPDX license headers Laurent Pinchart
2018-04-22 22:34   ` Laurent Pinchart
2018-04-27 21:25   ` Kieran Bingham
2018-04-27 21:25     ` Kieran Bingham
2018-04-27 21:47     ` Laurent Pinchart
2018-04-27 21:47       ` Laurent Pinchart
2018-04-22 22:34 ` [PATCH v2 2/8] v4l: vsp1: Share the CLU, LIF and LUT set_fmt pad operation code Laurent Pinchart
2018-04-22 22:34   ` Laurent Pinchart
2018-04-28  9:50   ` jacopo mondi
2018-04-28  9:50     ` jacopo mondi
2018-04-28 16:07     ` Laurent Pinchart
2018-04-28 16:07       ` Laurent Pinchart
2018-04-28 17:16   ` Kieran Bingham
2018-04-28 17:16     ` Kieran Bingham
2018-04-28 17:25     ` Laurent Pinchart
2018-04-28 17:25       ` Laurent Pinchart
2018-04-28 17:30       ` Laurent Pinchart
2018-04-28 17:30         ` Laurent Pinchart
2018-04-28 17:32         ` Kieran Bingham
2018-04-28 17:32           ` Kieran Bingham
2018-04-22 22:34 ` [PATCH v2 3/8] v4l: vsp1: Reset the crop and compose rectangles in the set_fmt helper Laurent Pinchart
2018-04-22 22:34   ` Laurent Pinchart
2018-04-28  9:56   ` jacopo mondi
2018-04-28  9:56     ` jacopo mondi
2018-04-28 17:22   ` Kieran Bingham
2018-04-28 17:22     ` Kieran Bingham
2018-04-22 22:34 ` [PATCH v2 4/8] v4l: vsp1: Document the vsp1_du_atomic_config structure Laurent Pinchart
2018-04-22 22:34   ` Laurent Pinchart
2018-04-28 17:29   ` Kieran Bingham
2018-04-28 17:29     ` Kieran Bingham
2018-04-22 22:34 ` [PATCH v2 5/8] v4l: vsp1: Extend the DU API to support CRC computation Laurent Pinchart
2018-04-22 22:34   ` Laurent Pinchart
2018-04-28 10:03   ` jacopo mondi
2018-04-28 10:03     ` jacopo mondi
2018-04-28 16:19     ` Laurent Pinchart
2018-04-28 16:19       ` Laurent Pinchart
2018-04-28 17:48   ` Kieran Bingham
2018-04-28 17:48     ` Kieran Bingham
2018-04-22 22:34 ` [PATCH v2 6/8] v4l: vsp1: Add support for the DISCOM entity Laurent Pinchart
2018-04-22 22:34   ` Laurent Pinchart
2018-04-28 10:40   ` jacopo mondi
2018-04-28 10:40     ` jacopo mondi
2018-04-28 16:50     ` Laurent Pinchart
2018-04-28 16:50       ` Laurent Pinchart
2018-04-28 18:28   ` Kieran Bingham
2018-04-28 18:28     ` Kieran Bingham
2018-04-22 22:34 ` [PATCH v2 7/8] v4l: vsp1: Integrate DISCOM in display pipeline Laurent Pinchart
2018-04-22 22:34   ` Laurent Pinchart
2018-04-28 11:00   ` jacopo mondi
2018-04-28 11:00     ` jacopo mondi
2018-04-28 16:57     ` Laurent Pinchart [this message]
2018-04-28 16:57       ` Laurent Pinchart
2018-04-28 18:58   ` Kieran Bingham
2018-04-28 18:58     ` Kieran Bingham
2018-04-28 19:15     ` Laurent Pinchart
2018-04-28 19:15       ` Laurent Pinchart
2018-04-22 22:34 ` [PATCH v2 8/8] drm: rcar-du: Add support for CRC computation Laurent Pinchart
2018-04-22 22:34   ` Laurent Pinchart
2018-04-28 19:16   ` Kieran Bingham
2018-04-28 19:16     ` Kieran Bingham
2018-04-28 20:15     ` Laurent Pinchart
2018-04-28 20:15       ` Laurent Pinchart
2018-04-27 21:07 ` igt trouble with planes shared between multiple CRTCs (Re: [PATCH v2 0/8] R-Car DU: Support CRC calculation) Laurent Pinchart
2018-04-27 21:07   ` Laurent Pinchart
2018-04-30 14:55   ` Daniel Vetter
2018-04-30 14:55     ` Daniel Vetter
2018-04-30 14:56     ` [igt-dev] " Daniel Vetter
2018-04-30 14:56       ` Daniel Vetter
2018-04-30 14:56       ` Daniel Vetter
2018-05-01  8:58       ` [igt-dev] " Maarten Lankhorst
2018-05-01  8:58         ` Maarten Lankhorst
2018-05-01  8:58         ` Maarten Lankhorst
2018-05-01 15:47         ` [igt-dev] " Maarten Lankhorst
2018-05-01 15:47           ` Maarten Lankhorst
2018-05-01 15:47           ` Maarten Lankhorst
2018-05-02  7:32         ` Daniel Vetter
2018-05-02  7:32           ` Daniel Vetter
2018-05-07 13:28           ` [igt-dev] " Maarten Lankhorst
2018-05-07 13:28             ` Maarten Lankhorst
2018-05-07 13:28             ` Maarten Lankhorst

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=5979699.LE7rGvgjD7@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jacopo@jmondi.org \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    /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 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.