{"id":26174,"url":"https://patchwork.libcamera.org/api/patches/26174/?format=json","web_url":"https://patchwork.libcamera.org/patch/26174/","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":"<20260216203034.27558-6-mzamazal@redhat.com>","date":"2026-02-16T20:30:24","name":"[RFC,v2,05/14] libcamera: software_isp: Allocation of multiple params buffers","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"b58a5c8e72a9da6c2b820139ff11d94feb792af6","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/?format=json","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/26174/mbox/","series":[{"id":5795,"url":"https://patchwork.libcamera.org/api/series/5795/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5795","date":"2026-02-16T20:30:19","name":"Software ISP: Share params and stats buffers","version":2,"mbox":"https://patchwork.libcamera.org/series/5795/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/26174/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/26174/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 2EC95C3240\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 16 Feb 2026 20:30:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BCF986221D;\n\tMon, 16 Feb 2026 21:30:54 +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 0E92662084\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Feb 2026 21:30:52 +0100 (CET)","from mx-prod-mc-01.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-581-Np4WMyeYMsqotxzE9gyoHQ-1;\n\tMon, 16 Feb 2026 15:30:50 -0500","from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com\n\t(mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com\n\t[10.30.177.93])\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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTPS\n\tid 03F531955D96 for <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Feb 2026 20:30:50 +0000 (UTC)","from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.44.32.25])\n\tby mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTP id DC44F18004AD; Mon, 16 Feb 2026 20:30:48 +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=\"bjOe56y/\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1771273852;\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=twgfqRH8J7fMXozHckLElKte++XFWy/wmRvClY9+4Q4=;\n\tb=bjOe56y/HNYvckpi4YHCvmgYEobJXl82LQMZWZ6fPRoWmDJ1sEjzhhh0I3VSmF8T9e2IeG\n\tJYxRKCML5Y4wtUfQilTxrtK0LuxQEQeWgbwsJbXqCL6xmSYeppy1xYqawiumB64aDBlESQ\n\t28itmylgKYkDW91J3AYuebDtLR8PLQ0=","X-MC-Unique":"Np4WMyeYMsqotxzE9gyoHQ-1","X-Mimecast-MFC-AGG-ID":"Np4WMyeYMsqotxzE9gyoHQ_1771273850","From":"Milan Zamazal <mzamazal@redhat.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Milan Zamazal <mzamazal@redhat.com>","Subject":"[RFC PATCH v2 05/14] libcamera: software_isp: Allocation of multiple\n\tparams buffers","Date":"Mon, 16 Feb 2026 21:30:24 +0100","Message-ID":"<20260216203034.27558-6-mzamazal@redhat.com>","In-Reply-To":"<20260216203034.27558-1-mzamazal@redhat.com>","References":"<20260216203034.27558-1-mzamazal@redhat.com>","MIME-Version":"1.0","X-Scanned-By":"MIMEDefang 3.4.1 on 10.30.177.93","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"YRZSrCUNDDSdOI_tBhQmD4GYszo4285-S0TmSx_J18A_1771273850","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":"SoftwareIsp::sharedParams_ is changed from a single buffer to a map of\nmultiple buffer ids and the corresponding buffers.  This requires some\ncode rearranging within SoftwareIsp::allocateBuffers to keep the right\nsequence of actions.\n\nCurrently, only a single buffer is allocated, this will be changed in a\nfollowup patch.\n\nSigned-off-by: Milan Zamazal <mzamazal@redhat.com>\n---\n .../internal/software_isp/software_isp.h      |  3 +-\n src/libcamera/software_isp/software_isp.cpp   | 28 ++++++++++++-------\n 2 files changed, 20 insertions(+), 11 deletions(-)","diff":"diff --git a/include/libcamera/internal/software_isp/software_isp.h b/include/libcamera/internal/software_isp/software_isp.h\nindex a8b7b1eb1..f809e6be8 100644\n--- a/include/libcamera/internal/software_isp/software_isp.h\n+++ b/include/libcamera/internal/software_isp/software_isp.h\n@@ -97,7 +97,8 @@ private:\n \tvoid outputReady(FrameBuffer *output);\n \tstd::unique_ptr<Debayer> debayer_;\n \tThread ispWorkerThread_;\n-\tSharedMemObject<DebayerParams> sharedParams_;\n+\tstatic constexpr unsigned int kParamStatBufferCount = 1;\n+\tstd::map<uint32_t, SharedMemObject<DebayerParams>> sharedParams_;\n \tDebayerParams debayerParams_;\n \tstd::queue<uint32_t> availableParams_;\n \tbool allocateParamsBuffers();\ndiff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp\nindex adf2a03ab..79d5dfe0e 100644\n--- a/src/libcamera/software_isp/software_isp.cpp\n+++ b/src/libcamera/software_isp/software_isp.cpp\n@@ -70,6 +70,11 @@ LOG_DEFINE_CATEGORY(SoftwareIsp)\n  * ready\n  */\n \n+/**\n+ * \\var SoftwareIsp::kParamStatBufferCount\n+ * \\brief The number of stats and params buffers (each of them)\n+ */\n+\n /**\n  * \\brief Constructs SoftwareIsp object\n  * \\param[in] pipe The pipeline handler in use\n@@ -145,7 +150,7 @@ SoftwareIsp::SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor,\n \n \tret = ipa_->init(IPASettings{ ipaTuningFile, sensor->model() },\n \t\t\t debayer_->getStatsFD(),\n-\t\t\t sharedParams_.fd(),\n+\t\t\t sharedParams_.begin()->second.fd(),\n \t\t\t sensorInfo,\n \t\t\t sensor->controls(),\n \t\t\t ipaControls,\n@@ -174,15 +179,18 @@ SoftwareIsp::~SoftwareIsp()\n \n bool SoftwareIsp::allocateParamsBuffers()\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 false;\n-\t}\n+\tfor (unsigned int i = 0; i < kParamStatBufferCount; i++) {\n+\t\tauto params = SharedMemObject<DebayerParams>(\"softIsp_params\");\n+\t\tif (!params) {\n+\t\t\tLOG(SoftwareIsp, Error) << \"Failed to create shared memory for parameters\";\n+\t\t\treturn false;\n+\t\t}\n \n-\tASSERT(sharedParams_.fd().get() >= 0);\n-\tconst uint32_t bufferId = sharedParams_.fd().get();\n-\tavailableParams_.push(bufferId);\n+\t\tASSERT(params.fd().get() >= 0);\n+\t\tconst uint32_t bufferId = params.fd().get();\n+\t\tavailableParams_.push(bufferId);\n+\t\tsharedParams_.emplace(bufferId, std::move(params));\n+\t}\n \n \treturn true;\n }\n@@ -424,7 +432,7 @@ void SoftwareIsp::process(uint32_t frame, FrameBuffer *input, FrameBuffer *outpu\n \n void SoftwareIsp::saveIspParams([[maybe_unused]] uint32_t paramsBufferId)\n {\n-\tdebayerParams_ = *sharedParams_;\n+\tdebayerParams_ = *sharedParams_.begin()->second;\n }\n \n void SoftwareIsp::releaseIspParams(uint32_t paramsBufferId)\n","prefixes":["RFC","v2","05/14"]}