[{"id":27319,"web_url":"https://patchwork.libcamera.org/comment/27319/","msgid":"<CAHW6GYLO0QuhERqWR7YeRkAH09mF_5htgPvyqQRiLK6EGC89Jw@mail.gmail.com>","date":"2023-06-12T13:37:40","subject":"Re: [libcamera-devel] [PATCH] ipa: rpi: agc: Do not switch to a\n\tdefault if a mode is unavailable","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"content":"Hi Naush\n\nThanks for the patch!\n\nOn Mon, 12 Jun 2023 at 14:30, Naushir Patuck <naush@raspberrypi.com> wrote:\n>\n> In commit 0ee9339331c6, a default metering/exposure/constraint mode is\n> used if a control sets a mode that is not listed in the camera tuning\n> file.\n>\n> Setting a default mode may be undesirable in these cases, so instead\n> keep the agc mode unchanged. This also matches the behaviour for other\n> IPA controls where no changes are made in error conditions.\n>\n> Fixes: 0ee9339331c6 (\"ipa: rpi: agc: Gracefully handle missing agc modes\")\n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n\nIt's only a marginal thing but yes, I think I prefer this version!\n\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n\nThanks!\nDavid\n\n> ---\n>  src/ipa/rpi/controller/rpi/agc.cpp | 27 ++++++++++-----------------\n>  1 file changed, 10 insertions(+), 17 deletions(-)\n>\n> diff --git a/src/ipa/rpi/controller/rpi/agc.cpp b/src/ipa/rpi/controller/rpi/agc.cpp\n> index e60ca33f867b..ae9ff219fa03 100644\n> --- a/src/ipa/rpi/controller/rpi/agc.cpp\n> +++ b/src/ipa/rpi/controller/rpi/agc.cpp\n> @@ -541,39 +541,32 @@ void Agc::housekeepConfig()\n>         if (meteringModeName_ != status_.meteringMode) {\n>                 auto it = config_.meteringModes.find(meteringModeName_);\n>                 if (it == config_.meteringModes.end()) {\n> -                       LOG(RPiAgc, Warning) << \"No metering mode \" << meteringModeName_\n> -                                            << \", defaulting to \" << config_.defaultMeteringMode;\n> -                       meteringModeName_ = config_.defaultMeteringMode;\n> -                       meteringMode_ = &config_.meteringModes[meteringModeName_];\n> +                       LOG(RPiAgc, Warning) << \"No metering mode \" << meteringModeName_;\n> +                       meteringModeName_ = status_.meteringMode;\n>                 } else {\n>                         meteringMode_ = &it->second;\n> +                       status_.meteringMode = meteringModeName_;\n>                 }\n> -               status_.meteringMode = meteringModeName_;\n>         }\n>         if (exposureModeName_ != status_.exposureMode) {\n>                 auto it = config_.exposureModes.find(exposureModeName_);\n>                 if (it == config_.exposureModes.end()) {\n> -                       LOG(RPiAgc, Warning) << \"No exposure profile \" << exposureModeName_\n> -                                            << \", defaulting to \" << config_.defaultExposureMode;\n> -                       exposureModeName_ = config_.defaultExposureMode;\n> -                       exposureMode_ = &config_.exposureModes[exposureModeName_];\n> +                       LOG(RPiAgc, Warning) << \"No exposure profile \" << exposureModeName_;\n> +                       exposureModeName_ = status_.exposureMode;\n>                 } else {\n>                         exposureMode_ = &it->second;\n> +                       status_.exposureMode = exposureModeName_;\n>                 }\n> -               status_.exposureMode = exposureModeName_;\n>         }\n>         if (constraintModeName_ != status_.constraintMode) {\n> -               auto it =\n> -                       config_.constraintModes.find(constraintModeName_);\n> +               auto it = config_.constraintModes.find(constraintModeName_);\n>                 if (it == config_.constraintModes.end()) {\n> -                       LOG(RPiAgc, Warning) << \"No constraint list \" << constraintModeName_\n> -                                            << \", defaulting to \" << config_.defaultConstraintMode;\n> -                       constraintModeName_ = config_.defaultConstraintMode;\n> -                       constraintMode_ = &config_.constraintModes[constraintModeName_];\n> +                       LOG(RPiAgc, Warning) << \"No constraint list \" << constraintModeName_;\n> +                       constraintModeName_ = status_.constraintMode;\n>                 } else {\n>                         constraintMode_ = &it->second;\n> +                       status_.constraintMode = constraintModeName_;\n>                 }\n> -               status_.constraintMode = constraintModeName_;\n>         }\n>         LOG(RPiAgc, Debug) << \"exposureMode \"\n>                            << exposureModeName_ << \" constraintMode \"\n> --\n> 2.34.1\n>","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 A5E2EC3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 12 Jun 2023 13:37:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 11E5461E4B;\n\tMon, 12 Jun 2023 15:37:55 +0200 (CEST)","from mail-oa1-x31.google.com (mail-oa1-x31.google.com\n\t[IPv6:2001:4860:4864:20::31])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 21F2261E4A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Jun 2023 15:37:53 +0200 (CEST)","by mail-oa1-x31.google.com with SMTP id\n\t586e51a60fabf-1a67ea77c3bso1185381fac.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Jun 2023 06:37:53 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1686577075;\n\tbh=dllJpgZsOmE/HhWtG54vfijMFAMcXkUBfdoG+g5Y3aA=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=WBFaon/fl8WYxoxd+XmiGy4tvNpy+N7rrks8CM78+C/o3Uwhi+Ift5MrtjFy2elMi\n\tH89br/5lBpTjjGgdziZTIrB5SnM+4QI+Itd+zjDh0vy4d2jnqugVzdPfVsfTvPCXJT\n\tEGXrVZT+m7s/Bjz6teaQViY/8pdwY6dJaSphWo6a02HYhpDNKrJEbfrdUywBN0BobU\n\tQMfCQFPOz80YOQflySAxwuAOlwGKbLu/SeND+17t/jBtkeHWRuyCWaX4fERbEzP4io\n\tHslFP7dKhOBa8FjGrhYYDMbdUoq22Psz25XT3I5oBGgdW0qs4UX71PoisEokhPTqs1\n\tJBrSahNoTxTYQ==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1686577072; x=1689169072;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date:message-id:reply-to;\n\tbh=iS0mRsZdl2809V506wAE88/C4fRFHh/VqBJ+PJm/sWo=;\n\tb=LfLEQ9XtzEQC9yOP8HPQZnM8Am1Cco5Q9tA8Ma0BHghLgUPuys1gVKCaiu0iTYaYIZ\n\tpczOt7+V+xB9mNVQYVnlsOPQgXHjxX2s9oae3yHyXVAitvB+lTQ8tBLWNrWIRBq2cWz2\n\ty+JmnHCDG1qm2d2C3+sFakq1QYBsAtQx4ufJ4WIop8G8J56VN6htWBMj+GbGNkdSTdcH\n\taGeXeF68MmQj7VUOJwk7ERA5x4YKfvAVUTAnBfvilfoyLWjljyVtZBNhpCaEqt/U169I\n\tlg7mlYjMZCwOfEAK63khxGf3/68pAYdpseNxMJNXEy4KIdA9GlUPByWt8IsuFsojORG2\n\t/Stg=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"LfLEQ9Xt\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20221208; t=1686577072; x=1689169072;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=iS0mRsZdl2809V506wAE88/C4fRFHh/VqBJ+PJm/sWo=;\n\tb=gHsjnV+qTJTUQ2+VB1Lm7M1ftt5v5ADdi+BfD/VfcVwH8N2cu3A7ytamVbuUl06KK2\n\t6nfFxsA9jSRlj3wNFSjiI6FC49YrQj3MEAeCwdIeRpgdTMi7CEnZGWxVawFwxJZhlMA4\n\t0h79S/tdXwvj2XUvveqGpZgeu0W/hDUtz59C/Kyt+b5VwG1rL9lVQuErUNir2dU+GoqO\n\tPlNCzYDOCDU/QpcZaW/ZhOOSkkH1XkB3+seefpZHaV9LNrtxgybWLEwfibW1OmWcoUr1\n\tQ8E1tvwoyrS/dY86kYBupjA9JZ5Y07WN1Q0iOZ8eNhrbzpLfeps16uFoaA8spZjZQzwE\n\tf9hg==","X-Gm-Message-State":"AC+VfDyhe3HS80bk53tIOdHpl462dZsAHl4NlB/sAGJde0HraCqMKVdo\n\tdr6RibNlMPgEThJGQ5P8UdrXCSj1mPP3R1WjwCPQiA==","X-Google-Smtp-Source":"ACHHUZ7CdCeY/YiCoK7uEsEGBlY5g31jTWSU7A2mFpRGCOXlwID9EvchNsTtnHxobUpBeDMeJUFdufceYDz/uefw0jw=","X-Received":"by 2002:a05:6870:e7c5:b0:187:bd00:d63c with SMTP id\n\tq5-20020a056870e7c500b00187bd00d63cmr5913122oak.28.1686577071710;\n\tMon, 12 Jun 2023 06:37:51 -0700 (PDT)","MIME-Version":"1.0","References":"<20230612130608.11651-1-naush@raspberrypi.com>","In-Reply-To":"<20230612130608.11651-1-naush@raspberrypi.com>","Date":"Mon, 12 Jun 2023 14:37:40 +0100","Message-ID":"<CAHW6GYLO0QuhERqWR7YeRkAH09mF_5htgPvyqQRiLK6EGC89Jw@mail.gmail.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH] ipa: rpi: agc: Do not switch to a\n\tdefault if a mode is unavailable","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>","From":"David Plowman via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"David Plowman <david.plowman@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]