[{"id":31726,"web_url":"https://patchwork.libcamera.org/comment/31726/","msgid":"<6c65eb0b-927b-48cf-af0e-e33f99cea8f4@ideasonboard.com>","date":"2024-10-14T05:12:51","subject":"Re: [PATCH v2] libcamera: software_isp: Clear IPA context on\n\tconfigure and stop","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Robert\n\nSubject can be :\n     \"libcamera: software_isp: Reset IPA context\"\n\nOn 13/10/24 11:27 pm, Robert Mader wrote:\n> Like the hardware pipelines do. Not clearing frameContexts otherwise can\n\ns/Like the hardware pipelines do/Similar to what hardware pipelines \ndoes, clear IPA context in configure() and stop()/\n\n> trigger asserts like \"Frame context for ... has been overwritten by ...\"\n> when switching between cameras using the swISP, e.g. on phones.\n>\n> Clearing the configuration and active state will become more important\n> with upcoming changes such as getting the black level from the camera\n> helper.\n>\n> Fixes: 04d171e6 (\"libcamera: software_isp: Call Algorithm::queueRequest\")\n> Signed-off-by: Robert Mader <robert.mader@collabora.com>\n\nMinors commit message nits, can be applied during merge it self.\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n>\n> ---\n>\n> Changes in version 2:\n>   - Also clear frameContexts as well as other context data on configure\n>   - Change commit title and message accordingly, previous title:\n>     \"libcamera: software_isp: Clear frameContexts on Stop()\"\n> ---\n>   src/ipa/simple/soft_simple.cpp | 6 ++++++\n>   1 file changed, 6 insertions(+)\n>\n> diff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp\n> index b28c7039..3b25d7d0 100644\n> --- a/src/ipa/simple/soft_simple.cpp\n> +++ b/src/ipa/simple/soft_simple.cpp\n> @@ -184,6 +184,11 @@ int IPASoftSimple::configure(const IPAConfigInfo &configInfo)\n>   \tconst ControlInfo &exposureInfo = sensorInfoMap_.find(V4L2_CID_EXPOSURE)->second;\n>   \tconst ControlInfo &gainInfo = sensorInfoMap_.find(V4L2_CID_ANALOGUE_GAIN)->second;\n>   \n> +\t/* Clear the IPA context before the streaming session. */\n> +\tcontext_.configuration = {};\n> +\tcontext_.activeState = {};\n> +\tcontext_.frameContexts.clear();\n> +\n>   \tcontext_.configuration.agc.exposureMin = exposureInfo.min().get<int32_t>();\n>   \tcontext_.configuration.agc.exposureMax = exposureInfo.max().get<int32_t>();\n>   \tif (!context_.configuration.agc.exposureMin) {\n> @@ -245,6 +250,7 @@ int IPASoftSimple::start()\n>   \n>   void IPASoftSimple::stop()\n>   {\n> +  context_.frameContexts.clear();\n>   }\n>   \n>   void IPASoftSimple::queueRequest(const uint32_t frame, const ControlList &controls)","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 F161BC32F6\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 14 Oct 2024 05:12:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D03FB6537B;\n\tMon, 14 Oct 2024 07:12:57 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8950760537\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 14 Oct 2024 07:12:55 +0200 (CEST)","from [IPV6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f] (unknown\n\t[IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 47A12667;\n\tMon, 14 Oct 2024 07:11:14 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"k99pxbzU\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1728882674;\n\tbh=r61zik/yIeIrrw5YZRt8TUHBxfScMn5i7QQEnOX+VJw=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=k99pxbzU1XkGF2czj9hKRNw/Qo5s5L8FMenLZK4wG+unA91jt9y9sC0S956fhMSD3\n\tpnr7tO0YNVQ/WH+zN5PpnEf3Li8s181uf2U/Dnzz3klY7f5KlgeohidH4BQd9RoVCc\n\twwLGX5JyALctjnIffbUSdcQad3xaXtHd8pxfEXFA=","Message-ID":"<6c65eb0b-927b-48cf-af0e-e33f99cea8f4@ideasonboard.com>","Date":"Mon, 14 Oct 2024 10:42:51 +0530","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v2] libcamera: software_isp: Clear IPA context on\n\tconfigure and stop","To":"Robert Mader <robert.mader@collabora.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20241013175719.187166-1-robert.mader@collabora.com>","Content-Language":"en-US","From":"Umang Jain <umang.jain@ideasonboard.com>","In-Reply-To":"<20241013175719.187166-1-robert.mader@collabora.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","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>"}},{"id":31728,"web_url":"https://patchwork.libcamera.org/comment/31728/","msgid":"<87r08jgmcg.fsf@redhat.com>","date":"2024-10-14T07:44:31","subject":"Re: [PATCH v2] libcamera: software_isp: Clear IPA context on\n\tconfigure and stop","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Hi Robert,\n\nthank you for the fix.\n\nRobert Mader <robert.mader@collabora.com> writes:\n\n> Like the hardware pipelines do. Not clearing frameContexts otherwise can\n> trigger asserts like \"Frame context for ... has been overwritten by ...\"\n> when switching between cameras using the swISP, e.g. on phones.\n>\n> Clearing the configuration and active state will become more important\n> with upcoming changes such as getting the black level from the camera\n> helper.\n>\n> Fixes: 04d171e6 (\"libcamera: software_isp: Call Algorithm::queueRequest\")\n> Signed-off-by: Robert Mader <robert.mader@collabora.com>\n\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\n\n> ---\n>\n> Changes in version 2:\n>  - Also clear frameContexts as well as other context data on configure\n>  - Change commit title and message accordingly, previous title:\n>    \"libcamera: software_isp: Clear frameContexts on Stop()\"\n> ---\n>  src/ipa/simple/soft_simple.cpp | 6 ++++++\n>  1 file changed, 6 insertions(+)\n>\n> diff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp\n> index b28c7039..3b25d7d0 100644\n> --- a/src/ipa/simple/soft_simple.cpp\n> +++ b/src/ipa/simple/soft_simple.cpp\n> @@ -184,6 +184,11 @@ int IPASoftSimple::configure(const IPAConfigInfo &configInfo)\n>  \tconst ControlInfo &exposureInfo = sensorInfoMap_.find(V4L2_CID_EXPOSURE)->second;\n>  \tconst ControlInfo &gainInfo = sensorInfoMap_.find(V4L2_CID_ANALOGUE_GAIN)->second;\n>  \n> +\t/* Clear the IPA context before the streaming session. */\n> +\tcontext_.configuration = {};\n> +\tcontext_.activeState = {};\n> +\tcontext_.frameContexts.clear();\n> +\n>  \tcontext_.configuration.agc.exposureMin = exposureInfo.min().get<int32_t>();\n>  \tcontext_.configuration.agc.exposureMax = exposureInfo.max().get<int32_t>();\n>  \tif (!context_.configuration.agc.exposureMin) {\n> @@ -245,6 +250,7 @@ int IPASoftSimple::start()\n>  \n>  void IPASoftSimple::stop()\n>  {\n> +  context_.frameContexts.clear();\n>  }\n>  \n>  void IPASoftSimple::queueRequest(const uint32_t frame, const ControlList &controls)","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 EB4E4C32F6\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 14 Oct 2024 07:44:40 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 898BA6537B;\n\tMon, 14 Oct 2024 09:44:39 +0200 (CEST)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AD0C965369\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 14 Oct 2024 09:44:37 +0200 (CEST)","from mail-wm1-f70.google.com (mail-wm1-f70.google.com\n\t[209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-319-itJrIIe7PrKaM8Gk68g4Fg-1; Mon, 14 Oct 2024 03:44:35 -0400","by mail-wm1-f70.google.com with SMTP id\n\t5b1f17b1804b1-43114c476c2so26539235e9.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 14 Oct 2024 00:44:35 -0700 (PDT)","from nuthatch (ip-77-48-47-2.net.vodafone.cz. [77.48.47.2])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-4311835d7b2sm113316815e9.42.2024.10.14.00.44.31\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 14 Oct 2024 00:44:32 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"SgLwjJzN\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1728891876;\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\tin-reply-to:in-reply-to:references:references;\n\tbh=dFHDTs1cZvR0WtI7ue4Pbmjq/dVJ4nuheKKvZ7joBcI=;\n\tb=SgLwjJzNMExTyrU1AkXR5ru1HK75H9hgEdT+HePpNF8yDwW4oq3TzjdnJc4p+2SyxPQjRj\n\tLsm6+12vjq6579XXI/BTO/9G56csg4pkCUhQi8CkULMhBpI6luld4Qz4NWDhmK51Ie9lgv\n\tyH1UmCgZrYMxBo8FJu8wkd0ikQob9Gs=","X-MC-Unique":"itJrIIe7PrKaM8Gk68g4Fg-1","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1728891874; x=1729496674;\n\th=mime-version:user-agent:message-id:date:references:in-reply-to\n\t:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=dFHDTs1cZvR0WtI7ue4Pbmjq/dVJ4nuheKKvZ7joBcI=;\n\tb=oieye9k6hymO/G9IiJ40tavFltKuiETfHqtB7cDhdbZB2z90x9iV0VIj9ASCvcChpe\n\t1qf9pg6k4rYRkJWwCObjtUHOnws5n8IwqMkx/lC0nj7MNiCwQOXFcvcBGRThMsyKu4vD\n\tOoEySWhmMV14+ILJlt43gFbYRnZnpoBpv0e+TjMNMh/6DgZMwMi/QDBEy+nFgNm1h4Ij\n\tsO3aGLqzL6zzjNDPo848bgAYze3lIWdmWSHIQ4/d0Foq9X3Wzrs344upfOXrfu8+Obbi\n\t9WoqM39Qo+BdiFUMfaewbJu5bKcjDwj68c7jaTetFFP/THAv/tAUUYwEKj1DXygVOVly\n\t9A7g==","X-Gm-Message-State":"AOJu0Yxu0Ty+JSDa7AJgp33WHMkM+ntvZT17n96J4bpdtXchAfdPEF26\n\t+lnXN+5m+qnlA/cpTRB4vzToQMs8mWuiSMkCDps28T9IHd+QnYkTo00whdwqTyvW7cEaTZ5UWR9\n\tTexUgZnx7VzkeKRHxpqV20lKmb1QS6GpT3dZpu0p7fG3BAAZ1kuzqBWHsdlLD14BaID01LX4MV3\n\t+XbTu8Tyyak+T716GH/R/ovxaqciJ32pLuDrCv0dqt0zuC0VPahOjFaME=","X-Received":["by 2002:a05:600c:1f8c:b0:42c:b220:4778 with SMTP id\n\t5b1f17b1804b1-4311df5c639mr91540665e9.33.1728891874040; \n\tMon, 14 Oct 2024 00:44:34 -0700 (PDT)","by 2002:a05:600c:1f8c:b0:42c:b220:4778 with SMTP id\n\t5b1f17b1804b1-4311df5c639mr91540545e9.33.1728891873632; \n\tMon, 14 Oct 2024 00:44:33 -0700 (PDT)"],"X-Google-Smtp-Source":"AGHT+IEhreV3GsNOZWQlMArJzxI441LnpIxCqs4NuWyb7w5xnnvPdt5GexrenLpUj51KmHwr0ZLtFQ==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Robert Mader <robert.mader@collabora.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v2] libcamera: software_isp: Clear IPA context on\n\tconfigure and stop","In-Reply-To":"<20241013175719.187166-1-robert.mader@collabora.com> (Robert\n\tMader's message of \"Sun, 13 Oct 2024 19:57:19 +0200\")","References":"<20241013175719.187166-1-robert.mader@collabora.com>","Date":"Mon, 14 Oct 2024 09:44:31 +0200","Message-ID":"<87r08jgmcg.fsf@redhat.com>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain","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>"}}]