From patchwork Sun Jan 31 22:46:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 11079 X-Patchwork-Delegate: laurent.pinchart@ideasonboard.com Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 37BE2BD808 for ; Sun, 31 Jan 2021 22:47:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 93219683D5; Sun, 31 Jan 2021 23:47:28 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="R2w50nGK"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 990F6683D0 for ; Sun, 31 Jan 2021 23:47:27 +0100 (CET) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E96C3813; Sun, 31 Jan 2021 23:47:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1612133247; bh=tJ55nVQxwrrq4z25RkZt8jGhvwIWsOmERVAAOU8GjpI=; h=From:To:Cc:Subject:Date:From; b=R2w50nGKyLWkGixRayyGGlkCltFKUGJilRw+p+mHLD41Kquf5NHrQE7N8Sw6RSezM hk0e38PPubQdopjsoPmW8TvEqHQksLaQRHyxs+4XpN0nQWYpWKA1B3lkR9VP03W2Zd AyHx+2YXsAU4l9vUMNsztSBGaZL7NITeeNm9VoYA= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Mon, 1 Feb 2021 00:46:42 +0200 Message-Id: <20210131224702.8838-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 00/20] libcamera: Multi-stream support for the simple pipeline handler X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Phi-Bang Nguyen Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hello, This patch series implements multi-stream support in the simple pipeline handler. Multi-stream support in the capture device requires hardware processing capabilities (at least format conversion and scaling), which would likely not qualify the platform for support in the simple pipeline handler. However, for platforms that include a converter, the V4L2 M2M API allows opening multiple instances of the converter to create multiple output streams with different formats and resolution (as long as the hardware has enough bandwidth to run all the processing passes). This approach is generic and doesn't require any extra hardware feature compared to what the simple pipeline handler already uses. The patches starts with refactoring of the converter class to prepare for multiple streams support, and then refactors the simple pipeline handler to achieve the same goal. The last two patches enable multi-streams support The code has been tested on the MediaTek Pumpkin i500 board. Its support isn't available in the simple pipeline handler yet due to the drivers not being upstream, which is an issue that is being addressed. Enabling it, after importing the kernel headers that define the MediaTek-specific pixel formats and enabling them in libcamera, only requires the following change in the simple pipeline handler. Laurent Pinchart (20): libcamera: pipeline: simple: Manage converter with std::unique_ptr<> libcamera: pipeline: simple: Don't override stride at configure time libcamera: pipeline: simple: converter: Group query functions together libcamera: pipeline: simple: converter: Use StreamConfiguration for input configuration libcamera: pipeline: simple: converter: Configure input stride libcamera: pipeline: simple: converter: Differentiate input and output buffers count libcamera: pipeline: simple: converter: Replace open() with isValid() libcamera: pipeline: simple: converter: Decouple input and output completion libcamera: pipeline: simple: converter: Add multi-stream support libcamera: pipeline: simple: Store streams in a vector libcamera: pipeline: simple: Drop unused members of configuration libcamera: pipeline: simple: Document the pipeline handler design libcamera: pipeline: simple: Rename Configuration::pixelFormat libcamera: pipeline: simple: Cache pipeline config in SimpleCameraConfiguration libcamera: pipeline: simple: Add output formats to Configuration libcamera: pipeline: simple: Move converter data to camera data libcamera: pipeline: simple: Hardcode the number of internal buffers libcamera: pipeline: simple: Support configuration of multiple streams libcamera: pipeline: simple: Support usage of multiple streams libcamera: pipeline: simple: Enable multiple streams for compatible devices src/libcamera/pipeline/simple/converter.cpp | 398 ++++++++------ src/libcamera/pipeline/simple/converter.h | 60 ++- src/libcamera/pipeline/simple/simple.cpp | 542 +++++++++++++------- 3 files changed, 650 insertions(+), 350 deletions(-) Tested-by: Phi-Bang Nguyen diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 55a5528611c8..6b0170d1aba8 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -132,6 +132,7 @@ namespace { static const SimplePipelineInfo supportedDevices[] = { { "imx7-csi", "pxp", 1 }, + { "mtk-camsv-p1", "mtk-mdp3", 3 }, { "qcom-camss", nullptr, 1 }, { "sun6i-csi", nullptr, 1 }, };