From patchwork Thu Jun 4 09:50:54 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milan Zamazal X-Patchwork-Id: 26833 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 92D8AC328C for ; Thu, 4 Jun 2026 09:51:49 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3CD8663741; Thu, 4 Jun 2026 11:51:49 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="McCszPp+"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7FE3D63403 for ; Thu, 4 Jun 2026 11:51:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780566706; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=00G6fCl+VrAiAKncqdFqlnHj8CGJ2JX9e4VeeAibcj8=; b=McCszPp+2sfFcKgKodCmbiZw+zClV1Xf2kYdKYnMfkksr0ALF7nzSoJthOT5uGuFXGaK/K HWT2QxyMOzQgdU8WxiUh6nm5QYz/PTqdMJTrxDAr229gTO67GpNYcgwpt2NUWMS20aeA5+ m0qBQ7k3OLDi+ZpZIpdylof4Wt/8tOQ= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-650-VdEE4mczPISTqC6Niid6xQ-1; Thu, 04 Jun 2026 05:51:43 -0400 X-MC-Unique: VdEE4mczPISTqC6Niid6xQ-1 X-Mimecast-MFC-AGG-ID: VdEE4mczPISTqC6Niid6xQ_1780566702 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 53A341956050; Thu, 4 Jun 2026 09:51:42 +0000 (UTC) Received: from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.44.34.156]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8C35030001A1; Thu, 4 Jun 2026 09:51:40 +0000 (UTC) From: Milan Zamazal To: libcamera-devel@lists.libcamera.org Cc: Milan Zamazal , =?utf-8?b?QmFybmFiw6FzIFDFkWN6?= =?utf-8?q?e?= , johannes.goede@oss.qualcomm.com Subject: [RFC PATCH v3 08/17] libcamera: software_isp: Allocation of multiple params buffers Date: Thu, 4 Jun 2026 11:50:54 +0200 Message-ID: <20260604095105.68798-13-mzamazal@redhat.com> In-Reply-To: <20260604095105.68798-1-mzamazal@redhat.com> References: <20260604095105.68798-1-mzamazal@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: EjBymKknOC_6Xvu6nvBqpH0cpLssvoZEGrCAr4zKIpk_1780566702 X-Mimecast-Originator: redhat.com 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" SoftwareIsp::sharedParams_ is changed from a single buffer to a map of multiple buffer ids and the corresponding buffers. This requires some code rearranging within SoftwareIsp::allocateParamsBuffers to keep the right sequence of actions. Currently, only a single buffer is allocated, this will be changed in a followup patch. Signed-off-by: Milan Zamazal --- .../internal/software_isp/software_isp.h | 3 ++- src/libcamera/software_isp/software_isp.cpp | 25 ++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/include/libcamera/internal/software_isp/software_isp.h b/include/libcamera/internal/software_isp/software_isp.h index 58fb9d752..b77793713 100644 --- a/include/libcamera/internal/software_isp/software_isp.h +++ b/include/libcamera/internal/software_isp/software_isp.h @@ -97,7 +97,8 @@ private: void outputReady(FrameBuffer *output); std::unique_ptr debayer_; Thread ispWorkerThread_; - SharedMemObject sharedParams_; + static constexpr unsigned int kParamStatBufferCount = 1; + std::map> sharedParams_; DebayerParams debayerParams_; std::vector availableParams_; DmaBufAllocator dmaHeap_; diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp index d48cd00ad..6596e6fdb 100644 --- a/src/libcamera/software_isp/software_isp.cpp +++ b/src/libcamera/software_isp/software_isp.cpp @@ -72,6 +72,11 @@ LOG_DEFINE_CATEGORY(SoftwareIsp) * ready */ +/** + * \var SoftwareIsp::kParamStatBufferCount + * \brief The number of stats and params buffers (each of them) + */ + /** * \brief Constructs SoftwareIsp object * \param[in] pipe The pipeline handler in use @@ -150,7 +155,7 @@ SoftwareIsp::SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor, ret = ipa_->init(IPASettings{ ipaTuningFile, sensor->model() }, debayer_->getStatsFD(), - sharedParams_.fd(), + sharedParams_.begin()->second.fd(), sensorInfo, sensor->controls(), ipaControls, @@ -179,14 +184,16 @@ SoftwareIsp::~SoftwareIsp() bool SoftwareIsp::allocateParamsBuffers() { - sharedParams_ = SharedMemObject("softIsp_params"); - if (!sharedParams_) { - LOG(SoftwareIsp, Error) << "Failed to create shared memory for parameters"; - return false; - } + for (unsigned int bufferId = 0; bufferId < kParamStatBufferCount; bufferId++) { + auto params = SharedMemObject("softIsp_params"); + if (!params) { + LOG(SoftwareIsp, Error) << "Failed to create shared memory for parameters"; + return false; + } - /* Just a single buffer for now, let's use 0 as its id. */ - availableParams_.push_back(0); + availableParams_.push_back(bufferId); + sharedParams_.emplace(bufferId, std::move(params)); + } return true; } @@ -442,7 +449,7 @@ int SoftwareIsp::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output void SoftwareIsp::saveIspParams([[maybe_unused]] const uint32_t paramsBufferId) { - debayerParams_ = *sharedParams_; + debayerParams_ = *sharedParams_.begin()->second; } void SoftwareIsp::paramsBufferReady(const uint32_t paramsBufferId)