Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2938145ybh; Mon, 16 Mar 2020 12:34:33 -0700 (PDT) X-Received: by 2002:aca:ea46:: with SMTP id i67mr777756oih.149.1584387242084; Mon, 16 Mar 2020 12:34:02 -0700 (PDT) X-Google-Smtp-Source: ADFU+vt9ZTWHJWYZ+B/GYx+5jS/WDoyRqH75roo7Myt1s48bBcNvFwScdOIk16FVm3c3pSxqXX6X X-Received: by 2002:aca:ea46:: with SMTP id i67mr777709oih.149.1584387241352; Mon, 16 Mar 2020 12:34:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584387241; cv=none; d=google.com; s=arc-20160816; b=Mpm0qhHYlllTT5hxACw3HHhvtEstnLM7JMpHhfum56cNOOcdCEuVB1WzTTKfnRoFl9 87BkKTN8blY89Q5EUIjDjrAU90GsRZNNO6/+OyD0yoAy4oD/1vTktCnH+eizoT9eYM00 Y3vH1E0mk4wTFfsCnP1+8smPgEyNuCzZYUA+Ui5zgj/z+qOHUYAuZa+3ufUPVvCW5EpT J/q+yedI9IaOzfLuKCviiqdrwRkU4ChbmWryT9rPVbCf0DP6tMNsjxAGJvCsIpqgU/H2 oRLS318QG4agV7EwUj7anNn1NrYmTULKLAezWQtxm/bVUDX/e2gV9kbGKlsuUy3oHnHf E0Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=aVSElA3Wrwlv6o+v7LrV8hdU//I+IK/ePB8A597M8rM=; b=aFD2dw3k5+HePqNgJgC8M7VSsGmHdIb3QfTQtaPNrOS2cckvdPXUS9e+tVJHAoG3qX NfifEd+ff9VPbZYBY860mPE4/VtI1TCQycrTjKt/B2muNEsR39kmuwHOps5QlEfwvoX3 4Km33MnKvqUpMp7WgHTNcz3inUTIFSSfunBmOnObnf0YClStJyBEvnWUQQQJJAksGNTQ sjTEC5rOAuNn6fTo+Zj/0ubxK0rT504OeCHddstL8zpZSn67Oe/GXVH/MsUsxF++RIfy ptdREuwyAc9pBvGjFv/7PdebQ7br3n57LoMlp0FS+FsvvK5icqczvlP3g0JZMISYnibU S9Jw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j192si418392oih.233.2020.03.16.12.33.48; Mon, 16 Mar 2020 12:34:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732480AbgCPTdU (ORCPT + 99 others); Mon, 16 Mar 2020 15:33:20 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:51844 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732366AbgCPTdU (ORCPT ); Mon, 16 Mar 2020 15:33:20 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: koike) with ESMTPSA id CAFCD293369 From: Helen Koike 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 Subject: [PATCH 0/4] media: add v4l2_pipeline_stream_{enable,disable} helpers Date: Mon, 16 Mar 2020 16:33:01 -0300 Message-Id: <20200316193305.428378-1-helen.koike@collabora.com> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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