Show a patch.

GET /api/1.1/patches/19581/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 19581,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/19581/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19581/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20240229183654.7206-11-hdegoede@redhat.com>",
    "date": "2024-02-29T18:36:21",
    "name": "[v4,10/18] libcamera: introduce SoftwareIsp",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "3a0b05ca849354e9e77befef74adecc6ab82dbac",
    "submitter": {
        "id": 102,
        "url": "https://patchwork.libcamera.org/api/1.1/people/102/?format=api",
        "name": "Hans de Goede",
        "email": "hdegoede@redhat.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/19581/mbox/",
    "series": [
        {
            "id": 4195,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4195/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4195",
            "date": "2024-02-29T18:36:11",
            "name": "libcamera: introduce Software ISP and Software IPA",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/4195/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19581/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19581/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 5F887BD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 29 Feb 2024 18:37:20 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2B56562B3D;\n\tThu, 29 Feb 2024 19:37:20 +0100 (CET)",
            "from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EE53C62872\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 29 Feb 2024 19:37:17 +0100 (CET)",
            "from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com\n\t[66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-639-6--vggSING2tUV-ZTUE2-Q-1; Thu, 29 Feb 2024 13:37:12 -0500",
            "from smtp.corp.redhat.com\n\t(int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\tkey-exchange X25519 server-signature RSA-PSS (2048 bits)\n\tserver-digest SHA256) (No client certificate requested)\n\tby mimecast-mx02.redhat.com (Postfix) with ESMTPS id 47600879849;\n\tThu, 29 Feb 2024 18:37:12 +0000 (UTC)",
            "from shalem.redhat.com (unknown [10.39.192.10])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 1AB671C060AF;\n\tThu, 29 Feb 2024 18:37:11 +0000 (UTC)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"EjPE9aBH\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1709231837;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=V69pnA03S6Y8j6r82EHmdspL5CRhzayZCFIK7ufDdwM=;\n\tb=EjPE9aBH6MV0fZr6Djxfn4uqGEqRShimRLY7gtYNu/yP81cS5siHLrg2ZDQOhIYw/xGO5P\n\tMlo94x0htbq18+0FmZusR01ZvfN+A5AqclkZQnbe6zRD15tMMQGpa0VQ/fMwKNyQ8D2IzM\n\tFer+Ov7lw+7k+aAsYefmOyuk+Xi1phI=",
        "X-MC-Unique": "6--vggSING2tUV-ZTUE2-Q-1",
        "From": "Hans de Goede <hdegoede@redhat.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Subject": "[PATCH v4 10/18] libcamera: introduce SoftwareIsp",
        "Date": "Thu, 29 Feb 2024 19:36:21 +0100",
        "Message-ID": "<20240229183654.7206-11-hdegoede@redhat.com>",
        "In-Reply-To": "<20240229183654.7206-1-hdegoede@redhat.com>",
        "References": "<20240229183654.7206-1-hdegoede@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.4.1 on 10.11.54.7",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain; charset=\"US-ASCII\"; x-default=true",
        "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>",
        "Cc": "Maxime Ripard <mripard@redhat.com>, Pavel Machek <pavel@ucw.cz>,\n\tBryan O'Donoghue <bryan.odonoghue@linaro.org>,\n\tDennis Bonke <admin@dennisbonke.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "From: Andrey Konovalov <andrey.konovalov@linaro.org>\n\nDoxygen documentation by Dennis Bonke.\n\nTested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> # sc8280xp Lenovo x13s\nTested-by: Pavel Machek <pavel@ucw.cz>\nReviewed-by: Pavel Machek <pavel@ucw.cz>\nCo-developed-by: Dennis Bonke <admin@dennisbonke.com>\nSigned-off-by: Dennis Bonke <admin@dennisbonke.com>\nSigned-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>\nSigned-off-by: Hans de Goede <hdegoede@redhat.com>\n---\nChanges in v4:\n- Fix the check of if sharedParams_ were created OK\n\nChanges in v3:\n- SoftISP factory has been removed, there is a just a single SoftwareISP class now\n- The build must be configured with \"-Dpipelines=simple -Dipas=simple\",\n  and the Soft ISP is always compiled. Using the Soft ISP must be enabled per platform\n  through the supportedDevices[] table in the simple pipeline handler.\n- Move software_isp.h/.cpp into the software_isp include/src subdirs\n---\n .../internal/software_isp/meson.build         |   1 +\n .../internal/software_isp/software_isp.h      |  98 +++++\n src/libcamera/software_isp/meson.build        |   1 +\n src/libcamera/software_isp/software_isp.cpp   | 349 ++++++++++++++++++\n 4 files changed, 449 insertions(+)\n create mode 100644 include/libcamera/internal/software_isp/software_isp.h\n create mode 100644 src/libcamera/software_isp/software_isp.cpp",
    "diff": "diff --git a/include/libcamera/internal/software_isp/meson.build b/include/libcamera/internal/software_isp/meson.build\nindex a620e16d..508ddddc 100644\n--- a/include/libcamera/internal/software_isp/meson.build\n+++ b/include/libcamera/internal/software_isp/meson.build\n@@ -2,5 +2,6 @@\n \n libcamera_internal_headers += files([\n     'debayer_params.h',\n+    'software_isp.h',\n     'swisp_stats.h',\n ])\ndiff --git a/include/libcamera/internal/software_isp/software_isp.h b/include/libcamera/internal/software_isp/software_isp.h\nnew file mode 100644\nindex 00000000..8d25e979\n--- /dev/null\n+++ b/include/libcamera/internal/software_isp/software_isp.h\n@@ -0,0 +1,98 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2023, Linaro Ltd\n+ *\n+ * software_isp.h - Simple software ISP implementation\n+ */\n+\n+#pragma once\n+\n+#include <functional>\n+#include <initializer_list>\n+#include <map>\n+#include <memory>\n+#include <string>\n+#include <tuple>\n+#include <vector>\n+\n+#include <libcamera/base/class.h>\n+#include <libcamera/base/log.h>\n+#include <libcamera/base/signal.h>\n+#include <libcamera/base/thread.h>\n+\n+#include <libcamera/geometry.h>\n+#include <libcamera/pixel_format.h>\n+\n+#include <libcamera/ipa/soft_ipa_interface.h>\n+#include <libcamera/ipa/soft_ipa_proxy.h>\n+\n+#include \"libcamera/internal/dma_heaps.h\"\n+#include \"libcamera/internal/pipeline_handler.h\"\n+#include \"libcamera/internal/shared_mem_object.h\"\n+#include \"libcamera/internal/software_isp/debayer_params.h\"\n+\n+namespace libcamera {\n+\n+class DebayerCpu;\n+class FrameBuffer;\n+class PixelFormat;\n+struct StreamConfiguration;\n+\n+LOG_DECLARE_CATEGORY(SoftwareIsp)\n+\n+class SoftwareIsp\n+{\n+public:\n+\tSoftwareIsp(PipelineHandler *pipe, const ControlInfoMap &sensorControls);\n+\t~SoftwareIsp();\n+\n+\tint loadConfiguration([[maybe_unused]] const std::string &filename) { return 0; }\n+\n+\tbool isValid() const;\n+\n+\tstd::vector<PixelFormat> formats(PixelFormat input);\n+\n+\tSizeRange sizes(PixelFormat inputFormat, const Size &inputSize);\n+\n+\tstd::tuple<unsigned int, unsigned int>\n+\tstrideAndFrameSize(const PixelFormat &outputFormat, const Size &size);\n+\n+\tint configure(const StreamConfiguration &inputCfg,\n+\t\t      const std::vector<std::reference_wrapper<StreamConfiguration>> &outputCfgs,\n+\t\t      const ControlInfoMap &sensorControls);\n+\n+\tint exportBuffers(unsigned int output, unsigned int count,\n+\t\t\t  std::vector<std::unique_ptr<FrameBuffer>> *buffers);\n+\n+\tvoid processStats(const ControlList &sensorControls);\n+\n+\tint start();\n+\tvoid stop();\n+\n+\tint queueBuffers(FrameBuffer *input,\n+\t\t\t const std::map<unsigned int, FrameBuffer *> &outputs);\n+\n+\tvoid process(FrameBuffer *input, FrameBuffer *output);\n+\n+\tSignal<FrameBuffer *> inputBufferReady;\n+\tSignal<FrameBuffer *> outputBufferReady;\n+\tSignal<int> ispStatsReady;\n+\tSignal<const ControlList &> setSensorControls;\n+\n+private:\n+\tvoid saveIspParams(int dummy);\n+\tvoid setSensorCtrls(const ControlList &sensorControls);\n+\tvoid statsReady(int dummy);\n+\tvoid inputReady(FrameBuffer *input);\n+\tvoid outputReady(FrameBuffer *output);\n+\n+\tstd::unique_ptr<DebayerCpu> debayer_;\n+\tThread ispWorkerThread_;\n+\tSharedMemObject<DebayerParams> sharedParams_;\n+\tDebayerParams debayerParams_;\n+\tDmaHeap dmaHeap_;\n+\n+\tstd::unique_ptr<ipa::soft::IPAProxySoft> ipa_;\n+};\n+\n+} /* namespace libcamera */\ndiff --git a/src/libcamera/software_isp/meson.build b/src/libcamera/software_isp/meson.build\nindex dd5e70c1..cca2c304 100644\n--- a/src/libcamera/software_isp/meson.build\n+++ b/src/libcamera/software_isp/meson.build\n@@ -3,5 +3,6 @@\n libcamera_sources += files([\n     'debayer.cpp',\n     'debayer_cpu.cpp',\n+    'software_isp.cpp',\n     'swstats_cpu.cpp',\n ])\ndiff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp\nnew file mode 100644\nindex 00000000..388b4496\n--- /dev/null\n+++ b/src/libcamera/software_isp/software_isp.cpp\n@@ -0,0 +1,349 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2023, Linaro Ltd\n+ *\n+ * software_isp.cpp - Simple software ISP implementation\n+ */\n+\n+#include \"libcamera/internal/software_isp/software_isp.h\"\n+\n+#include <sys/mman.h>\n+#include <sys/types.h>\n+#include <unistd.h>\n+\n+#include <libcamera/formats.h>\n+#include <libcamera/stream.h>\n+\n+#include \"libcamera/internal/bayer_format.h\"\n+#include \"libcamera/internal/framebuffer.h\"\n+#include \"libcamera/internal/ipa_manager.h\"\n+#include \"libcamera/internal/mapped_framebuffer.h\"\n+\n+#include \"debayer_cpu.h\"\n+\n+/**\n+ * \\file software_isp.cpp\n+ * \\brief Simple software ISP implementation\n+ */\n+\n+namespace libcamera {\n+\n+LOG_DEFINE_CATEGORY(SoftwareIsp)\n+\n+/**\n+ * \\class SoftwareIsp\n+ * \\brief Class for the Software ISP\n+ */\n+\n+/**\n+ * \\var SoftwareIsp::inputBufferReady\n+ * \\brief A signal emitted when the input frame buffer completes\n+ */\n+\n+/**\n+ * \\var SoftwareIsp::outputBufferReady\n+ * \\brief A signal emitted when the output frame buffer completes\n+ */\n+\n+/**\n+ * \\var SoftwareIsp::ispStatsReady\n+ * \\brief A signal emitted when the statistics for IPA are ready\n+ *\n+ * The int parameter isn't actually used.\n+ */\n+\n+/**\n+ * \\var SoftwareIsp::setSensorControls\n+ * \\brief A signal emitted when the values to write to the sensor controls are ready\n+ */\n+\n+/**\n+ * \\brief Constructs SoftwareIsp object\n+ * \\param[in] pipe The pipeline handler in use\n+ * \\param[in] sensorControls ControlInfoMap describing the controls supported by the sensor\n+ */\n+SoftwareIsp::SoftwareIsp(PipelineHandler *pipe, const ControlInfoMap &sensorControls)\n+\t: debayer_(nullptr),\n+\t  debayerParams_{ DebayerParams::kGain10, DebayerParams::kGain10, DebayerParams::kGain10, 0.5f },\n+\t  dmaHeap_(DmaHeap::DmaHeapFlag::Cma | DmaHeap::DmaHeapFlag::System)\n+{\n+\tif (!dmaHeap_.isValid()) {\n+\t\tLOG(SoftwareIsp, Error) << \"Failed to create DmaHeap object\";\n+\t\treturn;\n+\t}\n+\n+\tsharedParams_ = SharedMemObject<DebayerParams>(\"softIsp_params\");\n+\tif (!sharedParams_) {\n+\t\tLOG(SoftwareIsp, Error) << \"Failed to create shared memory for parameters\";\n+\t\treturn;\n+\t}\n+\n+\tauto stats = std::make_unique<SwStatsCpu>();\n+\tif (!stats->isValid()) {\n+\t\tLOG(SoftwareIsp, Error) << \"Failed to create SwStatsCpu object\";\n+\t\treturn;\n+\t}\n+\tstats->statsReady.connect(this, &SoftwareIsp::statsReady);\n+\n+\tdebayer_ = std::make_unique<DebayerCpu>(std::move(stats));\n+\tdebayer_->inputBufferReady.connect(this, &SoftwareIsp::inputReady);\n+\tdebayer_->outputBufferReady.connect(this, &SoftwareIsp::outputReady);\n+\n+\tipa_ = IPAManager::createIPA<ipa::soft::IPAProxySoft>(pipe, 0, 0);\n+\tif (!ipa_) {\n+\t\tLOG(SoftwareIsp, Error)\n+\t\t\t<< \"Creating IPA for software ISP failed\";\n+\t\tdebayer_.reset();\n+\t\treturn;\n+\t}\n+\n+\tint ret = ipa_->init(IPASettings{ \"No cfg file\", \"No sensor model\" },\n+\t\t\t     debayer_->getStatsFD(),\n+\t\t\t     sharedParams_.fd(),\n+\t\t\t     sensorControls);\n+\tif (ret) {\n+\t\tLOG(SoftwareIsp, Error) << \"IPA init failed\";\n+\t\tdebayer_.reset();\n+\t\treturn;\n+\t}\n+\n+\tipa_->setIspParams.connect(this, &SoftwareIsp::saveIspParams);\n+\tipa_->setSensorControls.connect(this, &SoftwareIsp::setSensorCtrls);\n+\n+\tdebayer_->moveToThread(&ispWorkerThread_);\n+}\n+\n+SoftwareIsp::~SoftwareIsp()\n+{\n+\t/* make sure to destroy the DebayerCpu before the ispWorkerThread_ is gone */\n+\tdebayer_.reset();\n+}\n+\n+/**\n+ * \\fn int SoftwareIsp::loadConfiguration([[maybe_unused]] const std::string &filename)\n+ * \\brief Load a configuration from a file\n+ * \\param[in] filename The file to load the configuration data from\n+ *\n+ * Currently is a stub doing nothing and always returning \"success\".\n+ *\n+ * \\return 0 on success\n+ */\n+\n+/**\n+ * \\brief Process the statistics gathered\n+ * \\param[in] sensorControls The sensor controls\n+ *\n+ * Requests the IPA to calculate new parameters for ISP and new control\n+ * values for the sensor.\n+ */\n+void SoftwareIsp::processStats(const ControlList &sensorControls)\n+{\n+\tASSERT(ipa_);\n+\tipa_->processStats(sensorControls);\n+}\n+\n+/**\n+ * \\brief Check the validity of Software Isp object\n+ * \\return True if Software Isp is valid, false otherwise\n+ */\n+bool SoftwareIsp::isValid() const\n+{\n+\treturn !!debayer_;\n+}\n+\n+/**\n+  * \\brief Get the output formats supported for the given input format\n+  * \\param[in] inputFormat The input format\n+  * \\return All the supported output formats or an empty vector if there are none\n+  */\n+std::vector<PixelFormat> SoftwareIsp::formats(PixelFormat inputFormat)\n+{\n+\tASSERT(debayer_ != nullptr);\n+\n+\treturn debayer_->formats(inputFormat);\n+}\n+\n+/**\n+ * \\brief Get the supported output sizes for the given input format and size\n+ * \\param[in] inputFormat The input format\n+ * \\param[in] inputSize The input frame size\n+ * \\return The valid size range or an empty range if there are none\n+ */\n+SizeRange SoftwareIsp::sizes(PixelFormat inputFormat, const Size &inputSize)\n+{\n+\tASSERT(debayer_ != nullptr);\n+\n+\treturn debayer_->sizes(inputFormat, inputSize);\n+}\n+\n+/**\n+ * Get the output stride and the frame size in bytes for the given output format and size\n+ * \\param[in] outputFormat The output format\n+ * \\param[in] size The output size (width and height in pixels)\n+ * \\return A tuple of the stride and the frame size in bytes, or a tuple of 0,0\n+ * if there is no valid output config\n+ */\n+std::tuple<unsigned int, unsigned int>\n+SoftwareIsp::strideAndFrameSize(const PixelFormat &outputFormat, const Size &size)\n+{\n+\tASSERT(debayer_ != nullptr);\n+\n+\treturn debayer_->strideAndFrameSize(outputFormat, size);\n+}\n+\n+/**\n+ * \\brief Configure the SoftwareIsp object according to the passed in parameters\n+ * \\param[in] inputCfg The input configuration\n+ * \\param[in] outputCfgs The output configurations\n+ * \\param[in] sensorControls ControlInfoMap of the controls supported by the sensor\n+ * \\return 0 on success, a negative errno on failure\n+ */\n+int SoftwareIsp::configure(const StreamConfiguration &inputCfg,\n+\t\t\t   const std::vector<std::reference_wrapper<StreamConfiguration>> &outputCfgs,\n+\t\t\t   const ControlInfoMap &sensorControls)\n+{\n+\tASSERT(ipa_ != nullptr && debayer_ != nullptr);\n+\n+\tint ret = ipa_->configure(sensorControls);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n+\treturn debayer_->configure(inputCfg, outputCfgs);\n+}\n+\n+/**\n+ * \\brief Export the buffers from the Software ISP\n+ * \\param[in] output Output stream index exporting the buffers\n+ * \\param[in] count Number of buffers to allocate\n+ * \\param[out] buffers Vector to store the allocated buffers\n+ * \\return The number of allocated buffers on success or a negative error code\n+ * otherwise\n+ */\n+int SoftwareIsp::exportBuffers(unsigned int output, unsigned int count,\n+\t\t\t       std::vector<std::unique_ptr<FrameBuffer>> *buffers)\n+{\n+\tASSERT(debayer_ != nullptr);\n+\n+\t/* single output for now */\n+\tif (output >= 1)\n+\t\treturn -EINVAL;\n+\n+\tfor (unsigned int i = 0; i < count; i++) {\n+\t\tconst std::string name = \"frame-\" + std::to_string(i);\n+\t\tconst size_t frameSize = debayer_->frameSize();\n+\n+\t\tFrameBuffer::Plane outPlane;\n+\t\toutPlane.fd = SharedFD(dmaHeap_.alloc(name.c_str(), frameSize));\n+\t\tif (!outPlane.fd.isValid()) {\n+\t\t\tLOG(SoftwareIsp, Error)\n+\t\t\t\t<< \"failed to allocate a dma_buf\";\n+\t\t\treturn -ENOMEM;\n+\t\t}\n+\t\toutPlane.offset = 0;\n+\t\toutPlane.length = frameSize;\n+\n+\t\tstd::vector<FrameBuffer::Plane> planes{ outPlane };\n+\t\tbuffers->emplace_back(std::make_unique<FrameBuffer>(std::move(planes)));\n+\t}\n+\n+\treturn count;\n+}\n+\n+/**\n+ * \\brief Queue buffers to Software ISP\n+ * \\param[in] input The input framebuffer\n+ * \\param[in] outputs The container holding the output stream indexes and\n+ * their respective frame buffer outputs\n+ * \\return 0 on success, a negative errno on failure\n+ */\n+int SoftwareIsp::queueBuffers(FrameBuffer *input,\n+\t\t\t      const std::map<unsigned int, FrameBuffer *> &outputs)\n+{\n+\tunsigned int mask = 0;\n+\n+\t/*\n+\t * Validate the outputs as a sanity check: at least one output is\n+\t * required, all outputs must reference a valid stream and no two\n+\t * outputs can reference the same stream.\n+\t */\n+\tif (outputs.empty())\n+\t\treturn -EINVAL;\n+\n+\tfor (auto [index, buffer] : outputs) {\n+\t\tif (!buffer)\n+\t\t\treturn -EINVAL;\n+\t\tif (index >= 1) /* only single stream atm */\n+\t\t\treturn -EINVAL;\n+\t\tif (mask & (1 << index))\n+\t\t\treturn -EINVAL;\n+\n+\t\tmask |= 1 << index;\n+\t}\n+\n+\tprocess(input, outputs.at(0));\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * \\brief Starts the Software ISP streaming operation\n+ * \\return 0 on success, any other value indicates an error\n+ */\n+int SoftwareIsp::start()\n+{\n+\tint ret = ipa_->start();\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tispWorkerThread_.start();\n+\treturn 0;\n+}\n+\n+/**\n+ * \\brief Stops the Software ISP streaming operation\n+ */\n+void SoftwareIsp::stop()\n+{\n+\tispWorkerThread_.exit();\n+\tispWorkerThread_.wait();\n+\n+\tipa_->stop();\n+}\n+\n+/**\n+ * \\brief Passes the input framebuffer to the ISP worker to process\n+ * \\param[in] input The input framebuffer\n+ * \\param[out] output The framebuffer to write the processed frame to\n+ */\n+void SoftwareIsp::process(FrameBuffer *input, FrameBuffer *output)\n+{\n+\tdebayer_->invokeMethod(&DebayerCpu::process,\n+\t\t\t       ConnectionTypeQueued, input, output, debayerParams_);\n+}\n+\n+void SoftwareIsp::saveIspParams([[maybe_unused]] int dummy)\n+{\n+\tdebayerParams_ = *sharedParams_;\n+}\n+\n+void SoftwareIsp::setSensorCtrls(const ControlList &sensorControls)\n+{\n+\tsetSensorControls.emit(sensorControls);\n+}\n+\n+void SoftwareIsp::statsReady(int dummy)\n+{\n+\tispStatsReady.emit(dummy);\n+}\n+\n+void SoftwareIsp::inputReady(FrameBuffer *input)\n+{\n+\tinputBufferReady.emit(input);\n+}\n+\n+void SoftwareIsp::outputReady(FrameBuffer *output)\n+{\n+\toutputBufferReady.emit(output);\n+}\n+\n+} /* namespace libcamera */\n",
    "prefixes": [
        "v4",
        "10/18"
    ]
}