From patchwork Mon Jun 12 13:06:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18724 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 BE1FAC31E9 for ; Mon, 12 Jun 2023 13:30:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1888161E4B; Mon, 12 Jun 2023 15:30:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1686576655; bh=WRXVSbxhm9KyLGLZebS26OGlfDA0fOpIE1GUPqhat/g=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=XdvewPsR8Ji4Q9iJ7RloEJxsalMFKV3V8f+TQAhOdR4DheyTAcX4qNQoZ2oMbV99m Bhw9ktFs6pnK20+MRxiHKfeaiLV713kPBLUG8QGrimgAMHV3bocxv58goGce50/Cjd 5yUNh9DOaRrvSoskuYo0eeHItrPfTPiHS7IbJUuOLHrwBCaVuI6LLnUib5Jl4pHyAh dxQPAxEzXz1Q8bOekka0lV+OgImBmSqdqUUcTB1TrV32KUQZrYwQwh5hySvJcIIy0z UpjsW0trCqfzuxf7NQuFs2JuXqsKBkkuiybXLGIFpPiKyVtF82R6Qj4GdWqHxMuT0L 5OaoT7M5zFVSg== Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3130261E4A for ; Mon, 12 Jun 2023 15:30:53 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="rlebt3Y9"; dkim-atps=neutral Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3f6d7abe934so30382575e9.2 for ; Mon, 12 Jun 2023 06:30:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1686576652; x=1689168652; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Q+6R+no7zN7+APr2rYhRVRyVVL5yo//FI+Q3GMyrxe8=; b=rlebt3Y9p5pN+QWu2S9LjxZuMp6SQFbZauDCa3+XkZNrXBm/GYWbpfIP+qMXHcHwnp 4qCusmQJvGqwJ3qMjJaOL3ajpsu7Ml+0plUJMjdieULVzPOSvu4s4sBihCBniCyG9brk xFxRcRz3lNqafPjoyX45urU+m+txJmG4PO+Yjvps8/SmuAxiPiiYIV6EdBZVP6qe26xn 1TNf9Lt9G4dx8sX0Lb9NbnIp/5eIp6Otwlwocl5rK8YjRsPJhuxg9i1Qna/A/Ckj/Ulr UUq9SqZGusVNJ1ucpdZ0kOXkgQMKvf1zbAgLa5TCdm+NePxTImkqyEq3ojIQPR8vDbRe iPLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686576652; x=1689168652; 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=Q+6R+no7zN7+APr2rYhRVRyVVL5yo//FI+Q3GMyrxe8=; b=GmxlEApn2b+PtWnPAHHRp4upUpSBJRMZHumidriHGzRVMB9QXiVgGq78BItuaM/Mb1 pmUoe+qwFBkmSnmv29nY5/jjgIRAaPrGVv2rs5wtgA8xUBcZEq/7P5rUc8XJl/TbKFNl 82uuTRvEhwiTIkeZJpWEnF+r0OBRUuCys6yHDtTA8iiQOQtW9olva4TZ4VFrbCWo+hT8 47I9GiwapszJMNNTr0RAIJp284ukPYhkI9jBmfx77+SadKdHlAcFn12gz3nuK39IYS6m c1TnuQwtge8gUJSjYKK1jSHiJC20eWVkpFjv31phaSaqTLyoS4x859wgxXpm6piW7pv0 S1ew== X-Gm-Message-State: AC+VfDwwVzXFzd7EDfuFD7OUX/PoES0VzxwCYD+2LF4Z4ut1EI8c8wOw pLxQBINaicP7k2U/3wFrfpV1ora7y+Wtgv/FZ3Rsug== X-Google-Smtp-Source: ACHHUZ5udWKSsR14R9QRVbiRvhqaHNbsmTS9mMBEn+TC6dAeG/jZzmUfBfEH/8zGG+4VdC4o5NCp0A== X-Received: by 2002:a05:600c:228f:b0:3f8:13b0:a66c with SMTP id 15-20020a05600c228f00b003f813b0a66cmr4095188wmf.38.1686576652274; Mon, 12 Jun 2023 06:30:52 -0700 (PDT) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id k15-20020a7bc40f000000b003f7f1b3aff1sm11470122wmi.26.2023.06.12.06.30.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jun 2023 06:30:51 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 12 Jun 2023 14:06:08 +0100 Message-Id: <20230612130608.11651-1-naush@raspberrypi.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] ipa: rpi: agc: Do not switch to a default if a mode is unavailable 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: , X-Patchwork-Original-From: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" In commit 0ee9339331c6, a default metering/exposure/constraint mode is used if a control sets a mode that is not listed in the camera tuning file. Setting a default mode may be undesirable in these cases, so instead keep the agc mode unchanged. This also matches the behaviour for other IPA controls where no changes are made in error conditions. Fixes: 0ee9339331c6 ("ipa: rpi: agc: Gracefully handle missing agc modes") Signed-off-by: Naushir Patuck Reviewed-by: David Plowman --- src/ipa/rpi/controller/rpi/agc.cpp | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/ipa/rpi/controller/rpi/agc.cpp b/src/ipa/rpi/controller/rpi/agc.cpp index e60ca33f867b..ae9ff219fa03 100644 --- a/src/ipa/rpi/controller/rpi/agc.cpp +++ b/src/ipa/rpi/controller/rpi/agc.cpp @@ -541,39 +541,32 @@ void Agc::housekeepConfig() if (meteringModeName_ != status_.meteringMode) { auto it = config_.meteringModes.find(meteringModeName_); if (it == config_.meteringModes.end()) { - LOG(RPiAgc, Warning) << "No metering mode " << meteringModeName_ - << ", defaulting to " << config_.defaultMeteringMode; - meteringModeName_ = config_.defaultMeteringMode; - meteringMode_ = &config_.meteringModes[meteringModeName_]; + LOG(RPiAgc, Warning) << "No metering mode " << meteringModeName_; + meteringModeName_ = status_.meteringMode; } else { meteringMode_ = &it->second; + status_.meteringMode = meteringModeName_; } - status_.meteringMode = meteringModeName_; } if (exposureModeName_ != status_.exposureMode) { auto it = config_.exposureModes.find(exposureModeName_); if (it == config_.exposureModes.end()) { - LOG(RPiAgc, Warning) << "No exposure profile " << exposureModeName_ - << ", defaulting to " << config_.defaultExposureMode; - exposureModeName_ = config_.defaultExposureMode; - exposureMode_ = &config_.exposureModes[exposureModeName_]; + LOG(RPiAgc, Warning) << "No exposure profile " << exposureModeName_; + exposureModeName_ = status_.exposureMode; } else { exposureMode_ = &it->second; + status_.exposureMode = exposureModeName_; } - status_.exposureMode = exposureModeName_; } if (constraintModeName_ != status_.constraintMode) { - auto it = - config_.constraintModes.find(constraintModeName_); + auto it = config_.constraintModes.find(constraintModeName_); if (it == config_.constraintModes.end()) { - LOG(RPiAgc, Warning) << "No constraint list " << constraintModeName_ - << ", defaulting to " << config_.defaultConstraintMode; - constraintModeName_ = config_.defaultConstraintMode; - constraintMode_ = &config_.constraintModes[constraintModeName_]; + LOG(RPiAgc, Warning) << "No constraint list " << constraintModeName_; + constraintModeName_ = status_.constraintMode; } else { constraintMode_ = &it->second; + status_.constraintMode = constraintModeName_; } - status_.constraintMode = constraintModeName_; } LOG(RPiAgc, Debug) << "exposureMode " << exposureModeName_ << " constraintMode "