[0/4] media: pisp-be: Split jobs creation and scheduling

Message ID 20240826144338.463683-1-jacopo.mondi@ideasonboard.com (mailing list archive)
Headers
Series media: pisp-be: Split jobs creation and scheduling |

Message

Jacopo Mondi Aug. 26, 2024, 2:43 p.m. UTC
  v1->v2:
- Add two patches to address Laurent's comments separately
- use scoped_guard() when possible
- Add patch to fix runtime_pm imbalance

Currently the 'pispbe_schedule()' function does two things:

1) Tries to assemble a job by inspecting all the video node queues
   to make sure all the required buffers are available
2) Submit the job to the hardware

The pispbe_schedule() function is called at:

- video device start_streaming() time
- video device qbuf() time
- irq handler

As assembling a job requires inspecting all queues, it is a rather
time consuming operation which is better not run in IRQ context.

To avoid executing the time consuming job creation in interrupt
context, split the job creation and job scheduling in two distinct
operations. When a well-formed job is created, append it to the
newly introduced 'pispbe->job_queue' where it will be dequeued from
by the scheduling routine.

At start_streaming() and qbuf() time immediately try to schedule a job
if one has been created as the irq handler routine is only called when
a job has completed, and we can't solely rely on it for scheduling new
jobs.

Jacopo Mondi (4):
  media: pisp_be: Drop reference to non-existing function
  media: pisp_be: Remove config validation from schedule()
  media: pisp-be: Split jobs creation and scheduling
  media: pisp_be: Fix pm_runtime underrun in probe

 .../platform/raspberrypi/pisp_be/pisp_be.c    | 169 ++++++++++--------
 1 file changed, 92 insertions(+), 77 deletions(-)

--
2.45.2