{"id":23770,"url":"https://patchwork.libcamera.org/api/patches/23770/?format=json","web_url":"https://patchwork.libcamera.org/patch/23770/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20250707171059.3259-1-nick.hollinghurst@raspberrypi.com>","date":"2025-07-07T17:10:59","name":"ipa: rpi: Fix bug in AfState reporting","commit_ref":"e6fb24ffdb3efb66829a8b0a8ce5628e4552ee30","pull_url":null,"state":"accepted","archived":false,"hash":"24905bb803d8752bd04b9753719c4855a6aca9b8","submitter":{"id":130,"url":"https://patchwork.libcamera.org/api/people/130/?format=json","name":"Nick Hollinghurst","email":"nick.hollinghurst@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/23770/mbox/","series":[{"id":5275,"url":"https://patchwork.libcamera.org/api/series/5275/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5275","date":"2025-07-07T17:10:59","name":"ipa: rpi: Fix bug in AfState reporting","version":1,"mbox":"https://patchwork.libcamera.org/series/5275/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/23770/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/23770/checks/","tags":{},"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 2081EC0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  7 Jul 2025 17:11:10 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2A80568EBE;\n\tMon,  7 Jul 2025 19:11:09 +0200 (CEST)","from mail-wm1-x334.google.com (mail-wm1-x334.google.com\n\t[IPv6:2a00:1450:4864:20::334])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8769B6151E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  7 Jul 2025 19:11:07 +0200 (CEST)","by mail-wm1-x334.google.com with SMTP id\n\t5b1f17b1804b1-4538a2fc7ffso31716255e9.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 07 Jul 2025 10:11:07 -0700 (PDT)","from raspberrypi.pitowers.org\n\t([2a00:1098:3142:1f:a457:3110:3364:a827])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-454b4eb4abasm110614415e9.40.2025.07.07.10.11.06\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 07 Jul 2025 10:11:06 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"feEqZsPK\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1751908267; x=1752513067;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:from:to:cc:subject:date:message-id:reply-to;\n\tbh=rzmAKvyFPHJtv/uS5iBItCbiqYssvFRmXCQlEcAu2g8=;\n\tb=feEqZsPK1v3gzThE1pXbh2nBYz8HIqNzNubS0orGs7CaHIV+kgSDK13FGVFV+wh1Eg\n\t+Q9hbqLkYF2VNBRVEoCXjPqf1bL8TMOEBkxM+EbnimKFFB073ByEhT+O615zEP/MPaWC\n\t04wc92LWXnBTJ8XrZl+9W1GPzJIMqlTyAMIMzr0Y/g/a+olu5Z6wOpFVr8vTw4ymR36t\n\tuwy1luf3MmCvAu5RILPapQOOeI6wL3PBbN2W3C4FheDT/NYaZCTcZXXSbpymuwxZ7JCL\n\tTvEP9R6OvYUwmpdff3zMCkeXePmpHw0h78JE2f32N3uv2hvHXizO8X3MHl7aL6TeELwz\n\tOSNQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1751908267; x=1752513067;\n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=rzmAKvyFPHJtv/uS5iBItCbiqYssvFRmXCQlEcAu2g8=;\n\tb=FBtcXpLVvP/2UjJPCD0IfMjzkSZ0VLn8CfJkthTpAo+YDx4P4each9tdzkTyaS3ep1\n\tREkhKgZfRtoLJDRocI3o1fdxCEM/iao1P6G3wjuYHaUgizVRA6xF6awshhnhVt2mTYol\n\t4rA2NEv45WxWuly2MpCxAiO6e6q2x6RbbCHSzzZ1E5CNJj+P+QVN4+ja/LWpPOpI8aG/\n\tsg4TUUaUUgmlaoJpQhejJrJACpAMaCNQznJnpjHhp5r78L7BnxXsg1xOMcpWJwT1Vrhw\n\tKtY7ne7Aj1HNClVx10CG1B77k37mKWRR7twBFoqUCKGjcxPLqtYU+JE8I/hHRaakY0qp\n\tcOxQ==","X-Gm-Message-State":"AOJu0YzDtXkzWWOxqCK/H+K8Iffo9QbEGk+08sd50qNGZp+pF0gYE5mZ\n\tXG2QvjkHDwCHSwno0zNVYCf1Sa8TH+vzCHehV+Ifqj1M0PL6ZURrY0wUT8tDeX/G9LvyBgDWs0h\n\tanks4","X-Gm-Gg":"ASbGncsfB+tbAhTFEctQrskkGAfLbMEUAaJ2URVEbS59EwvVPcOnf+/KgMSk/Okhl31\n\tkJ0e1+LOvaWSKeWctFJd3EgrfBpdDljnMuB5m9EeJY0t5x/i/ncAKlOHcgt6Em1in8OhV9FrOQR\n\tDDS70o9npvg3Febp5TVs1HXlwKrQ/OUD+WHY59HJdGq+4dqTKDJMzB2o+g7muDhpX9x9wOES2hk\n\tXd3tbB29tZ8vavBYrDTAxXnrCXuBSKZE6RFC8f8PY+6k2qaUCnjlm5blA6/Bd3BARvK2f9uHvBj\n\tiifxu/uvo8nS20cdKleeuNJEwNNco9Hs3+QZFn5GV+h6pRdgcHT20/6i35mK+PtRewGvsjYgLXB\n\tN6hqQQF+zCXhA44kqBzLheR0=","X-Google-Smtp-Source":"AGHT+IEXfjgJk7sKwWOT2oy9DvQMSK623y1iQBzoYlneMpCwgZhRGo7VSWfEKWdnhP38gIjhfm4wKg==","X-Received":"by 2002:a05:6000:481c:b0:3a5:2b1e:c49b with SMTP id\n\tffacd0b85a97d-3b5dd17a090mr179302f8f.29.1751908266815; \n\tMon, 07 Jul 2025 10:11:06 -0700 (PDT)","From":"Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>","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","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":"A previous change introduced a bug in which it reported AfStateIdle\nwhen idle in Auto mode, when it should continue to report the most\nrecent AF cycle's outcome (AfStateFocused or AfStateFailed).\n\nAlso fix the Pause method so it won't reset state to AfStateIdle\nwhen paused in Continuous AF mode (to match documented behaviour).\n\nSigned-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>\n---\n src/ipa/rpi/controller/rpi/af.cpp | 12 +++++++-----\n 1 file changed, 7 insertions(+), 5 deletions(-)","diff":"diff --git a/src/ipa/rpi/controller/rpi/af.cpp b/src/ipa/rpi/controller/rpi/af.cpp\nindex eaaca4bc..26e59930 100644\n--- a/src/ipa/rpi/controller/rpi/af.cpp\n+++ b/src/ipa/rpi/controller/rpi/af.cpp\n@@ -810,10 +810,10 @@ void Af::prepare(Metadata *imageMetadata)\n \telse\n \t\tstatus.pauseState = AfPauseState::Running;\n \n-\tif (scanState_ == ScanState::Idle)\n-\t\tstatus.state = AfState::Idle;\n-\telse if (mode_ == AfModeAuto)\n+\tif (mode_ == AfModeAuto && scanState_ != ScanState::Idle)\n \t\tstatus.state = AfState::Scanning;\n+\telse if (mode_ == AfModeManual)\n+\t\tstatus.state = AfState::Idle;\n \telse\n \t\tstatus.state = reportState_;\n \tstatus.lensSetting = initted_ ? std::optional<int>(cfg_.map.eval(fsmooth_))\n@@ -954,8 +954,10 @@ void Af::pause(AfAlgorithm::AfPause pause)\n \t\t\t\tscanState_ = ScanState::Trigger;\n \t\t} else if (pause != AfPauseResume && !pauseFlag_) {\n \t\t\tpauseFlag_ = true;\n-\t\t\tif (pause == AfPauseImmediate || scanState_ < ScanState::Coarse1)\n-\t\t\t\tgoIdle();\n+\t\t\tif (pause == AfPauseImmediate || scanState_ < ScanState::Coarse1) {\n+\t\t\t\tscanState_ = ScanState::Idle;\n+\t\t\t\tscanData_.clear();\n+\t\t\t}\n \t\t}\n \t}\n }\n","prefixes":[]}