All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: kieran.bingham@ideasonboard.com
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v2 12/14] drm: rcar-du: Support multiple sources from the same VSP
Date: Tue, 01 Aug 2017 22:01:53 +0300	[thread overview]
Message-ID: <1792412.y3GJ2ps3ge@avalon> (raw)
In-Reply-To: <2ff1d13c-cdf9-3e65-d24d-72b9deb3d3cb@ideasonboard.com>

Hi Kieran,

On Tuesday 01 Aug 2017 19:10:20 Kieran Bingham wrote:
> On 26/06/17 19:12, Laurent Pinchart wrote:
> > On R-Car H3 ES2.0, DU channels 0 and 3 are served by two separate
> > pipelines from the same VSP. Support this in the DU driver.
> > 
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> 
> This looks good to me.
> 
> Minor nit / comment can be safely ignored. Mostly just me thinking outload.
> 
> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
> 
> > ---
> > 
> >  drivers/gpu/drm/rcar-du/rcar_du_crtc.c |  2 +-
> >  drivers/gpu/drm/rcar-du/rcar_du_crtc.h |  3 ++
> >  drivers/gpu/drm/rcar-du/rcar_du_kms.c  | 91 +++++++++++++++++++++++++----
> >  drivers/gpu/drm/rcar-du/rcar_du_vsp.c  | 37 +++++++-------
> >  drivers/gpu/drm/rcar-du/rcar_du_vsp.h  | 10 +++-
> >  5 files changed, 110 insertions(+), 33 deletions(-)

[snip]

> > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> > b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index f4125c8ca902..82b978a5dae6
> > 100644
> > --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> > +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> > @@ -432,6 +432,83 @@ static int rcar_du_properties_init(struct
> > rcar_du_device *rcdu)
> >  	return 0;
> >  }
> > 
> > +static int rcar_du_vsps_init(struct rcar_du_device *rcdu)
> > +{
> > +	const struct device_node *np = rcdu->dev->of_node;
> > +	struct of_phandle_args args;
> > +	struct {
> > +		struct device_node *np;
> > +		unsigned int crtcs_mask;
> > +	} vsps[RCAR_DU_MAX_VSPS] = { { 0, }, };
> > +	unsigned int vsps_count = 0;
> > +	unsigned int cells;
> > +	unsigned int i;
> > +	int ret;
> > +
> > +	/*
> > +	 * First parse the DT vsps property to populate the list of VSPs. Each
> > +	 * entry contains a pointer to the VSP DT node and a bitmask of the
> > +	 * connected DU CRTCs.
> > +	 */
> > +	cells = of_property_count_u32_elems(np, "vsps") / rcdu->num_crtcs - 1;
> > +	if (cells > 1)
> > +		return -EINVAL;
> > +
> > +	for (i = 0; i < rcdu->num_crtcs; ++i) {
> > +		unsigned int j;
> > +
> > +		ret = of_parse_phandle_with_fixed_args(np, "vsps", cells, i,
> > +						       &args);
> > +		if (ret < 0)
> > +			goto error;
> > +
> > +		/*
> > +		 * Add the VSP to the list or update the corresponding
> > existing
> > +		 * entry if the VSP has already been added.
> > +		 */
> > +		for (j = 0; j < vsps_count; ++j) {
> > +			if (vsps[j].np == args.np)
> > +				break;
> > +		}
> > +
> > +		if (j < vsps_count)
> > +			of_node_put(args.np);
> > +		else
> > +			vsps[vsps_count++].np = args.np;
> > +
> > +		vsps[j].crtcs_mask |= 1 << i;
> 
> I do love the BIT(x) macro personally - but it's not important :)

I wonder why I don't like the BIT macro. There's probably no good reason.

> > +
> > +		/* Store the VSP pointer and pipe index in the CRTC. */
> > +		rcdu->crtcs[i].vsp = &rcdu->vsps[j];
> > +		rcdu->crtcs[i].vsp_pipe = cells >= 1 ? args.args[0] : 0;
> > +	}
> > +
> > +	/*
> > +	 * Then initialize all the VSPs from the node pointers and CRTCs
> > bitmask
> > +	 * computed previously.
> > +	 */
> > +	for (i = 0; i < vsps_count; ++i) {
> > +		struct rcar_du_vsp *vsp = &rcdu->vsps[i];
> > +
> > +		vsp->index = i;
> > +		vsp->dev = rcdu;
> > +
> > +		ret = rcar_du_vsp_init(vsp, vsps[i].np, vsps[i].crtcs_mask);
> > +		if (ret < 0)
> > +			goto error;
> > +	}
> > +
> > +	return 0;
> > +
> > +error:
> > +	for (i = 0; i < ARRAY_SIZE(vsps); ++i) {
> > +		if (vsps[i].np)
> 
> Minor nit: of_node_put already has NULL protection so we don't need this
> 'if' but it probably does make it clearer that we are only putting back
> nodes that we collected.

It's a good point, I'll remove the check.

> > +			of_node_put(vsps[i].np);
> > +	}
> > +
> > +	return ret;
> > +}

[snip]

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2017-08-01 19:01 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-26 18:12 [PATCH v2 00/14] Renesas R-Car VSP: Add H3 ES2.0 support Laurent Pinchart
2017-06-26 18:12 ` [PATCH v2 01/14] v4l: vsp1: Fill display list headers without holding dlm spinlock Laurent Pinchart
2017-06-26 18:12   ` Laurent Pinchart
2017-07-13 11:26   ` Kieran Bingham
2017-07-13 11:36   ` Kieran Bingham
2017-07-13 12:48   ` Kieran Bingham
2017-07-20 13:50     ` Mauro Carvalho Chehab
2017-06-26 18:12 ` [PATCH v2 02/14] v4l: vsp1: Don't recycle active list at display start Laurent Pinchart
2017-07-13 17:02   ` Kieran Bingham
2017-07-20 13:51     ` Mauro Carvalho Chehab
2017-06-26 18:12 ` [PATCH v2 03/14] v4l: vsp1: Don't set WPF sink pointer Laurent Pinchart
2017-07-13 12:50   ` Kieran Bingham
2017-07-20 13:52     ` Mauro Carvalho Chehab
2017-06-26 18:12 ` [PATCH v2 04/14] v4l: vsp1: Store source and sink pointers as vsp1_entity Laurent Pinchart
2017-06-26 18:12   ` Laurent Pinchart
2017-07-13 13:00   ` Kieran Bingham
2017-07-20 13:53     ` Mauro Carvalho Chehab
2017-06-26 18:12 ` [PATCH v2 05/14] v4l: vsp1: Don't create links for DRM pipeline Laurent Pinchart
2017-07-13 13:06   ` Kieran Bingham
2017-07-20 13:54     ` Mauro Carvalho Chehab
2017-06-26 18:12 ` [PATCH v2 06/14] v4l: vsp1: Add pipe index argument to the VSP-DU API Laurent Pinchart
2017-07-13 13:14   ` Kieran Bingham
2017-07-13 13:16   ` Kieran Bingham
2017-07-13 23:04     ` Laurent Pinchart
2017-07-13 23:04       ` Laurent Pinchart
2017-07-20 13:56       ` Mauro Carvalho Chehab
2017-06-26 18:12 ` [PATCH v2 07/14] v4l: vsp1: Add support for the BRS entity Laurent Pinchart
2017-06-26 18:12   ` Laurent Pinchart
2017-07-13 13:38   ` Kieran Bingham
2017-07-20 13:58     ` Mauro Carvalho Chehab
2017-06-26 18:12 ` [PATCH v2 08/14] v4l: vsp1: Add support for new VSP2-BS, VSP2-DL and VSP2-D instances Laurent Pinchart
2017-07-13 17:49   ` Kieran Bingham
2017-07-13 23:31     ` Laurent Pinchart
2017-07-14  7:36       ` Kieran Bingham
2017-07-14  0:35   ` [PATCH v2.1 " Laurent Pinchart
2017-07-20 13:59     ` Mauro Carvalho Chehab
2017-06-26 18:12 ` [PATCH v2 09/14] v4l: vsp1: Add support for multiple LIF instances Laurent Pinchart
2017-07-13 17:57   ` Kieran Bingham
2017-07-20 14:00     ` Mauro Carvalho Chehab
2017-06-26 18:12 ` [PATCH v2 10/14] v4l: vsp1: Add support for multiple DRM pipelines Laurent Pinchart
2017-06-26 18:12   ` Laurent Pinchart
2017-07-20 14:02   ` Mauro Carvalho Chehab
2017-08-01 18:16   ` Kieran Bingham
2017-08-01 18:39   ` Kieran Bingham
2017-06-26 18:12 ` [PATCH v2 11/14] v4l: vsp1: Add support for header display lists in continuous mode Laurent Pinchart
2017-06-26 18:12   ` Laurent Pinchart
2017-07-13 11:09   ` Kieran Bingham
2017-07-20 14:03   ` Mauro Carvalho Chehab
2017-08-01 17:35   ` Kieran Bingham
2017-08-01 18:47     ` Laurent Pinchart
2017-08-02 11:06       ` Kieran Bingham
2017-08-02 11:06         ` Kieran Bingham
2017-06-26 18:12 ` [PATCH v2 12/14] drm: rcar-du: Support multiple sources from the same VSP Laurent Pinchart
2017-08-01 18:10   ` Kieran Bingham
2017-08-01 19:01     ` Laurent Pinchart [this message]
2017-06-26 18:12 ` [PATCH v2 13/14] drm: rcar-du: Restrict DPLL duty cycle workaround to H3 ES1.x Laurent Pinchart
2017-08-01 14:04   ` Kieran Bingham
2017-08-01 14:06   ` Kieran Bingham
2017-08-01 14:06     ` Kieran Bingham
2017-08-01 18:39     ` Laurent Pinchart
2017-12-11 20:58     ` Laurent Pinchart
2017-12-11 20:58       ` Laurent Pinchart
2017-06-26 18:12 ` [PATCH v2 14/14] drm: rcar-du: Configure DPAD0 routing through last group on Gen3 Laurent Pinchart
2017-08-01 13:46   ` Kieran Bingham
2017-08-01 13:51     ` Laurent Pinchart
2017-08-01 13:51       ` Laurent Pinchart
2017-08-01 17:20   ` [PATCH v2.1 " Laurent Pinchart
2017-08-01 17:23     ` Kieran Bingham
2017-07-13 11:41 ` [PATCH v2 00/14] Renesas R-Car VSP: Add H3 ES2.0 support Kieran Bingham
2017-07-13 11:46 ` Kieran Bingham
2017-07-13 11:51 ` Kieran Bingham
2017-07-13 11:56 ` Kieran Bingham
2017-07-13 12:11 ` Kieran Bingham
2017-07-13 12:16 ` Kieran Bingham
2017-07-13 12:25 ` Kieran Bingham
2017-07-14  0:54   ` Laurent Pinchart
2017-07-18 13:03 ` Hans Verkuil

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=1792412.y3GJ2ps3ge@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.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.