[{"id":33454,"web_url":"https://patchwork.libcamera.org/comment/33454/","msgid":"<20250224193558.GG6778@pendragon.ideasonboard.com>","date":"2025-02-24T19:35:58","subject":"Re: [PATCH v2 1/5] libcamera: software_isp: Emit ispStatsReady only\n\tif IPA is running","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Milan,\n\nThank you for the patch.\n\nOn Mon, Feb 24, 2025 at 07:52:31PM +0100, Milan Zamazal wrote:\n> Software ISP runs debayering in a separate thread and debayering may\n> emit statsReady when software ISP (including the IPA) is being stopped.\n> The signal waits in a queue and gets invoked later, resulting in an\n> assertion error when attempting to invoke a method on the stopped IPA:\n> \n>   FATAL default soft_ipa_proxy.cpp:456 assertion\n>   \"state_ == ProxyRunning\" failed in processStatsThread()\n> \n> Let's prevent this problem by forwarding the ISP stats signal from\n> software ISP only when the IPA is running.  To track this,\n> SoftwareISP::running_ variable is introduced.\n> \n> Making processing of the other signals in SoftwareISP more robust is\n> addressed in the followup patches.\n> \n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  include/libcamera/internal/software_isp/software_isp.h | 1 +\n>  src/libcamera/software_isp/software_isp.cpp            | 5 ++++-\n>  2 files changed, 5 insertions(+), 1 deletion(-)\n> \n> diff --git a/include/libcamera/internal/software_isp/software_isp.h b/include/libcamera/internal/software_isp/software_isp.h\n> index 440a296d..af0dcc24 100644\n> --- a/include/libcamera/internal/software_isp/software_isp.h\n> +++ b/include/libcamera/internal/software_isp/software_isp.h\n> @@ -100,6 +100,7 @@ private:\n>  \tDmaBufAllocator dmaHeap_;\n>  \n>  \tstd::unique_ptr<ipa::soft::IPAProxySoft> ipa_;\n> +\tbool running_;\n>  };\n>  \n>  } /* namespace libcamera */\n> diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp\n> index 44baf200..1a39f4d8 100644\n> --- a/src/libcamera/software_isp/software_isp.cpp\n> +++ b/src/libcamera/software_isp/software_isp.cpp\n> @@ -315,6 +315,7 @@ int SoftwareIsp::start()\n>  \tint ret = ipa_->start();\n>  \tif (ret)\n>  \t\treturn ret;\n> +\trunning_ = true;\n>  \n>  \tispWorkerThread_.start();\n>  \treturn 0;\n> @@ -328,6 +329,7 @@ void SoftwareIsp::stop()\n>  \tispWorkerThread_.exit();\n>  \tispWorkerThread_.wait();\n>  \n> +\trunning_ = false;\n>  \tipa_->stop();\n>  }\n>  \n> @@ -356,7 +358,8 @@ void SoftwareIsp::setSensorCtrls(const ControlList &sensorControls)\n>  \n>  void SoftwareIsp::statsReady(uint32_t frame, uint32_t bufferId)\n>  {\n> -\tispStatsReady.emit(frame, bufferId);\n> +\tif (running_)\n> +\t\tispStatsReady.emit(frame, bufferId);\n>  }\n>  \n>  void SoftwareIsp::inputReady(FrameBuffer *input)","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 4DB00C32A9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 24 Feb 2025 19:36:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 61A9D686FA;\n\tMon, 24 Feb 2025 20:36:17 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 953C861856\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Feb 2025 20:36:16 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B168F220;\n\tMon, 24 Feb 2025 20:34:49 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"en0r/F5V\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1740425689;\n\tbh=53gKy/HNINu0oZVxw881ah55eGDIhiP3oRqcJLurk40=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=en0r/F5V6zd7OKluDjY0lAp9J6pmgUYwilqHD6gEBiV4tDdZey5sfuP35QTa0Fv3O\n\taU7oVfTNU24wbmOozp8+Kwx3IfTERc9m2n624k4ObeTrdbtEpvpY7ayzat9GbrNPlc\n\tznjtXrnB+W70Om6u31mZzn7+jP2w3odxmCVsNnls=","Date":"Mon, 24 Feb 2025 21:35:58 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Milan Zamazal <mzamazal@redhat.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tStanislaw Gruszka <stanislaw.gruszka@linux.intel.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"Re: [PATCH v2 1/5] libcamera: software_isp: Emit ispStatsReady only\n\tif IPA is running","Message-ID":"<20250224193558.GG6778@pendragon.ideasonboard.com>","References":"<20250224185235.43381-1-mzamazal@redhat.com>\n\t<20250224185235.43381-2-mzamazal@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20250224185235.43381-2-mzamazal@redhat.com>","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>"}}]