{"id":22856,"url":"https://patchwork.libcamera.org/api/1.1/covers/22856/?format=json","web_url":"https://patchwork.libcamera.org/cover/22856/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20250225150614.20195-1-mzamazal@redhat.com>","date":"2025-02-25T15:06:06","name":"[v3,0/6] Fix occasional software ISP assertion error on stop","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/1.1/people/177/?format=json","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"mbox":"https://patchwork.libcamera.org/cover/22856/mbox/","series":[{"id":5019,"url":"https://patchwork.libcamera.org/api/1.1/series/5019/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5019","date":"2025-02-25T15:06:06","name":"Fix occasional software ISP assertion error on stop","version":3,"mbox":"https://patchwork.libcamera.org/series/5019/mbox/"}],"comments":"https://patchwork.libcamera.org/api/covers/22856/comments/","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 2A9FCBDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 25 Feb 2025 15:06:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 31D8C6871B;\n\tTue, 25 Feb 2025 16:06:31 +0100 (CET)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E886F61855\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 25 Feb 2025 16:06:28 +0100 (CET)","from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com\n\t(ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97])\n\tby relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n\tcipher=TLS_AES_256_GCM_SHA384) id us-mta-50-mLGxJUFVMP-Mp_Q2KdVTRg-1;\n\tTue, 25 Feb 2025 10:06:24 -0500","from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com\n\t(mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com\n\t[10.30.177.93])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\tkey-exchange X25519 server-signature RSA-PSS (2048 bits)\n\tserver-digest SHA256) (No client certificate requested)\n\tby mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTPS id 09BD5180056F; Tue, 25 Feb 2025 15:06:23 +0000 (UTC)","from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.45.224.119])\n\tby mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTP id 1A4C5180035F; Tue, 25 Feb 2025 15:06:20 +0000 (UTC)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"CNQt4P4N\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1740495987;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding;\n\tbh=ltUI7n+ag8/V7R4VnurUD0hejTzdqxzCZbSFYuIAyaM=;\n\tb=CNQt4P4Nqetd1dWvmYrDympqHtzaYkTjfOCdpHV/DHf2GbPZCQCTd4zJXpah3RUHzRBDtN\n\tEgoZN9yL3ius79TpgsE/KORijOpdNONPtAb3kI7NtaEAFiFkqleQ6JVSWKBcgboChIIuGo\n\twBGlPgUtxHreu9Wqr3ltLfkelIRhDP0=","X-MC-Unique":"mLGxJUFVMP-Mp_Q2KdVTRg-1","X-Mimecast-MFC-AGG-ID":"mLGxJUFVMP-Mp_Q2KdVTRg_1740495983","From":"Milan Zamazal <mzamazal@redhat.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Milan Zamazal <mzamazal@redhat.com>,\n\tStanislaw Gruszka <stanislaw.gruszka@linux.intel.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"[PATCH v3 0/6] Fix occasional software ISP assertion error on stop","Date":"Tue, 25 Feb 2025 16:06:06 +0100","Message-ID":"<20250225150614.20195-1-mzamazal@redhat.com>","MIME-Version":"1.0","X-Scanned-By":"MIMEDefang 3.4.1 on 10.30.177.93","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"gHOmZSrA30MZfL_Kpug9zHn6xdpirxBSTEFU4xEtBrk_1740495983","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","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>"},"content":"When software ISP is stopped, there can be pending messages in the\nmessage queue that will attempt to call the already stopped IPA,\nresulting in an assertion error like this:\n\n  FATAL default soft_ipa_proxy.cpp:456 assertion \"state_ == ProxyRunning\" failed in processStatsThread()\n\nThis patch series fixes the problem and also attempts to prevent other\nproblems related to message handling when or after software ISP is\nstopped.\n\nChanges in v3:\n- Missing <deque> include added.\n- I/O buffers are popped from the deque’s of queued buffers rather than\n  searched there + assertion to check it’s the intended buffer added.\n- Returned pending input buffers are canceled.\n- The thread.cpp formatting patch dropped.\n- The dispatching modifications patch split to several patches as\n  suggested by Laurent.\n- Thread::removeMessages() documentation improved as suggested by\n  Laurent.\n- SoftwareIsp::running_ dropped in the patch adding explicit SoftwareIsp\n  messages removal.\n- Formatting fixes suggested by Laurent.\n\nChanges in v2:\n- The receiver check in Thread::dispatchMessages moved to the right\n  place.\n\nMilan Zamazal (6):\n  libcamera: software_isp: Emit ispStatsReady only if IPA is running\n  libcamera: software_isp: Handle queued output buffers on stop\n  libcamera: software_isp: Handle queued input buffers on stop\n  libcamera: base: thread: Support dispatching for a specific receiver\n  libcamera: software_isp: Dispatch messages on stop\n  utils: ipc: Only dispatch messages for proxy when stopping thread\n\n include/libcamera/base/thread.h               |  3 +-\n .../internal/software_isp/software_isp.h      |  3 ++\n src/libcamera/base/thread.cpp                 | 21 ++++++-----\n src/libcamera/software_isp/software_isp.cpp   | 36 +++++++++++++++++--\n .../libcamera_templates/proxy_functions.tmpl  |  2 +-\n 5 files changed, 53 insertions(+), 12 deletions(-)"}