{"id":18926,"url":"https://patchwork.libcamera.org/api/patches/18926/?format=json","web_url":"https://patchwork.libcamera.org/patch/18926/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20230806180136.304156-3-andrey.konovalov@linaro.org>","date":"2023-08-06T18:01:36","name":"[libcamera-devel,RFC,2/2,DNI] libcamera: pipeline: simple: a hack to use sotware converter with qcom-camss","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"d1faafcf08d14cc79be507afb280a1931f045ccf","submitter":{"id":25,"url":"https://patchwork.libcamera.org/api/people/25/?format=json","name":"Andrey Konovalov","email":"andrey.konovalov@linaro.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18926/mbox/","series":[{"id":4001,"url":"https://patchwork.libcamera.org/api/series/4001/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4001","date":"2023-08-06T18:01:34","name":"libcamera: converter: introduce software converter for debayering and AWB","version":1,"mbox":"https://patchwork.libcamera.org/series/4001/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18926/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18926/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 3C487C32A9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun,  6 Aug 2023 18:02:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D4F75627ED;\n\tSun,  6 Aug 2023 20:02:08 +0200 (CEST)","from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com\n\t[IPv6:2a00:1450:4864:20::62a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EC1A0627E9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun,  6 Aug 2023 20:02:07 +0200 (CEST)","by mail-ej1-x62a.google.com with SMTP id\n\ta640c23a62f3a-99bccc9ec02so580930466b.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 06 Aug 2023 11:02:07 -0700 (PDT)","from Lat-5310.. ([87.116.165.37]) by smtp.gmail.com with ESMTPSA id\n\tj15-20020a170906430f00b0099b76c3041csm4197396ejm.7.2023.08.06.11.02.06\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSun, 06 Aug 2023 11:02:07 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1691344928;\n\tbh=DQrF5txzyFHQbU1zoqKHmA7Mq6yOXX+tka4gc5W3Oyo=;\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=Qt9WqEMMGQzh4I8UJWf6PRWOgfer320RUcKCBWR/nztGVud5adtSn7piDipa6Ug1e\n\tWzAdaODaCsqYylSHrmRGUHPP/yGIZ5GxYlqvER+4WkZHT6QKXLzv1RtCO2jauOP/VS\n\teccZd3L4q6vfm9icurnPAKI/zUSXvkUbj9hc4G6gJbWcXKY81vb4/F9wc0t6XFDKi4\n\tMEgPvscsZ6TWjnysXTNNNiJaAsgJ1NXJ23sSiaOF2Ehatv8nzDt6Jw1G7C9E7azv4e\n\tsznl/0C3psZrf69xiZV1ULabP4T1IgCtfJQoIAhHS/1Ut9XFzQAfJwOcMiMzWXO5Z+\n\tSuYlC6G8G0lmA==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1691344927; x=1691949727;\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=/YB7of9WDJI9hMhptxdPm9+Lbuqc8NzAVcGxXJhM5bM=;\n\tb=U0BVmJ9ZP/NONAAccAjbbxelnMUeCICUt2MuQ72WpG1+0wiU5NXfehefYnXxgQBW5B\n\t5OKGGjBpTULvGglqyHzmD97zhSd0nzhDPQ0sYLMUO3nbJEtNHPJDImDRj4RVRE4Vu8ek\n\t+su4BQzxFbF6aRBH/MqFOPEOblQat9NTccQSQd+c073j3TdnfnQTq4NEgANzzrYBLx6R\n\t5Ci2CgAbTKIlWjQb0FP8iKIzyC+aFr9sfIUSOTfH3OsHcw8EPRYgVADpiYJevqa7h78G\n\tT5e1mMk9xIwZ7Z5fTKDZrpcsmLX9umt6fvAKwrglLpJw/8REULoCmYndzII3T7Qa3ii7\n\tWuTA=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=linaro.org\n\theader.i=@linaro.org header.b=\"U0BVmJ9Z\"; \n\tdkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20221208; t=1691344927; x=1691949727;\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=/YB7of9WDJI9hMhptxdPm9+Lbuqc8NzAVcGxXJhM5bM=;\n\tb=BjpTJ83RTq9ED2SYyLVDpM0ijHcpakND5apy4ejjFJee6hyN68qEwVVz7gm4L8C6tJ\n\tYwOMzo2a5tHJ2xiQ5a9GA3TiaZJAvIUANSEv6Op7TEPgpuyzf4stfaJklxJy7niABaoN\n\tK1g5UrvzxVDjNTqY4We6uH7nT0t2gxoarV0f7izYKZP+w1v+UD7hJKtBFf9p009qhvs1\n\tLcOzzBNZlEITuk8xO81zdo/8q9mq0YadCG9Zx5dqgSRWxzWobQZ2HZWyRRBnmOlaMN0Z\n\t+ZXeBKK9Wqd0w7I/f3QKZ06VuHPksNkVw1iwC0I+AkEJcT8uzjTykClAJ6uZ5tWLOFdG\n\tt2bA==","X-Gm-Message-State":"AOJu0YzJWrnLp2cT2CfU4/tiIv/GIhFCueIJ1ndDZSprq66DY0oFOraB\n\tFWKrL2mstZFIshOUNJEtYwH/edggD1G63TLQf4Y=","X-Google-Smtp-Source":"AGHT+IGAN9g04jQ6FBC9L2lBHGmVsCPTx+6Kyh2b9XYFX4ZjVIP3JAb3U/5InYvgGS8psbI0j4hnQQ==","X-Received":"by 2002:a17:906:3196:b0:99c:c138:a694 with SMTP id\n\t22-20020a170906319600b0099cc138a694mr4070551ejy.43.1691344927458; \n\tSun, 06 Aug 2023 11:02:07 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Sun,  6 Aug 2023 21:01:36 +0300","Message-Id":"<20230806180136.304156-3-andrey.konovalov@linaro.org>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20230806180136.304156-1-andrey.konovalov@linaro.org>","References":"<20230806180136.304156-1-andrey.konovalov@linaro.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [RFC PATCH 2/2] [DNI] libcamera: pipeline:\n\tsimple: a hack to use sotware converter with qcom-camss","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":"bryan.odonoghue@linaro.org, srinivas.kandagatla@linaro.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Quick and simple hack mostly to avoid calling acquireMediaDevice() for\na converter without a media device underneath.\n\nConverterFactoryBase::create() also relies on MediaDevice, so this\nhack doesn't use it with the software converter for now.\n\nSigned-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>\n---\n src/libcamera/pipeline/simple/simple.cpp | 22 ++++++++++++++++++++--\n 1 file changed, 20 insertions(+), 2 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex 05ba76bc..e5c53003 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@@ -194,7 +195,7 @@ static const SimplePipelineInfo supportedDevices[] = {\n \t{ \"imx7-csi\", { { \"pxp\", 1 } } },\n \t{ \"j721e-csi2rx\", {} },\n \t{ \"mxc-isi\", {} },\n-\t{ \"qcom-camss\", {} },\n+\t{ \"qcom-camss\", { { \"software\", 1 } } },\n \t{ \"sun6i-csi\", {} },\n };\n \n@@ -359,6 +360,11 @@ private:\n \tstd::map<const MediaEntity *, EntityData> entities_;\n \n \tMediaDevice *converter_;\n+\t// dummy function to force Converter to work w/o media device:\n+\tMediaDevice *acquireSoftwareConverter(const char *name)\n+\t{\n+\t\treturn (new MediaDevice(name));\n+\t}\n };\n \n /* -----------------------------------------------------------------------------\n@@ -497,7 +503,11 @@ int SimpleCameraData::init()\n \t/* Open the converter, if any. */\n \tMediaDevice *converter = pipe->converter();\n \tif (converter) {\n-\t\tconverter_ = ConverterFactoryBase::create(converter);\n+\t\t// hack to make Converter to work w/o media device underneath:\n+\t\tif (!converter->isValid() && converter->deviceNode() == \"software\")\n+\t\t\tconverter_ = std::make_unique<SwConverter>(converter);\n+\t\telse\n+\t\t\tconverter_ = ConverterFactoryBase::create(converter);\n \t\tif (!converter_) {\n \t\t\tLOG(SimplePipeline, Warning)\n \t\t\t\t<< \"Failed to create converter, disabling format conversion\";\n@@ -1410,6 +1420,14 @@ bool SimplePipelineHandler::match(DeviceEnumerator *enumerator)\n \t\treturn false;\n \n \tfor (const auto &[name, streams] : info->converters) {\n+\t\tif (!strcmp(name, \"software\")) {\n+\t\t\tconverter_ = acquireSoftwareConverter(name);\n+\t\t\tif (converter_) {\n+\t\t\t\tnumStreams = streams;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\n \t\tDeviceMatch converterMatch(name);\n \t\tconverter_ = acquireMediaDevice(enumerator, converterMatch);\n \t\tif (converter_) {\n","prefixes":["libcamera-devel","RFC","2/2","DNI"]}