{"id":18718,"url":"https://patchwork.libcamera.org/api/1.1/patches/18718/?format=json","web_url":"https://patchwork.libcamera.org/patch/18718/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20230607100054.4576-4-naush@raspberrypi.com>","date":"2023-06-07T10:00:54","name":"[libcamera-devel,v1,3/3] ipa: rpi: agc: Gracefully handle missing agc modes","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"136a97dcf13745251062800f31386c88f1af51c9","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18718/mbox/","series":[{"id":3912,"url":"https://patchwork.libcamera.org/api/1.1/series/3912/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3912","date":"2023-06-07T10:00:51","name":"RPi: AGC error handling","version":1,"mbox":"https://patchwork.libcamera.org/series/3912/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18718/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18718/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 7931AC328F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  7 Jun 2023 10:01:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2724E6289E;\n\tWed,  7 Jun 2023 12:01:11 +0200 (CEST)","from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com\n\t[IPv6:2a00:1450:4864:20::32f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 209BD6289C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  7 Jun 2023 12:01:08 +0200 (CEST)","by mail-wm1-x32f.google.com with SMTP id\n\t5b1f17b1804b1-3f6d7abe934so59962075e9.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 07 Jun 2023 03:01:08 -0700 (PDT)","from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tt7-20020a1c7707000000b003f6cf9afc25sm1556889wmi.40.2023.06.07.03.01.06\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 07 Jun 2023 03:01:06 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1686132071;\n\tbh=1QHR3dWY/MwiYLi2cYyB4VKJ3Gu++TAPUEAXFfnn3l8=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=ak7CATQuMkpXW4tfHGixy5vYEz+fgbU8ohgQ8KuCbOhqGoLapKPUCN7adaVfGK+lq\n\tzQB2shGr0qDKxkjWPvLg+pOOJFDjnKdpC5cpeL/ZbhM2WXlU+WzSdFzDaPZqEk8qE1\n\t2knThWNSjENDM9l/iRE1fIQW/av4tV90KP/bbflqAQywxvCTOs0yqvHv3JPoqa8SF+\n\tlqnYc4k1wjArw4daty33YpKcgLqs3ES/SYbQLNSDhMlMuMLg1nx8s84MvlnSu1rnjg\n\t7dgYubCs/Vli9bM71evALvk/tLlO/HRMIRtzcHKnxBdf7RTlvs8tLRuEF+ZTGjTskS\n\tEfkH/FKdKFDiA==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1686132067; x=1688724067;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=sxn5Q6k3mqIDixUudApfDx57EnlB3OjVXlUEML5ains=;\n\tb=ABNyOlI6AGeI4niZ5A1xoBR4JBcc+Tj65xGe+rl7AQbmygdtAunGkyqEFIbKbLBYRu\n\tQJ2PgOcZqPWdSVgPw7BqquMhggFLdQe3+mFnMvlZIu+5iBywVn3WQiucSGGSeXW6FW24\n\tP6m9qTdYHgr4ZbuER27vYltsZVWrxm4KQIaj6TSSOWBQ+IFwR+6JILEXVRCUWAqAowNi\n\ttsQ4MlKg3SpSPYY2By/enmtw/snzcjaT6oMD7aeASMIWCieHhu4naKzXuJ/5F5cqm1ox\n\tYyXYPPUJPIqhNIdvwP+BZxlVLJ9VtZv9+oFL/Tr0R9W0vOz0ha669V8NIPp+KNyN7QiB\n\tvh8w=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"ABNyOlI6\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20221208; t=1686132067; x=1688724067;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=sxn5Q6k3mqIDixUudApfDx57EnlB3OjVXlUEML5ains=;\n\tb=i7qcshU+zWghWM6nGaNrGbQ4MjEdjiuIVPZa19bxYeImCI/8RJFiYBiCb8YFh/Z8E6\n\t6XUshEpW6BQDmEMo3K9tAeKj5hSv2efotUY5T+vcCPZ5zK9ulPOB+fQzQD1sut1PDEKm\n\t0ni00w+dck4rFdPplGZcw4gwpSyEtmKmc3oy0izJLPi+FYBnVhTWnUR79t4BJxEMujZV\n\tnzFjuBTATB8rAuFRJicksedgeO+1kyRsYAr3wiizhedVcyJaHBJfra6M9f5Qi0ZsnCOd\n\tg7DnMr+LRzUsnSplotwcNR5Q6zyPFuCqckFJ/f7Oo+MaQqJroHHadJbWDONIbO/f3PGS\n\tLApg==","X-Gm-Message-State":"AC+VfDz3XVHHbAtDS4a9NkyNMbNCDTp4YOWXy5inUAB1h7Z/KKXij6Uv\n\twmWuNMz60EhLnOhEwkIGKVsiOHDlmqBd7mP7uYshhg==","X-Google-Smtp-Source":"ACHHUZ45j/LjvOFNfWHViyN7f6mWDHT3TguLblhbNviU7tE3YDLIogQLr/jDuohSlyZJc2J+e9vitA==","X-Received":"by 2002:a05:600c:2258:b0:3f4:298f:4d01 with SMTP id\n\ta24-20020a05600c225800b003f4298f4d01mr4219532wmm.26.1686132067295; \n\tWed, 07 Jun 2023 03:01:07 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  7 Jun 2023 11:00:54 +0100","Message-Id":"<20230607100054.4576-4-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20230607100054.4576-1-naush@raspberrypi.com>","References":"<20230607100054.4576-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v1 3/3] ipa: rpi: agc: Gracefully handle\n\tmissing agc modes","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":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"If a metering/exposure/constraint mode is not listed in the sensor\ntuning file, and a control for the missing mode is set on the agc, we\nterminate the application with a fatal log message.\n\nInstead of this fatal termination, log a warning message and switch to\nthe appropriate default mode so that the application continues running.\n\nReported-on: https://github.com/raspberrypi/libcamera/issues/59\nReported-on: https://github.com/ayufan/camera-streamer/issues/67\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/ipa/rpi/controller/rpi/agc.cpp | 30 +++++++++++++++++++++---------\n 1 file changed, 21 insertions(+), 9 deletions(-)","diff":"diff --git a/src/ipa/rpi/controller/rpi/agc.cpp b/src/ipa/rpi/controller/rpi/agc.cpp\nindex b611157af1f0..1b05d478818e 100644\n--- a/src/ipa/rpi/controller/rpi/agc.cpp\n+++ b/src/ipa/rpi/controller/rpi/agc.cpp\n@@ -540,24 +540,36 @@ void Agc::housekeepConfig()\n \t */\n \tif (meteringModeName_ != status_.meteringMode) {\n \t\tauto it = config_.meteringModes.find(meteringModeName_);\n-\t\tif (it == config_.meteringModes.end())\n-\t\t\tLOG(RPiAgc, Fatal) << \"No metering mode \" << meteringModeName_;\n-\t\tmeteringMode_ = &it->second;\n+\t\tif (it == config_.meteringModes.end()) {\n+\t\t\tLOG(RPiAgc, Warning) << \"No metering mode \" << meteringModeName_\n+\t\t\t\t\t     << \", defaulting to \" << config_.defaultMeteringMode;\n+\t\t\tmeteringModeName_ = config_.defaultMeteringMode;\n+\t\t\tmeteringMode_ = &config_.meteringModes[meteringModeName_];\n+\t\t} else\n+\t\t\tmeteringMode_ = &it->second;\n \t\tstatus_.meteringMode = meteringModeName_;\n \t}\n \tif (exposureModeName_ != status_.exposureMode) {\n \t\tauto it = config_.exposureModes.find(exposureModeName_);\n-\t\tif (it == config_.exposureModes.end())\n-\t\t\tLOG(RPiAgc, Fatal) << \"No exposure profile \" << exposureModeName_;\n-\t\texposureMode_ = &it->second;\n+\t\tif (it == config_.exposureModes.end()) {\n+\t\t\tLOG(RPiAgc, Warning) << \"No exposure profile \" << exposureModeName_\n+\t\t\t\t\t     << \", defaulting to \" << config_.defaultExposureMode;\n+\t\t\texposureModeName_ = config_.defaultExposureMode;\n+\t\t\texposureMode_ = &config_.exposureModes[exposureModeName_];\n+\t\t} else\n+\t\t\texposureMode_ = &it->second;\n \t\tstatus_.exposureMode = exposureModeName_;\n \t}\n \tif (constraintModeName_ != status_.constraintMode) {\n \t\tauto it =\n \t\t\tconfig_.constraintModes.find(constraintModeName_);\n-\t\tif (it == config_.constraintModes.end())\n-\t\t\tLOG(RPiAgc, Fatal) << \"No constraint list \" << constraintModeName_;\n-\t\tconstraintMode_ = &it->second;\n+\t\tif (it == config_.constraintModes.end()) {\n+\t\t\tLOG(RPiAgc, Warning) << \"No constraint list \" << constraintModeName_\n+\t\t\t\t\t     << \", defaulting to \" << config_.defaultConstraintMode;\n+\t\t\tconstraintModeName_ = config_.defaultConstraintMode;\n+\t\t\tconstraintMode_ = &config_.constraintModes[constraintModeName_];\n+\t\t} else\n+\t\t\tconstraintMode_ = &it->second;\n \t\tstatus_.constraintMode = constraintModeName_;\n \t}\n \tLOG(RPiAgc, Debug) << \"exposureMode \"\n","prefixes":["libcamera-devel","v1","3/3"]}