From patchwork Sun Sep 10 17:50:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 18982 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 707E4C32B0 for ; Sun, 10 Sep 2023 17:52:17 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E7705628EC; Sun, 10 Sep 2023 19:52:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1694368336; bh=srqHSL6BE4Q26xBPeIWB8/NIW+CA8LoFsqhyI5OBVSk=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=PUgsRf4BulCwlcmBeTqrKDsZR5xLioKX4EWY9Or8MoxgMEbO1QmajPghj90+fF2sJ viqOle++oWDHT2hnlkJZaBbtweT99OTT0smzdGRTfk7J8nyXGudlHirWnipAUtum3k tvBnOXg9HyckSeFa0ZyBwpl+n4EMsR7l4y27pDu2hyUWfnNAI4v2rVIcbTOoSwE4Gm GnBmxTW0a9fJksphZ0vE3qx0+39nTGfEbBRVn8UZq6DmGw8VfMmqpwUcccmU5xpoMb 4CzO4nhtBgnbU4zLnaW04mlagJzpSkDYbq1pem6y4vfHxfDT5k167epkpKWrchgEmt 13XzyMZlxvPFA== Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9AAED628EA for ; Sun, 10 Sep 2023 19:52:15 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Zt8bbMNg"; dkim-atps=neutral Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-50091b91a83so5971759e87.3 for ; Sun, 10 Sep 2023 10:52:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694368335; x=1694973135; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bKl/MCKY+YXVhV69y4zaeOVIHgeFK1crRaAAOozssiY=; b=Zt8bbMNgfzHyrIIIGs5+lWifKvMKLWxqBdwMd7EVK5V7NWzbiMfKqAzw9qb2Hdgakq 2mqhQ7Ug+UT/ycb5+TnLDK1hCYuOEknaXdawZ80jSqrbaJaRh3++3dg6jbOPcZC8AXBn Ay6rGXHczj4DgOT/KPYWaxqpdNJ4LsQ//0uL1j8RIJpBoINduV05aTVDrP7dPlH0jQnM bWJEsSiIuCbUUMMFhHfLEg+DhOYY47eOi4HGcdJmwZsjRO9ZgGjKD5fRZWG+GBWSnMEd xfJIjy36IzNZ1mehFtymuExvbu9dSv2Xn53yoHTqfLYkiXhW4EP1nioZzwgMo+zAuQka Hl/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694368335; x=1694973135; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bKl/MCKY+YXVhV69y4zaeOVIHgeFK1crRaAAOozssiY=; b=b0bbbfs/41zUunFBgTHB7Wy4Zabe1Dn7Rg5Ky/RU91ZNHpI/IN531FJwHpwRCdS0k/ dFqLmfo66dEJ9ftRnUjI1mMdJ4ahNp+h/jU+EFjaFM0s5/11JF9e5OM+7iGWtV2/mE1V ip4O69OLAgtGmCyMqfCNXbz7YKI7L3yT6+vdUQFAucHwho6D3q3hlswLlQnjaSmheC4X xHLu3W9T/31+GGGUaBaIZv5lw1hUz15t/ZP6b9spW2O0fB15peBKF4mSIrnVoroJyCZx CjSUgnGDPjpXAtB0viZhpxYDMmg3GrLBVL9bHTfmSFfvx3H/rbkVTesgompgmSONGJvN BHfg== X-Gm-Message-State: AOJu0Yyx4znwmok5TRpWcLwVi/LVflhnvV5zAnDTZjLR3JCPsx3DJGEr L+VIqhx6MTaHupYjwyF4lAw6umVllI/fDhV3qtw= X-Google-Smtp-Source: AGHT+IGZ4Ff4GvgJUemXD30hwIntc0sQEIPde8d57wYVaCd+lHa3rsMEyVdJ1Ezt28DTkFOaXf3xVA== X-Received: by 2002:a05:6512:2256:b0:500:9d6c:913e with SMTP id i22-20020a056512225600b005009d6c913emr6594559lfu.52.1694368334719; Sun, 10 Sep 2023 10:52:14 -0700 (PDT) Received: from Lat-5310.. ([87.116.166.126]) by smtp.gmail.com with ESMTPSA id kd27-20020a17090798db00b009a57d30df89sm4090089ejc.132.2023.09.10.10.52.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Sep 2023 10:52:14 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Sun, 10 Sep 2023 20:50:27 +0300 Message-Id: <20230910175027.23384-4-andrey.konovalov@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230910175027.23384-1-andrey.konovalov@linaro.org> References: <20230910175027.23384-1-andrey.konovalov@linaro.org> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH 3/3] libcamera: pipeline: simple: add software converter support 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: , X-Patchwork-Original-From: Andrey Konovalov via libcamera-devel From: Andrey Konovalov Reply-To: Andrey Konovalov Cc: jacopo.mondi@ideasonboard.com, bryan.odonoghue@linaro.org, srinivas.kandagatla@linaro.org Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Signed-off-by: Andrey Konovalov --- src/libcamera/pipeline/simple/simple.cpp | 34 +++++++++++++++++------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index f0622a74..ee9b672c 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -37,6 +37,7 @@ #include "libcamera/internal/v4l2_subdevice.h" #include "libcamera/internal/v4l2_videodevice.h" +#include "libcamera/internal/converter/converter_softw.h" namespace libcamera { @@ -185,17 +186,21 @@ struct SimplePipelineInfo { * and the number of streams it supports. */ std::vector> converters; + /* + * Nonzero value enables creating software converter + */ + bool enable_sw_converter; }; namespace { static const SimplePipelineInfo supportedDevices[] = { - { "dcmipp", {} }, - { "imx7-csi", { { "pxp", 1 } } }, - { "j721e-csi2rx", {} }, - { "mxc-isi", {} }, - { "qcom-camss", {} }, - { "sun6i-csi", {} }, + { "dcmipp", {}, false }, + { "imx7-csi", { { "pxp", 1 } }, false }, + { "j721e-csi2rx", {}, false }, + { "mxc-isi", {}, false }, + { "qcom-camss", {}, true }, + { "sun6i-csi", {}, false }, }; } /* namespace */ @@ -331,6 +336,7 @@ public: V4L2VideoDevice *video(const MediaEntity *entity); V4L2Subdevice *subdev(const MediaEntity *entity); MediaDevice *converter() { return converter_; } + bool sw_converter_enabled() { return enable_sw_converter_; } protected: int queueRequestDevice(Camera *camera, Request *request) override; @@ -359,6 +365,8 @@ private: std::map entities_; MediaDevice *converter_; + + bool enable_sw_converter_; }; /* ----------------------------------------------------------------------------- @@ -495,6 +503,7 @@ int SimpleCameraData::init() int ret; /* Open the converter, if any. */ + converter_ = nullptr; MediaDevice *converter = pipe->converter(); if (converter) { converter_ = ConverterMDFactoryBase::create(converter); @@ -502,11 +511,16 @@ int SimpleCameraData::init() LOG(SimplePipeline, Warning) << "Failed to create converter, disabling format conversion"; converter_.reset(); - } else { - converter_->inputBufferReady.connect(this, &SimpleCameraData::converterInputDone); - converter_->outputBufferReady.connect(this, &SimpleCameraData::converterOutputDone); } } + /* Don't create sw converter if media device converter is created. */ + if (!converter_ && pipe->sw_converter_enabled()) { + converter_ = std::make_unique(); + } + if (converter_) { + converter_->inputBufferReady.connect(this, &SimpleCameraData::converterInputDone); + converter_->outputBufferReady.connect(this, &SimpleCameraData::converterOutputDone); + } video_ = pipe->video(entities_.back().entity); ASSERT(video_); @@ -1418,6 +1432,8 @@ bool SimplePipelineHandler::match(DeviceEnumerator *enumerator) } } + enable_sw_converter_ = info->enable_sw_converter; + /* Locate the sensors. */ std::vector sensors = locateSensors(); if (sensors.empty()) {