[{"id":33518,"web_url":"https://patchwork.libcamera.org/comment/33518/","msgid":"<174087007470.3864332.5651389631693225483@ping.linuxembedded.co.uk>","date":"2025-03-01T23:01:14","subject":"Re: [PATCH v3 1/6] libcamera: software_isp: Emit ispStatsReady only\n\tif IPA is running","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Milan Zamazal (2025-02-25 15:06:07)\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> Reported-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nI see this gets removed later, but I think it's part of the journey ...\n\nAnd I haven't had any crashes testing tonight - so lets get these\nmerged.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n--\nKieran\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>         DmaBufAllocator dmaHeap_;\n>  \n>         std::unique_ptr<ipa::soft::IPAProxySoft> ipa_;\n> +       bool 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>         int ret = ipa_->start();\n>         if (ret)\n>                 return ret;\n> +       running_ = true;\n>  \n>         ispWorkerThread_.start();\n>         return 0;\n> @@ -328,6 +329,7 @@ void SoftwareIsp::stop()\n>         ispWorkerThread_.exit();\n>         ispWorkerThread_.wait();\n>  \n> +       running_ = false;\n>         ipa_->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> -       ispStatsReady.emit(frame, bufferId);\n> +       if (running_)\n> +               ispStatsReady.emit(frame, bufferId);\n>  }\n>  \n>  void SoftwareIsp::inputReady(FrameBuffer *input)\n> -- \n> 2.48.1\n>","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 B4F31C3259\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat,  1 Mar 2025 23:01:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8FB0E687FA;\n\tSun,  2 Mar 2025 00:01:19 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 034FE68778\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun,  2 Mar 2025 00:01:16 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7ED71520;\n\tSat,  1 Mar 2025 23:59:46 +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=\"fOHJ62ec\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1740869986;\n\tbh=UplpmRht7KyK3M4gt/Wn5t7A/gyLtGrhu5PgSDbD0Lc=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=fOHJ62ecDAfE/85TLs/bhPi6u1fcV/aoJtTApKPUdWV/Du1p2M6OfseaLsQIPDHbW\n\tX1m16ye0eiAopSVxfcIDmF727/f3ElrJnWpJ0UoESy26bu13Xj0k4tlpZiCbkwPbyX\n\t0n7OWDSYgUalKJeBNjLohVGidNWRcEQHZqlEBgQc=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250225150614.20195-2-mzamazal@redhat.com>","References":"<20250225150614.20195-1-mzamazal@redhat.com>\n\t<20250225150614.20195-2-mzamazal@redhat.com>","Subject":"Re: [PATCH v3 1/6] libcamera: software_isp: Emit ispStatsReady only\n\tif IPA is running","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Milan Zamazal <mzamazal@redhat.com>,\n\tStanislaw Gruszka <stanislaw.gruszka@linux.intel.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Milan Zamazal <mzamazal@redhat.com>, libcamera-devel@lists.libcamera.org","Date":"Sat, 01 Mar 2025 23:01:14 +0000","Message-ID":"<174087007470.3864332.5651389631693225483@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","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>"}}]