Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@nxp.com>
To: Nicolas Dufresne <nicolas@ndufresne.ca>
Cc: ming.qian@oss.nxp.com, linux-media@vger.kernel.org,
	mchehab@kernel.org, hverkuil-cisco@xs4all.nl,
	benjamin.gaignard@collabora.com, p.zabel@pengutronix.de,
	sebastian.fricke@collabora.com, shawnguo@kernel.org,
	ulf.hansson@linaro.org, s.hauer@pengutronix.de,
	kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com,
	l.stach@pengutronix.de, peng.fan@nxp.com, eagle.zhou@nxp.com,
	imx@lists.linux.dev, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 3/3] media: verisilicon: Avoid G2 bus error while decoding H.264 and HEVC
Date: Fri, 5 Dec 2025 10:07:34 -0500	[thread overview]
Message-ID: <aTL1NrZyeq8g/4Ft@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <b45a73845e66355080cfad0f0040b6e7a9d78241.camel@ndufresne.ca>

On Thu, Dec 04, 2025 at 07:05:01PM -0500, Nicolas Dufresne wrote:
> Le jeudi 04 décembre 2025 à 17:57 -0500, Frank Li a écrit :
> > On Thu, Dec 04, 2025 at 01:15:35PM -0500, Nicolas Dufresne wrote:
> > > Hi Frank,
> > >
> > > Le jeudi 04 décembre 2025 à 12:34 -0500, Frank Li a écrit :
> > > > > +static struct v4l2_m2m_dev *hantro_get_v4l2_m2m_dev(struct hantro_dev *vpu)
> > > > > +{
> > > > > +	struct device_node *node;
> > > > > +	struct hantro_dev *shared_vpu;
> > > > > +
> > > > > +	if (!vpu->variant || !vpu->variant->shared_devices)
> > > > > +		goto init_new_m2m_dev;
> > > >
> > > > I found only use shared_devices here, how to  ensure that g1 and g2 operate
> > > > alternately by using shared_devices?
> > >
> > > shared_devices is an array of of_device_id we match against. All the matching
> > > devices will share the same v4l2_m2m_dev (aka m2m scheduler). Typically, both
> > > cores will be schedule as one. This achieve what alternate operations without
> > > active polling or blocking locks/mutex.
> >
> > Okay, but this code require shared_devices==NULL's device probe firstly.
> > generally not order guaranteed, if there are not depentance at DT.
>
> shared_devices is a constant array that is set inside the variant. It is
> normally NULL, except for the imx8mq SoC, for which its always set.
>
> >
> > Does VPU always probe before g1/g2?
> >
> > and if there are two VPU instances, what's happen?
>
> Since there is two VPU, g1 and g2, we will enter this loop:
>
> > +	for_each_matching_node(node, vpu->variant->shared_devices) {
>
> On imx8mq, this will match twice.
>
> > +		struct platform_device *pdev;
> > +		struct v4l2_m2m_dev *m2m_dev;
> > +
> > +		pdev = of_find_device_by_node(node);
> > +		of_node_put(node);
> > +
> > +		if (!pdev)
> > +			continue;
>
> If the match does not have a device yet (not probe yet), we skip.
>
> > +
> > +		shared_vpu = platform_get_drvdata(pdev);
> > +		if (IS_ERR_OR_NULL(shared_vpu) || shared_vpu == vpu) {
> > +			platform_device_put(pdev);
> > +			continue;
> > +		}
>
> If its the current VPU, we also skip.
>
> > +
> > +		v4l2_m2m_get(shared_vpu->m2m_dev);
> > +		m2m_dev = shared_vpu->m2m_dev;
> > +		platform_device_put(pdev);
>
> Finally, if the other VPU was initialized, we ref the v4l2_m2m_dev. We will then
> create m2m_ctx from it which will cause the two VPU to be scheduled one after
> the other.
>
> > +
> > +		return m2m_dev;
> > +	}
>
> > +
> > +init_new_m2m_dev:
> > +	return v4l2_m2m_init(&vpu_m2m_ops);
>
> Otherwhise we create a fresh one.
>
> Does it make sense now ?

Yes, thanks for detial explain.

Frank

>
> Nicolas




  reply	other threads:[~2025-12-05 15:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-04  9:08 [PATCH v3 1/3] media: v4l2-mem2mem: Add a kref to the v4l2_m2m_dev structure ming.qian
2025-12-04  9:08 ` [PATCH v3 2/3] pmdomain: imx8m-blk-ctrl: Remove separate rst and clk mask for 8mq vpu ming.qian
2025-12-04 17:24   ` Frank Li
2025-12-04  9:08 ` [PATCH v3 3/3] media: verisilicon: Avoid G2 bus error while decoding H.264 and HEVC ming.qian
2025-12-04 17:34   ` Frank Li
2025-12-04 18:15     ` Nicolas Dufresne
2025-12-04 22:57       ` Frank Li
2025-12-05  0:05         ` Nicolas Dufresne
2025-12-05 15:07           ` Frank Li [this message]
2025-12-04 17:23 ` [PATCH v3 1/3] media: v4l2-mem2mem: Add a kref to the v4l2_m2m_dev structure Frank Li

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=aTL1NrZyeq8g/4Ft@lizhi-Precision-Tower-5810 \
    --to=frank.li@nxp.com \
    --cc=benjamin.gaignard@collabora.com \
    --cc=eagle.zhou@nxp.com \
    --cc=festevam@gmail.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=l.stach@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=ming.qian@oss.nxp.com \
    --cc=nicolas@ndufresne.ca \
    --cc=p.zabel@pengutronix.de \
    --cc=peng.fan@nxp.com \
    --cc=s.hauer@pengutronix.de \
    --cc=sebastian.fricke@collabora.com \
    --cc=shawnguo@kernel.org \
    --cc=ulf.hansson@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox