mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Helen Koike <helen.koike@collabora.com>
To: linux-media@vger.kernel.org
Cc: kernel@collabora.com, linux-kernel@vger.kernel.org,
	linux-rockchip@lists.infradead.org, hans.verkuil@cisco.com,
	niklas.soderlund@ragnatech.se, mchehab@kernel.org,
	Helen Koike <helen.koike@collabora.com>
Subject: [PATCH 0/4] media: add v4l2_pipeline_stream_{enable,disable} helpers
Date: Mon, 16 Mar 2020 16:33:01 -0300	[thread overview]
Message-ID: <20200316193305.428378-1-helen.koike@collabora.com> (raw)

Hi,

Media drivers need to iterate through the pipeline and call .s_stream()
callbacks in the subdevices.

Instead of repeating code, add helpers for this.

These helpers will go walk through the pipeline only visiting entities
that participates in the stream, i.e. it follow link from sink to source
(and not the opposite).

Which means that in a topology like this https://bit.ly/3b2MxjI
calling v4l2_pipeline_stream_enable() from rkisp1_mainpath won't call
.s_stream(true) for rkisp1_resizer_selfpath.

stream_count variable was added in v4l2_subdevice to handle nested calls
to the helpers.
This is useful when the driver allows streaming from more then one
capture device sharing subdevices.

This patch came from the error I was facing when multistreaming from
rkisp1 driver, where stopping one capture would call s_stream(false) in
the pipeline, causing a stall in the second capture device.

Also, the vimc patch https://patchwork.kernel.org/patch/10948833/ won't
be required with this patchset.

This patchset was tested on rkisp1 and vimc drivers.

Other cleanup might be possible (but I won't add in this patchset as I
don't have the hw to test):
	https://git.linuxtv.org/media_tree.git/tree/drivers/media/platform/omap3isp/isp.c#n697
	https://git.linuxtv.org/media_tree.git/tree/drivers/media/platform/qcom/camss/camss-video.c#n430
	https://git.linuxtv.org/media_tree.git/tree/drivers/media/platform/stm32/stm32-dcmi.c#n680
	https://git.linuxtv.org/media_tree.git/tree/drivers/media/platform/xilinx/xilinx-dma.c#n97

Overview of patches:
====================

Patch 1/4 adds a new iterator function to follow links from sink to
source only.

Path 2/4 adds the helpers in v4l2-common.c, allowing nested calls by
adding stream_count in the subdevice struct.

Patch 3/4 cleanup rkisp1 driver to use the helpers.

Patch 4/4 cleanup vimc driver to use the helpers.


Helen Koike (4):
  media: mc-entity.c: add media_graph_walk_next_stream()
  media: v4l2-common: add helper functions to call s_stream() callbacks
  media: staging: rkisp1: use v4l2_pipeline_stream_{enable,disable}
    helpers
  media: vimc: use v4l2_pipeline_stream_{enable,disable} helpers

 drivers/media/mc/mc-entity.c                  | 34 ++++++-
 drivers/media/platform/vimc/vimc-capture.c    | 28 ++++--
 drivers/media/platform/vimc/vimc-streamer.c   | 49 +--------
 drivers/media/v4l2-core/v4l2-common.c         | 99 +++++++++++++++++++
 drivers/staging/media/rkisp1/rkisp1-capture.c | 74 +-------------
 include/media/media-entity.h                  | 15 +++
 include/media/v4l2-common.h                   | 30 ++++++
 include/media/v4l2-subdev.h                   |  2 +
 8 files changed, 204 insertions(+), 127 deletions(-)

-- 
2.25.0


             reply	other threads:[~2020-03-16 19:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-16 19:33 Helen Koike [this message]
2020-03-16 19:33 ` [PATCH 1/4] media: mc-entity.c: add media_graph_walk_next_stream() Helen Koike
2020-03-16 19:33 ` [PATCH 2/4] media: v4l2-common: add helper functions to call s_stream() callbacks Helen Koike
2020-03-16 20:50   ` Helen Koike
2020-03-16 19:33 ` [PATCH 3/4] media: staging: rkisp1: use v4l2_pipeline_stream_{enable,disable} helpers Helen Koike
2020-03-16 19:33 ` [PATCH 4/4] media: vimc: " Helen Koike

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=20200316193305.428378-1-helen.koike@collabora.com \
    --to=helen.koike@collabora.com \
    --cc=hans.verkuil@cisco.com \
    --cc=kernel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mchehab@kernel.org \
    --cc=niklas.soderlund@ragnatech.se \
    /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®