From patchwork Mon Feb 24 12:08:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milan Zamazal X-Patchwork-Id: 22841 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 6609CC324E for ; Mon, 24 Feb 2025 12:09:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0A0B2686EF; Mon, 24 Feb 2025 13:09:16 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="gnmz6WXA"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 89D5C686DD for ; Mon, 24 Feb 2025 13:09:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740398952; 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=gd2ZKQ0qvhaFzc6uD//mdh4fqOebG9ryBtI040IS3cQ=; b=gnmz6WXAeWvGo2m9FsQmWVruESz0NrQCGCO2uCbFZ6GzYYRzQp5NrHpwPbtxX6Zd5rPMfG EisNeo4G9OKzBXQwirDfbeU/Fu/a++nHr9z8n7e4qToigiFadjY95cFtKQprPdGFlL99H4 CFZ6XKJ3ifXKng9Pv+EgmcgmUys7jSg= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-133-b0rJY_TIPoufVig3I7ZQdA-1; Mon, 24 Feb 2025 07:09:08 -0500 X-MC-Unique: b0rJY_TIPoufVig3I7ZQdA-1 X-Mimecast-MFC-AGG-ID: b0rJY_TIPoufVig3I7ZQdA_1740398948 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8AF441801A18; Mon, 24 Feb 2025 12:09:07 +0000 (UTC) Received: from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.45.225.60]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A973E19560AA; Mon, 24 Feb 2025 12:09:05 +0000 (UTC) From: Milan Zamazal To: libcamera-devel@lists.libcamera.org Cc: Milan Zamazal , Stanislaw Gruszka , Laurent Pinchart , Kieran Bingham Subject: [PATCH 1/5] libcamera: software_isp: Emit ispStatsReady only if IPA is running Date: Mon, 24 Feb 2025 13:08:50 +0100 Message-ID: <20250224120854.19747-2-mzamazal@redhat.com> In-Reply-To: <20250224120854.19747-1-mzamazal@redhat.com> References: <20250224120854.19747-1-mzamazal@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 9gDoWCidBHPqId3JBgWKyCkS-gfMWTFw0nlTYoDH-GQ_1740398948 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" Software ISP runs debayering in a separate thread and debayering may emit statsReady when software ISP (including the IPA) is being stopped. The signal waits in a queue and gets invoked later, resulting in an assertion error when attempting to invoke a method on the stopped IPA: FATAL default soft_ipa_proxy.cpp:456 assertion "state_ == ProxyRunning" failed in processStatsThread() Let's prevent this problem by forwarding the ISP stats signal from software ISP only when the IPA is running. To track this, SoftwareISP::running_ variable is introduced. Making processing of the other signals in SoftwareISP more robust is addressed in the followup patches. Signed-off-by: Milan Zamazal --- include/libcamera/internal/software_isp/software_isp.h | 1 + src/libcamera/software_isp/software_isp.cpp | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/libcamera/internal/software_isp/software_isp.h b/include/libcamera/internal/software_isp/software_isp.h index 440a296d..af0dcc24 100644 --- a/include/libcamera/internal/software_isp/software_isp.h +++ b/include/libcamera/internal/software_isp/software_isp.h @@ -100,6 +100,7 @@ private: DmaBufAllocator dmaHeap_; std::unique_ptr ipa_; + bool running_; }; } /* namespace libcamera */ diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp index 44baf200..1a39f4d8 100644 --- a/src/libcamera/software_isp/software_isp.cpp +++ b/src/libcamera/software_isp/software_isp.cpp @@ -315,6 +315,7 @@ int SoftwareIsp::start() int ret = ipa_->start(); if (ret) return ret; + running_ = true; ispWorkerThread_.start(); return 0; @@ -328,6 +329,7 @@ void SoftwareIsp::stop() ispWorkerThread_.exit(); ispWorkerThread_.wait(); + running_ = false; ipa_->stop(); } @@ -356,7 +358,8 @@ void SoftwareIsp::setSensorCtrls(const ControlList &sensorControls) void SoftwareIsp::statsReady(uint32_t frame, uint32_t bufferId) { - ispStatsReady.emit(frame, bufferId); + if (running_) + ispStatsReady.emit(frame, bufferId); } void SoftwareIsp::inputReady(FrameBuffer *input)