From patchwork Mon Feb 24 12:08:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milan Zamazal X-Patchwork-Id: 22840 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 AE75CC324E for ; Mon, 24 Feb 2025 12:09:11 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B8DA9686E5; Mon, 24 Feb 2025 13:09:10 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="KUJzXfs1"; 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 7838061856 for ; Mon, 24 Feb 2025 13:09:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740398948; 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; bh=3jk3NvYAXVXcVdb0xqM4LI7YbS8UYv7Aoym1N33l04c=; b=KUJzXfs14CCEYrBsKkFBKN0MraG3Olr9PqVKfCplLSwAOG1iq10H0YDuGhu1Y4ZssVVijL DDe6Z5O2CgDnTKXAwqcusSEZzKoW84IicbO00ipLaZAf6gSYEWjL7lbGcYnYoL7ZCB8xTt 6+FT0NwwgLbpy95T+CzBbaRR5s+rqsI= 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-186-XGvwM4nLMqytWePACGT4Fw-1; Mon, 24 Feb 2025 07:09:03 -0500 X-MC-Unique: XGvwM4nLMqytWePACGT4Fw-1 X-Mimecast-MFC-AGG-ID: XGvwM4nLMqytWePACGT4Fw_1740398942 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 81D6F180087E; Mon, 24 Feb 2025 12:09:02 +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 3158F19560AA; Mon, 24 Feb 2025 12:08:59 +0000 (UTC) From: Milan Zamazal To: libcamera-devel@lists.libcamera.org Cc: Milan Zamazal , Stanislaw Gruszka , Laurent Pinchart , Kieran Bingham Subject: [PATCH 0/5] Fix occasional software ISP assertion error on stop Date: Mon, 24 Feb 2025 13:08:49 +0100 Message-ID: <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: 2PgxDnF7in5fl9LXoaptnMUZhIJDN_xs3Ps4dnGNdLA_1740398942 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" When software ISP is stopped, there can be pending messages in the message queue that will attempt to call the already stopped IPA, resulting in an assertion error like this: FATAL default soft_ipa_proxy.cpp:456 assertion "state_ == ProxyRunning" failed in processStatsThread() This patch series fixes the problem and also attempts to prevent other problems related to message handling when or after software ISP is stopped. Milan Zamazal (5): libcamera: software_isp: Emit ispStatsReady only if IPA is running libcamera: software_isp: Handle queued output buffers on stop libcamera: software_isp: Handle queued input buffers on stop libcamera: base: Fix formatting in thread.cpp libcamera: software_isp: Modify dispatching messages on stop include/libcamera/base/thread.h | 3 +- .../internal/software_isp/software_isp.h | 3 ++ src/libcamera/base/thread.cpp | 19 ++++---- src/libcamera/software_isp/software_isp.cpp | 46 +++++++++++++++++-- .../libcamera_templates/proxy_functions.tmpl | 2 +- 5 files changed, 58 insertions(+), 15 deletions(-) Tested-by: Stanislaw Gruszka