From patchwork Sun Oct 13 17:57:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Mader X-Patchwork-Id: 21606 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 263ADC32F4 for ; Sun, 13 Oct 2024 17:58:02 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0C8F96537B; Sun, 13 Oct 2024 19:58:01 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=collabora.com header.i=robert.mader@collabora.com header.b="gNKjeLYX"; dkim-atps=neutral Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A55426536C for ; Sun, 13 Oct 2024 19:57:58 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; t=1728842275; cv=none; d=zohomail.com; s=zohoarc; b=IPhyxdzpTVwVI9mMqM2rh1wezjzb8HS62M5XxEOtZO5F64Bpxt3onTuc8MesRTlXg5C+UQtEuvdx0RovUrfn0iyDQXlSmegKv76e7FOLZ5gvruPjBGHIpLac9y3pidSGDZOAwnDkAw+OpZqDA/1bTL9xZ5C7GgIFcogTX8BAOpg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728842275; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=qq2M3lm2UNIBlxht18U7LCo+/FcXf0RSsbqz+27FrEw=; b=RDyKYgfWMcZ1I7xxz1SfYo3Y7WmrBedP5xIzZkNjDXgta/OUqM3mZs/6pL9hNT6lyNVEJcv2LspTgd/iSwyfRQ9fMI/Q9nNKtd9AASHjDnpAa2BhcOZN8t7agKgeHAmJUGH6sZu0uXG/UR93pxuon72wf37TY/th42ELlsVMMME= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=robert.mader@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1728842275; s=zohomail; d=collabora.com; i=robert.mader@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=qq2M3lm2UNIBlxht18U7LCo+/FcXf0RSsbqz+27FrEw=; b=gNKjeLYX8mo5bWqw6uF0+BzoPFt+ytkdC2fnRm/dBXny5DyOmobu6T2KqdGXvqBU o6z4v0aTdm0nv68+A0Xlp1FQAt1PxbXqM1zlSBrDCHoj3xUU8QSJl5lJU+gWpZyazY1 ogEnYxgbk+hPFKvjY7j6IS31oGcSCBZ02QRiLGoM= Received: by mx.zohomail.com with SMTPS id 172884227388238.28706110889277; Sun, 13 Oct 2024 10:57:53 -0700 (PDT) From: Robert Mader To: libcamera-devel@lists.libcamera.org Cc: Robert Mader Subject: [PATCH v2] libcamera: software_isp: Clear IPA context on configure and stop Date: Sun, 13 Oct 2024 19:57:19 +0200 Message-ID: <20241013175719.187166-1-robert.mader@collabora.com> X-Mailer: git-send-email 2.47.0 MIME-Version: 1.0 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" Like the hardware pipelines do. Not clearing frameContexts otherwise can trigger asserts like "Frame context for ... has been overwritten by ..." when switching between cameras using the swISP, e.g. on phones. Clearing the configuration and active state will become more important with upcoming changes such as getting the black level from the camera helper. Fixes: 04d171e6 ("libcamera: software_isp: Call Algorithm::queueRequest") Signed-off-by: Robert Mader Reviewed-by: Umang Jain Reviewed-by: Milan Zamazal --- Changes in version 2: - Also clear frameContexts as well as other context data on configure - Change commit title and message accordingly, previous title: "libcamera: software_isp: Clear frameContexts on Stop()" --- src/ipa/simple/soft_simple.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp index b28c7039..3b25d7d0 100644 --- a/src/ipa/simple/soft_simple.cpp +++ b/src/ipa/simple/soft_simple.cpp @@ -184,6 +184,11 @@ int IPASoftSimple::configure(const IPAConfigInfo &configInfo) const ControlInfo &exposureInfo = sensorInfoMap_.find(V4L2_CID_EXPOSURE)->second; const ControlInfo &gainInfo = sensorInfoMap_.find(V4L2_CID_ANALOGUE_GAIN)->second; + /* Clear the IPA context before the streaming session. */ + context_.configuration = {}; + context_.activeState = {}; + context_.frameContexts.clear(); + context_.configuration.agc.exposureMin = exposureInfo.min().get(); context_.configuration.agc.exposureMax = exposureInfo.max().get(); if (!context_.configuration.agc.exposureMin) { @@ -245,6 +250,7 @@ int IPASoftSimple::start() void IPASoftSimple::stop() { + context_.frameContexts.clear(); } void IPASoftSimple::queueRequest(const uint32_t frame, const ControlList &controls)