Patch Detail
Show a patch.
GET /api/1.1/patches/20876/?format=api
{ "id": 20876, "url": "https://patchwork.libcamera.org/api/1.1/patches/20876/?format=api", "web_url": "https://patchwork.libcamera.org/patch/20876/", "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": "<20240812115009.946036-3-mzamazal@redhat.com>", "date": "2024-08-12T11:49:51", "name": "[02/16] libcamera: software_isp: Introduce arguments for parameters buffers", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "f588ea3625bc5d10b4e4e12dc0c4638679cfe04d", "submitter": { "id": 177, "url": "https://patchwork.libcamera.org/api/1.1/people/177/?format=api", "name": "Milan Zamazal", "email": "mzamazal@redhat.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/20876/mbox/", "series": [ { "id": 4511, "url": "https://patchwork.libcamera.org/api/1.1/series/4511/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4511", "date": "2024-08-12T11:49:49", "name": "Software ISP: Share params and stats buffers", "version": 1, "mbox": "https://patchwork.libcamera.org/series/4511/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/20876/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/20876/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 2B22BC323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 12 Aug 2024 11:50:29 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C891B633B5;\n\tMon, 12 Aug 2024 13:50:28 +0200 (CEST)", "from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AB02163398\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Aug 2024 13:50:26 +0200 (CEST)", "from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com\n\t(ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63])\n\tby relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n\tcipher=TLS_AES_256_GCM_SHA384) id us-mta-76-ZjpKTn-tMXC6ZdM3p_vwkg-1;\n\tMon, 12 Aug 2024 07:50:23 -0400", "from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com\n\t(mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com\n\t[10.30.177.15])\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 mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTPS\n\tid C9838192538A for <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Aug 2024 11:50:22 +0000 (UTC)", "from nuthatch.redhat.com (unknown [10.45.225.57])\n\tby mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTP id 743D419772C7; Mon, 12 Aug 2024 11:50:21 +0000 (UTC)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"fBrFvzgP\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1723463425;\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=A/ibfddvq3q51VE8O+dwfQ+15VTVPOwYcKCoeHE0qCs=;\n\tb=fBrFvzgPPjo05z8O4+84iFOVDPdvfqrgEViyo3zYMiAFkRtHTpps0z0/A4Feffg6tkKKRC\n\t77m3Pg9AlxdYc4eZ9nRVDHMDDwIAphPgbUrbLHDPEeEDv33QHSuaNuhHbSUjyF0rRTYubS\n\t7QFF0hmEfej+IPpy1YkFS3YZITsvPd0=", "X-MC-Unique": "ZjpKTn-tMXC6ZdM3p_vwkg-1", "From": "Milan Zamazal <mzamazal@redhat.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Milan Zamazal <mzamazal@redhat.com>", "Subject": "[PATCH 02/16] libcamera: software_isp: Introduce arguments for\n\tparameters buffers", "Date": "Mon, 12 Aug 2024 13:49:51 +0200", "Message-ID": "<20240812115009.946036-3-mzamazal@redhat.com>", "In-Reply-To": "<20240812115009.946036-1-mzamazal@redhat.com>", "References": "<20240812115009.946036-1-mzamazal@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.0 on 10.30.177.15", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Processing parameters in software ISP are currently passed by value.\nThis is unlike hardware pipelines, which use a ring of buffers for the\npurpose and pass references to the buffers currently selected from the\nring rather than passing the whole parameters buffers.\n\nThis is a preparatory patch to introduce a similar mechanism in software\nISP, in order to resolve TODO #5. It adds a new argument paramsBufferId\nfor the future parameters buffer ids passed to the calls. The buffer\nids must be passed to the following groups of methods:\n\n- IPASoftSimple::prepare, in order to create the parameters in the given\n buffer for the corresponding frame processing.\n\n- SoftwareIsp::saveParams, in order to signal that the parameters are\n set by the IPA.\n\n- Debayer::process, in order to get the buffer with the processing\n parameters.\n\n- SoftwareIsp::releaseIspParams, in order to signal that the selected\n parameters buffer from the ring is no longer needed for the given\n frame and can be reused. This is a newly introduced signal.\n\nThe type of the buffer id parameter is set to uint32_t because:\n\n- It can be used in mojom.\n- It is consistent with the similar types in the hardware pipelines.\n- It covers file descriptor number range, which will be used as buffer\n ids (more on this in followup patches).\n\nThis patch doesn't do more than adding the arguments, to keep the patch\nsimple. The buffer handling will be implemented in the followup\npatches.\n\nSigned-off-by: Milan Zamazal <mzamazal@redhat.com>\n---\n .../libcamera/internal/software_isp/software_isp.h | 3 ++-\n include/libcamera/ipa/soft.mojom | 4 ++--\n src/ipa/simple/soft_simple.cpp | 7 ++++---\n src/libcamera/software_isp/debayer.cpp | 8 +++++++-\n src/libcamera/software_isp/debayer.h | 6 +++++-\n src/libcamera/software_isp/debayer_cpu.cpp | 6 +++++-\n src/libcamera/software_isp/debayer_cpu.h | 4 +++-\n src/libcamera/software_isp/software_isp.cpp | 13 ++++++++++---\n 8 files changed, 38 insertions(+), 13 deletions(-)", "diff": "diff --git a/include/libcamera/internal/software_isp/software_isp.h b/include/libcamera/internal/software_isp/software_isp.h\nindex 4bb30f07..d2b47ecc 100644\n--- a/include/libcamera/internal/software_isp/software_isp.h\n+++ b/include/libcamera/internal/software_isp/software_isp.h\n@@ -84,7 +84,8 @@ public:\n \tSignal<const ControlList &> setSensorControls;\n \n private:\n-\tvoid saveIspParams();\n+\tvoid saveIspParams(uint32_t paramsBufferId);\n+\tvoid releaseIspParams(uint32_t paramsBufferId);\n \tvoid setSensorCtrls(const ControlList &sensorControls);\n \tvoid statsReady(uint32_t frame, uint32_t bufferId);\n \tvoid inputReady(FrameBuffer *input);\ndiff --git a/include/libcamera/ipa/soft.mojom b/include/libcamera/ipa/soft.mojom\nindex 85c61824..1498aedf 100644\n--- a/include/libcamera/ipa/soft.mojom\n+++ b/include/libcamera/ipa/soft.mojom\n@@ -24,11 +24,11 @@ interface IPASoftInterface {\n \t\t=> (int32 ret);\n \n \t[async] queueRequest(uint32 frame, libcamera.ControlList sensorControls);\n-\tprepare(uint32 frame);\n+\tprepare(uint32 frame, uint32 paramsBufferId);\n \t[async] processStats(uint32 frame, uint32 bufferId, libcamera.ControlList sensorControls);\n };\n \n interface IPASoftEventInterface {\n \tsetSensorControls(libcamera.ControlList sensorControls);\n-\tsetIspParams();\n+\tsetIspParams(uint32 paramsBufferId);\n };\ndiff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp\nindex 547d0fcf..9d5fe923 100644\n--- a/src/ipa/simple/soft_simple.cpp\n+++ b/src/ipa/simple/soft_simple.cpp\n@@ -56,7 +56,7 @@ public:\n \tvoid stop() override;\n \n \tvoid queueRequest(const uint32_t frame, const ControlList &controls) override;\n-\tvoid prepare(const uint32_t frame) override;\n+\tvoid prepare(const uint32_t frame, const uint32_t paramsBufferId) override;\n \tvoid processStats(const uint32_t frame, const uint32_t bufferId,\n \t\t\t const ControlList &sensorControls) override;\n \n@@ -254,12 +254,13 @@ void IPASoftSimple::queueRequest(const uint32_t frame, const ControlList &contro\n \t\talgo->queueRequest(context_, frame, frameContext, controls);\n }\n \n-void IPASoftSimple::prepare(const uint32_t frame)\n+void IPASoftSimple::prepare(const uint32_t frame,\n+\t\t\t const uint32_t paramsBufferId)\n {\n \tIPAFrameContext &frameContext = context_.frameContexts.get(frame);\n \tfor (auto const &algo : algorithms())\n \t\talgo->prepare(context_, frame, frameContext, params_);\n-\tsetIspParams.emit();\n+\tsetIspParams.emit(paramsBufferId);\n }\n \n void IPASoftSimple::processStats(\ndiff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp\nindex e2295f35..8bd58c3d 100644\n--- a/src/libcamera/software_isp/debayer.cpp\n+++ b/src/libcamera/software_isp/debayer.cpp\n@@ -94,9 +94,10 @@ Debayer::~Debayer()\n */\n \n /**\n- * \\fn void Debayer::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, DebayerParams params)\n+ * \\fn void Debayer::process(uint32_t frame, const uint32_t paramsBufferId, FrameBuffer *input, FrameBuffer *output, DebayerParams params)\n * \\brief Process the bayer data into the requested format\n * \\param[in] frame The frame number\n+ * \\param[in] paramsBufferId The id of the params buffer in use\n * \\param[in] input The input buffer\n * \\param[in] output The output buffer\n * \\param[in] params The parameters to be used in debayering\n@@ -124,4 +125,9 @@ Debayer::~Debayer()\n * \\brief Signals when the output buffer is ready\n */\n \n+/**\n+ * \\var Signal<uint32_t> Debayer::releaseIspParams\n+ * \\brief Signals when the processing params are no longer needed\n+ */\n+\n } /* namespace libcamera */\ndiff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h\nindex d7ca060d..93020735 100644\n--- a/src/libcamera/software_isp/debayer.h\n+++ b/src/libcamera/software_isp/debayer.h\n@@ -40,12 +40,16 @@ public:\n \tvirtual std::tuple<unsigned int, unsigned int>\n \tstrideAndFrameSize(const PixelFormat &outputFormat, const Size &size) = 0;\n \n-\tvirtual void process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, DebayerParams params) = 0;\n+\tvirtual void process(uint32_t frame,\n+\t\t\t const uint32_t paramsBufferId,\n+\t\t\t FrameBuffer *input, FrameBuffer *output,\n+\t\t\t DebayerParams params) = 0;\n \n \tvirtual SizeRange sizes(PixelFormat inputFormat, const Size &inputSize) = 0;\n \n \tSignal<FrameBuffer *> inputBufferReady;\n \tSignal<FrameBuffer *> outputBufferReady;\n+\tSignal<uint32_t> releaseIspParams;\n \n private:\n \tvirtual Size patternSize(PixelFormat inputFormat) = 0;\ndiff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp\nindex f7b3a7d1..20a15ae0 100644\n--- a/src/libcamera/software_isp/debayer_cpu.cpp\n+++ b/src/libcamera/software_isp/debayer_cpu.cpp\n@@ -724,7 +724,9 @@ static inline int64_t timeDiff(timespec &after, timespec &before)\n \t (int64_t)after.tv_nsec - (int64_t)before.tv_nsec;\n }\n \n-void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, DebayerParams params)\n+void DebayerCpu::process(uint32_t frame,\n+\t\t\t const uint32_t paramsBufferId,\n+\t\t\t FrameBuffer *input, FrameBuffer *output, DebayerParams params)\n {\n \ttimespec frameStartTime;\n \n@@ -737,6 +739,8 @@ void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output\n \tred_ = swapRedBlueGains_ ? params.blue : params.red;\n \tblue_ = swapRedBlueGains_ ? params.red : params.blue;\n \n+\treleaseIspParams.emit(paramsBufferId);\n+\n \t/* Copy metadata from the input buffer */\n \tFrameMetadata &metadata = output->_d()->metadata();\n \tmetadata.status = input->metadata().status;\ndiff --git a/src/libcamera/software_isp/debayer_cpu.h b/src/libcamera/software_isp/debayer_cpu.h\nindex 2c47e7c6..0b5a5258 100644\n--- a/src/libcamera/software_isp/debayer_cpu.h\n+++ b/src/libcamera/software_isp/debayer_cpu.h\n@@ -36,7 +36,9 @@ public:\n \tstd::vector<PixelFormat> formats(PixelFormat input);\n \tstd::tuple<unsigned int, unsigned int>\n \tstrideAndFrameSize(const PixelFormat &outputFormat, const Size &size);\n-\tvoid process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, DebayerParams params);\n+\tvoid process(uint32_t frame,\n+\t\t const uint32_t paramsBufferId,\n+\t\t FrameBuffer *input, FrameBuffer *output, DebayerParams params);\n \tSizeRange sizes(PixelFormat inputFormat, const Size &inputSize);\n \n \t/**\ndiff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp\nindex dbf27f31..0412b401 100644\n--- a/src/libcamera/software_isp/software_isp.cpp\n+++ b/src/libcamera/software_isp/software_isp.cpp\n@@ -106,6 +106,7 @@ SoftwareIsp::SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor)\n \tdebayer_ = std::make_unique<DebayerCpu>(std::move(stats));\n \tdebayer_->inputBufferReady.connect(this, &SoftwareIsp::inputReady);\n \tdebayer_->outputBufferReady.connect(this, &SoftwareIsp::outputReady);\n+\tdebayer_->releaseIspParams.connect(this, &SoftwareIsp::releaseIspParams);\n \n \tipa_ = IPAManager::createIPA<ipa::soft::IPAProxySoft>(pipe, 0, 0);\n \tif (!ipa_) {\n@@ -352,16 +353,22 @@ void SoftwareIsp::stop()\n */\n void SoftwareIsp::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output)\n {\n-\tipa_->prepare(frame);\n+\t/* \\todo Provide a real value */\n+\tconstexpr uint32_t paramsBufferId = 0;\n+\tipa_->prepare(frame, paramsBufferId);\n \tdebayer_->invokeMethod(&DebayerCpu::process,\n-\t\t\t ConnectionTypeQueued, frame, input, output, debayerParams_);\n+\t\t\t ConnectionTypeQueued, frame, paramsBufferId, input, output, debayerParams_);\n }\n \n-void SoftwareIsp::saveIspParams()\n+void SoftwareIsp::saveIspParams([[maybe_unused]] uint32_t paramsBufferId)\n {\n \tdebayerParams_ = *sharedParams_;\n }\n \n+void SoftwareIsp::releaseIspParams([[maybe_unused]] uint32_t paramsBufferId)\n+{\n+}\n+\n void SoftwareIsp::setSensorCtrls(const ControlList &sensorControls)\n {\n \tsetSensorControls.emit(sensorControls);\n", "prefixes": [ "02/16" ] }