From patchwork Mon Jul 7 17:10:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Hollinghurst X-Patchwork-Id: 23770 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 2081EC0DA4 for ; Mon, 7 Jul 2025 17:11:10 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2A80568EBE; Mon, 7 Jul 2025 19:11:09 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="feEqZsPK"; dkim-atps=neutral Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8769B6151E for ; Mon, 7 Jul 2025 19:11:07 +0200 (CEST) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4538a2fc7ffso31716255e9.0 for ; Mon, 07 Jul 2025 10:11:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1751908267; x=1752513067; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=rzmAKvyFPHJtv/uS5iBItCbiqYssvFRmXCQlEcAu2g8=; b=feEqZsPK1v3gzThE1pXbh2nBYz8HIqNzNubS0orGs7CaHIV+kgSDK13FGVFV+wh1Eg +Q9hbqLkYF2VNBRVEoCXjPqf1bL8TMOEBkxM+EbnimKFFB073ByEhT+O615zEP/MPaWC 04wc92LWXnBTJ8XrZl+9W1GPzJIMqlTyAMIMzr0Y/g/a+olu5Z6wOpFVr8vTw4ymR36t uwy1luf3MmCvAu5RILPapQOOeI6wL3PBbN2W3C4FheDT/NYaZCTcZXXSbpymuwxZ7JCL TvEP9R6OvYUwmpdff3zMCkeXePmpHw0h78JE2f32N3uv2hvHXizO8X3MHl7aL6TeELwz OSNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751908267; x=1752513067; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=rzmAKvyFPHJtv/uS5iBItCbiqYssvFRmXCQlEcAu2g8=; b=FBtcXpLVvP/2UjJPCD0IfMjzkSZ0VLn8CfJkthTpAo+YDx4P4each9tdzkTyaS3ep1 REkhKgZfRtoLJDRocI3o1fdxCEM/iao1P6G3wjuYHaUgizVRA6xF6awshhnhVt2mTYol 4rA2NEv45WxWuly2MpCxAiO6e6q2x6RbbCHSzzZ1E5CNJj+P+QVN4+ja/LWpPOpI8aG/ sg4TUUaUUgmlaoJpQhejJrJACpAMaCNQznJnpjHhp5r78L7BnxXsg1xOMcpWJwT1Vrhw KtY7ne7Aj1HNClVx10CG1B77k37mKWRR7twBFoqUCKGjcxPLqtYU+JE8I/hHRaakY0qp cOxQ== X-Gm-Message-State: AOJu0YzDtXkzWWOxqCK/H+K8Iffo9QbEGk+08sd50qNGZp+pF0gYE5mZ XG2QvjkHDwCHSwno0zNVYCf1Sa8TH+vzCHehV+Ifqj1M0PL6ZURrY0wUT8tDeX/G9LvyBgDWs0h anks4 X-Gm-Gg: ASbGncsfB+tbAhTFEctQrskkGAfLbMEUAaJ2URVEbS59EwvVPcOnf+/KgMSk/Okhl31 kJ0e1+LOvaWSKeWctFJd3EgrfBpdDljnMuB5m9EeJY0t5x/i/ncAKlOHcgt6Em1in8OhV9FrOQR DDS70o9npvg3Febp5TVs1HXlwKrQ/OUD+WHY59HJdGq+4dqTKDJMzB2o+g7muDhpX9x9wOES2hk Xd3tbB29tZ8vavBYrDTAxXnrCXuBSKZE6RFC8f8PY+6k2qaUCnjlm5blA6/Bd3BARvK2f9uHvBj iifxu/uvo8nS20cdKleeuNJEwNNco9Hs3+QZFn5GV+h6pRdgcHT20/6i35mK+PtRewGvsjYgLXB N6hqQQF+zCXhA44kqBzLheR0= X-Google-Smtp-Source: AGHT+IEXfjgJk7sKwWOT2oy9DvQMSK623y1iQBzoYlneMpCwgZhRGo7VSWfEKWdnhP38gIjhfm4wKg== X-Received: by 2002:a05:6000:481c:b0:3a5:2b1e:c49b with SMTP id ffacd0b85a97d-3b5dd17a090mr179302f8f.29.1751908266815; Mon, 07 Jul 2025 10:11:06 -0700 (PDT) Received: from raspberrypi.pitowers.org ([2a00:1098:3142:1f:a457:3110:3364:a827]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-454b4eb4abasm110614415e9.40.2025.07.07.10.11.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jul 2025 10:11:06 -0700 (PDT) From: Nick Hollinghurst To: libcamera-devel@lists.libcamera.org Cc: Nick Hollinghurst Subject: [PATCH] ipa: rpi: Fix bug in AfState reporting Date: Mon, 7 Jul 2025 18:10:59 +0100 Message-Id: <20250707171059.3259-1-nick.hollinghurst@raspberrypi.com> X-Mailer: git-send-email 2.39.5 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" A previous change introduced a bug in which it reported AfStateIdle when idle in Auto mode, when it should continue to report the most recent AF cycle's outcome (AfStateFocused or AfStateFailed). Also fix the Pause method so it won't reset state to AfStateIdle when paused in Continuous AF mode (to match documented behaviour). Signed-off-by: Nick Hollinghurst Reviewed-by: David Plowman Tested-by: David Plowman --- src/ipa/rpi/controller/rpi/af.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/ipa/rpi/controller/rpi/af.cpp b/src/ipa/rpi/controller/rpi/af.cpp index eaaca4bc..26e59930 100644 --- a/src/ipa/rpi/controller/rpi/af.cpp +++ b/src/ipa/rpi/controller/rpi/af.cpp @@ -810,10 +810,10 @@ void Af::prepare(Metadata *imageMetadata) else status.pauseState = AfPauseState::Running; - if (scanState_ == ScanState::Idle) - status.state = AfState::Idle; - else if (mode_ == AfModeAuto) + if (mode_ == AfModeAuto && scanState_ != ScanState::Idle) status.state = AfState::Scanning; + else if (mode_ == AfModeManual) + status.state = AfState::Idle; else status.state = reportState_; status.lensSetting = initted_ ? std::optional(cfg_.map.eval(fsmooth_)) @@ -954,8 +954,10 @@ void Af::pause(AfAlgorithm::AfPause pause) scanState_ = ScanState::Trigger; } else if (pause != AfPauseResume && !pauseFlag_) { pauseFlag_ = true; - if (pause == AfPauseImmediate || scanState_ < ScanState::Coarse1) - goIdle(); + if (pause == AfPauseImmediate || scanState_ < ScanState::Coarse1) { + scanState_ = ScanState::Idle; + scanData_.clear(); + } } } }