{"id":18982,"url":"https://patchwork.libcamera.org/api/1.1/patches/18982/?format=json","web_url":"https://patchwork.libcamera.org/patch/18982/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20230910175027.23384-4-andrey.konovalov@linaro.org>","date":"2023-09-10T17:50:27","name":"[libcamera-devel,RFC,3/3] libcamera: pipeline: simple: add software converter support","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"ace4af1cbf5623ce978ef42ab67b1ec429b9bca4","submitter":{"id":25,"url":"https://patchwork.libcamera.org/api/1.1/people/25/?format=json","name":"Andrey Konovalov","email":"andrey.konovalov@linaro.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18982/mbox/","series":[{"id":4014,"url":"https://patchwork.libcamera.org/api/1.1/series/4014/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4014","date":"2023-09-10T17:50:24","name":"libcamera: converter: generalize Converter to remove MediaDevice dependency","version":1,"mbox":"https://patchwork.libcamera.org/series/4014/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18982/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18982/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 707E4C32B0\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 10 Sep 2023 17:52:17 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E7705628EC;\n\tSun, 10 Sep 2023 19:52:16 +0200 (CEST)","from mail-lf1-x132.google.com (mail-lf1-x132.google.com\n\t[IPv6:2a00:1450:4864:20::132])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9AAED628EA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 10 Sep 2023 19:52:15 +0200 (CEST)","by mail-lf1-x132.google.com with SMTP id\n\t2adb3069b0e04-50091b91a83so5971759e87.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 10 Sep 2023 10:52:15 -0700 (PDT)","from Lat-5310.. ([87.116.166.126]) by smtp.gmail.com with ESMTPSA\n\tid\n\tkd27-20020a17090798db00b009a57d30df89sm4090089ejc.132.2023.09.10.10.52.14\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSun, 10 Sep 2023 10:52:14 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1694368336;\n\tbh=srqHSL6BE4Q26xBPeIWB8/NIW+CA8LoFsqhyI5OBVSk=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=PUgsRf4BulCwlcmBeTqrKDsZR5xLioKX4EWY9Or8MoxgMEbO1QmajPghj90+fF2sJ\n\tviqOle++oWDHT2hnlkJZaBbtweT99OTT0smzdGRTfk7J8nyXGudlHirWnipAUtum3k\n\ttvBnOXg9HyckSeFa0ZyBwpl+n4EMsR7l4y27pDu2hyUWfnNAI4v2rVIcbTOoSwE4Gm\n\tGnBmxTW0a9fJksphZ0vE3qx0+39nTGfEbBRVn8UZq6DmGw8VfMmqpwUcccmU5xpoMb\n\t4CzO4nhtBgnbU4zLnaW04mlagJzpSkDYbq1pem6y4vfHxfDT5k167epkpKWrchgEmt\n\t13XzyMZlxvPFA==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1694368335; x=1694973135;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=bKl/MCKY+YXVhV69y4zaeOVIHgeFK1crRaAAOozssiY=;\n\tb=Zt8bbMNgfzHyrIIIGs5+lWifKvMKLWxqBdwMd7EVK5V7NWzbiMfKqAzw9qb2Hdgakq\n\t2mqhQ7Ug+UT/ycb5+TnLDK1hCYuOEknaXdawZ80jSqrbaJaRh3++3dg6jbOPcZC8AXBn\n\tAy6rGXHczj4DgOT/KPYWaxqpdNJ4LsQ//0uL1j8RIJpBoINduV05aTVDrP7dPlH0jQnM\n\tbWJEsSiIuCbUUMMFhHfLEg+DhOYY47eOi4HGcdJmwZsjRO9ZgGjKD5fRZWG+GBWSnMEd\n\txfJIjy36IzNZ1mehFtymuExvbu9dSv2Xn53yoHTqfLYkiXhW4EP1nioZzwgMo+zAuQka\n\tHl/w=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=linaro.org\n\theader.i=@linaro.org header.b=\"Zt8bbMNg\"; \n\tdkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1694368335; x=1694973135;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=bKl/MCKY+YXVhV69y4zaeOVIHgeFK1crRaAAOozssiY=;\n\tb=b0bbbfs/41zUunFBgTHB7Wy4Zabe1Dn7Rg5Ky/RU91ZNHpI/IN531FJwHpwRCdS0k/\n\tdFqLmfo66dEJ9ftRnUjI1mMdJ4ahNp+h/jU+EFjaFM0s5/11JF9e5OM+7iGWtV2/mE1V\n\tip4O69OLAgtGmCyMqfCNXbz7YKI7L3yT6+vdUQFAucHwho6D3q3hlswLlQnjaSmheC4X\n\txHLu3W9T/31+GGGUaBaIZv5lw1hUz15t/ZP6b9spW2O0fB15peBKF4mSIrnVoroJyCZx\n\tCjSUgnGDPjpXAtB0viZhpxYDMmg3GrLBVL9bHTfmSFfvx3H/rbkVTesgompgmSONGJvN\n\tBHfg==","X-Gm-Message-State":"AOJu0Yyx4znwmok5TRpWcLwVi/LVflhnvV5zAnDTZjLR3JCPsx3DJGEr\n\tL+VIqhx6MTaHupYjwyF4lAw6umVllI/fDhV3qtw=","X-Google-Smtp-Source":"AGHT+IGZ4Ff4GvgJUemXD30hwIntc0sQEIPde8d57wYVaCd+lHa3rsMEyVdJ1Ezt28DTkFOaXf3xVA==","X-Received":"by 2002:a05:6512:2256:b0:500:9d6c:913e with SMTP id\n\ti22-20020a056512225600b005009d6c913emr6594559lfu.52.1694368334719; \n\tSun, 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","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [RFC PATCH 3/3] libcamera: pipeline: simple: add\n\tsoftware converter support","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Andrey Konovalov via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Andrey Konovalov <andrey.konovalov@linaro.org>","Cc":"jacopo.mondi@ideasonboard.com, bryan.odonoghue@linaro.org,\n\tsrinivas.kandagatla@linaro.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>\n---\n src/libcamera/pipeline/simple/simple.cpp | 34 +++++++++++++++++-------\n 1 file changed, 25 insertions(+), 9 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex f0622a74..ee9b672c 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -37,6 +37,7 @@\n #include \"libcamera/internal/v4l2_subdevice.h\"\n #include \"libcamera/internal/v4l2_videodevice.h\"\n \n+#include \"libcamera/internal/converter/converter_softw.h\"\n \n namespace libcamera {\n \n@@ -185,17 +186,21 @@ struct SimplePipelineInfo {\n \t * and the number of streams it supports.\n \t */\n \tstd::vector<std::pair<const char *, unsigned int>> converters;\n+\t/*\n+\t * Nonzero value enables creating software converter\n+\t */\n+\tbool enable_sw_converter;\n };\n \n namespace {\n \n static const SimplePipelineInfo supportedDevices[] = {\n-\t{ \"dcmipp\", {} },\n-\t{ \"imx7-csi\", { { \"pxp\", 1 } } },\n-\t{ \"j721e-csi2rx\", {} },\n-\t{ \"mxc-isi\", {} },\n-\t{ \"qcom-camss\", {} },\n-\t{ \"sun6i-csi\", {} },\n+\t{ \"dcmipp\", {}, false },\n+\t{ \"imx7-csi\", { { \"pxp\", 1 } }, false },\n+\t{ \"j721e-csi2rx\", {}, false },\n+\t{ \"mxc-isi\", {}, false },\n+\t{ \"qcom-camss\", {}, true },\n+\t{ \"sun6i-csi\", {}, false },\n };\n \n } /* namespace */\n@@ -331,6 +336,7 @@ public:\n \tV4L2VideoDevice *video(const MediaEntity *entity);\n \tV4L2Subdevice *subdev(const MediaEntity *entity);\n \tMediaDevice *converter() { return converter_; }\n+\tbool sw_converter_enabled() { return enable_sw_converter_; }\n \n protected:\n \tint queueRequestDevice(Camera *camera, Request *request) override;\n@@ -359,6 +365,8 @@ private:\n \tstd::map<const MediaEntity *, EntityData> entities_;\n \n \tMediaDevice *converter_;\n+\n+\tbool enable_sw_converter_;\n };\n \n /* -----------------------------------------------------------------------------\n@@ -495,6 +503,7 @@ int SimpleCameraData::init()\n \tint ret;\n \n \t/* Open the converter, if any. */\n+\tconverter_ = nullptr;\n \tMediaDevice *converter = pipe->converter();\n \tif (converter) {\n \t\tconverter_ = ConverterMDFactoryBase::create(converter);\n@@ -502,11 +511,16 @@ int SimpleCameraData::init()\n \t\t\tLOG(SimplePipeline, Warning)\n \t\t\t\t<< \"Failed to create converter, disabling format conversion\";\n \t\t\tconverter_.reset();\n-\t\t} else {\n-\t\t\tconverter_->inputBufferReady.connect(this, &SimpleCameraData::converterInputDone);\n-\t\t\tconverter_->outputBufferReady.connect(this, &SimpleCameraData::converterOutputDone);\n \t\t}\n \t}\n+\t/* Don't create sw converter if media device converter is created. */\n+\tif (!converter_ && pipe->sw_converter_enabled()) {\n+\t\tconverter_ = std::make_unique<SwConverter>();\n+\t}\n+\tif (converter_) {\n+\t\tconverter_->inputBufferReady.connect(this, &SimpleCameraData::converterInputDone);\n+\t\tconverter_->outputBufferReady.connect(this, &SimpleCameraData::converterOutputDone);\n+\t}\n \n \tvideo_ = pipe->video(entities_.back().entity);\n \tASSERT(video_);\n@@ -1418,6 +1432,8 @@ bool SimplePipelineHandler::match(DeviceEnumerator *enumerator)\n \t\t}\n \t}\n \n+\tenable_sw_converter_ = info->enable_sw_converter;\n+\n \t/* Locate the sensors. */\n \tstd::vector<MediaEntity *> sensors = locateSensors();\n \tif (sensors.empty()) {\n","prefixes":["libcamera-devel","RFC","3/3"]}