Skip to content
Snippets Groups Projects
  1. Mar 16, 2020
    • Helen Koike's avatar
      media: vimc: use v4l2_pipeline_stream_{enable,disable} helpers · 962636d1
      Helen Koike authored
      
      Use v4l2_pipeline_stream_{enable,disable} to call .s_stream() subdevice
      callbacks through the pipeline.
      
      Tested streaming works with:
      
      media-ctl -d /dev/media0 -V '"Sensor A":0[fmt:SBGGR8_1X8/640x480]'
      media-ctl -d /dev/media0 -V '"Debayer A":0[fmt:SBGGR8_1X8/640x480]'
      media-ctl -d /dev/media0 -V '"Sensor B":0[fmt:SBGGR8_1X8/640x480]'
      media-ctl -d /dev/media0 -V '"Debayer B":0[fmt:SBGGR8_1X8/640x480]'
      media-ctl -d /dev/media0 -V '"Scaler":0[fmt:RGB888_1X24/640x480]'
      media-ctl -d /dev/media0 -V '"Scaler":0[crop:(100,50)/400x150]'
      media-ctl -d /dev/media0 -V '"Scaler":1[fmt:RGB888_1X24/1920x1440]'
      v4l2-ctl -d /dev/video2 -v width=1200,height=450
      v4l2-ctl -d /dev/video0 -v pixelformat=BA81
      v4l2-ctl -d /dev/video1 -v pixelformat=BA81
      v4l2-ctl --stream-mmap --stream-count=10 -d /dev/video2 --stream-to=/tmp/test.raw
      
      Signed-off-by: default avatarHelen Koike <helen.koike@collabora.com>
      
      Series-to: linux-media@vger.kernel.org
      Series-cc: linux-rockchip@lists.infradead.org
      Series-cc: linux-kernel@vger.kernel.org
      Series-cc: mchehab@kernel.org
      Series-cc: hans.verkuil@cisco.com
      Series-cc: kernel@collabora.com
      Series-cc: niklas.soderlund@ragnatech.se
      
      Series-version: 2
      
      Cover-letter:
      media: add v4l2_pipeline_stream_{enable,disable} helpers
      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 stoping 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.
      
      END
      962636d1
    • Helen Koike's avatar
      media: staging: rkisp1: use v4l2_pipeline_stream_{enable,disable} · 0340694d
      Helen Koike authored
      helpers
      
      Use v4l2_pipeline_stream_{enable,disable} to call .s_stream() subdevice
      callbacks through the pipeline.
      
      Tested by streaming on RockPi4 with imx219.
      
      Signed-off-by: default avatarHelen Koike <helen.koike@collabora.com>
      0340694d
    • Helen Koike's avatar
      media: v4l2-common: add helper functions to call s_stream() callbacks · 021a8238
      Helen Koike authored
      
      Add v4l2_pipeline_stream_{enable,disable} helper functions to iterate
      through the subdevices in a given stream (i.e following links from sink
      to source) and call .s_stream() callback.
      
      Add stream_count on the subdevice object for simultaneous streaming from
      different video devices which shares subdevices.
      
      Prevent calling .s_stream(true) if it was already called previously by
      another stream.
      
      Prevent calling .s_stream(false) from one stream when there are still
      others active.
      
      Signed-off-by: default avatarHelen Koike <helen.koike@collabora.com>
      
      Series-changes: 2
      - Fix compiling error: missing curly braces when checking for -ENOIOCTLCMD error
      021a8238
    • Helen Koike's avatar
      media: mc-entity.c: add media_graph_walk_next_stream() · 67a9ef6d
      Helen Koike authored
      
      Add media_graph_walk_next_stream() function to follow links only from
      sink to source (not the opposite) to allow iteration only through the
      entities participating in a given stream.
      
      This is useful to allow calling .s_stream() callback only in the
      subdevices that requires to be enabled/disabled, and avoid calling this
      callback when not required.
      
      Signed-off-by: default avatarHelen Koike <helen.koike@collabora.com>
      67a9ef6d
  2. Mar 13, 2020
  3. Mar 12, 2020
Loading