mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
To: "jackson.lee" <jackson.lee@chipsnmedia.com>,
	"mchehab@kernel.org"	 <mchehab@kernel.org>,
	"hverkuil-cisco@xs4all.nl" <hverkuil-cisco@xs4all.nl>,
	 "bob.beckett@collabora.com"	 <bob.beckett@collabora.com>
Cc: "linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	 "linux-kernel@vger.kernel.org"	 <linux-kernel@vger.kernel.org>,
	"lafley.kim" <lafley.kim@chipsnmedia.com>,
	 "b-brnich@ti.com"	 <b-brnich@ti.com>,
	"hverkuil@xs4all.nl" <hverkuil@xs4all.nl>,
	Nas Chung	 <nas.chung@chipsnmedia.com>
Subject: Re: [PATCH v2 2/7] media: chips-media: wave5: Improve performance of decoder
Date: Wed, 04 Jun 2025 09:47:34 -0400	[thread overview]
Message-ID: <1318bd68f2d60b9d44cb22bd90b92399311f0b00.camel@collabora.com> (raw)
In-Reply-To: <SE1P216MB13033207BDFE2A6BCC48999EED6CA@SE1P216MB1303.KORP216.PROD.OUTLOOK.COM>

Le mercredi 04 juin 2025 à 04:09 +0000, jackson.lee a écrit :
> > Running in loop anything is never the right approach. The device_run()
> > should be run when a useful event occur and filtered by the job_ready()
> > ops. I believe I'm proposing some hint how to solve this design issue. The
> > issue is quite clear with the follow up patch trying to reduce the CPU
> > usage due to spinning.
> 
> 
> 
> Thanks for your feedback.
> But there is one thing to say to you.
> After receiving EOS from application, we have to periodically run the device_run
> to send the DEC_PIC command so that VPU can trigger interrupt  until getting all 
> decoded frames and EOS from Get_Result command.
> So even if we sent EOS to VPU once, we should run the device_run function continuously,
> the above code was added. If the job_ready returns false to prevent running the
> device_run after sending EOS to VPU, then GStreamer pipeline will not be terminated 
> normally because of not receiving all decoded frames.

This, in my opinion, boils down to a small flaw, either in the firmware or the driver.
This is why there was this code:

-
-	/*
-	 * During a resolution change and while draining, the firmware may flush
-	 * the reorder queue regardless of having a matching decoding operation
-	 * pending. Only terminate the job if there are no more IRQ coming.
-	 */
-	wave5_vpu_dec_give_command(inst, DEC_GET_QUEUE_STATUS, &q_status);
-	if (q_status.report_queue_count == 0 &&
-	    (q_status.instance_queue_count == 0 || dec_info.sequence_changed)) {
-		dev_dbg(inst->dev->dev, "%s: finishing job.\n", __func__);
-		pm_runtime_mark_last_busy(inst->dev->dev);
-		pm_runtime_put_autosuspend(inst->dev->dev);
-		v4l2_m2m_job_finish(inst->v4l2_m2m_dev, m2m_ctx);
-	}

Which you removed in this patch, as it makes it impossible to utilise the HW queues.
In the specific case you described, if my memory is right, the CMD_STOP (EOS in your
terms) comes in race with the queue being consumed, leading to possibly having no
event to figure-out when we are done with that sequenece.

V4L2 M2M is all event based, and v4l2_m2m_job_finish() is one of those. But in the
new implementation, this event no longer correlate with the HW being idle.
This is fine, don't read me wrong. It now matches the driver being ready to try and
queue more work.

So my question is, is there a way to know, at CMD_STOP call, that the HW
has gone idle, and that no more events will allow handling the EOS case?

Nicolas

  reply	other threads:[~2025-06-04 13:47 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-22  7:25 [PATCH v2 0/7] Performance improvement " Jackson.lee
2025-05-22  7:26 ` [PATCH v2 1/7] media: chips-media: wave5: Fix Null reference while testing fluster Jackson.lee
2025-05-23 17:20   ` Nicolas Dufresne
2025-05-27  4:05     ` jackson.lee
2025-05-27 12:57       ` Nicolas Dufresne
2025-05-22  7:26 ` [PATCH v2 2/7] media: chips-media: wave5: Improve performance of decoder Jackson.lee
2025-05-23 17:39   ` Nicolas Dufresne
2025-05-27  4:58     ` jackson.lee
2025-05-28 13:46       ` Nicolas Dufresne
2025-06-04  4:09         ` jackson.lee
2025-06-04 13:47           ` Nicolas Dufresne [this message]
2025-06-05  4:50             ` jackson.lee
2025-06-05 13:28               ` Nicolas Dufresne
2025-06-09  8:47                 ` jackson.lee
2025-05-30 14:33       ` Nicolas Dufresne
2025-05-22  7:26 ` [PATCH v2 3/7] media: chips-media: wave5: Fix not to be closed Jackson.lee
2025-05-22  7:26 ` [PATCH v2 4/7] media: chips-media: wave5: Use spinlock whenever statue is changed Jackson.lee
2025-05-23 17:41   ` Nicolas Dufresne
2025-05-27  5:02     ` jackson.lee
2025-05-28 13:49       ` Nicolas Dufresne
2025-05-22  7:26 ` [PATCH v2 5/7] media: chips-media: wave5: Fix not to free resources normally when instance was destroyed Jackson.lee
2025-05-23 17:42   ` Nicolas Dufresne
2025-05-27  5:04     ` jackson.lee
2025-05-22  7:26 ` [PATCH v2 6/7] media: chips-media: wave5: Reduce high CPU load Jackson.lee
2025-05-23 17:43   ` Nicolas Dufresne
2025-05-27  5:05     ` jackson.lee
2025-05-22  7:26 ` [PATCH v2 7/7] media: chips-media: wave5: Fix SError of kernel panic when closed Jackson.lee
2025-05-23 17:48   ` Nicolas Dufresne
2025-05-27  5:07     ` jackson.lee

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=1318bd68f2d60b9d44cb22bd90b92399311f0b00.camel@collabora.com \
    --to=nicolas.dufresne@collabora.com \
    --cc=b-brnich@ti.com \
    --cc=bob.beckett@collabora.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=hverkuil@xs4all.nl \
    --cc=jackson.lee@chipsnmedia.com \
    --cc=lafley.kim@chipsnmedia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=nas.chung@chipsnmedia.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

all inboxes | Powered by JetHome®