Patch Detail
Show a patch.
GET /api/1.1/patches/11008/?format=api
{ "id": 11008, "url": "https://patchwork.libcamera.org/api/1.1/patches/11008/?format=api", "web_url": "https://patchwork.libcamera.org/patch/11008/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20210126154724.7155-1-david.plowman@raspberrypi.com>", "date": "2021-01-26T15:47:24", "name": "[libcamera-devel] ipa: raspberrypi: Warn when control algorithms are missing; do not fail", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "edee96097d9f037c4ab107e67d4255abba1ec3ed", "submitter": { "id": 42, "url": "https://patchwork.libcamera.org/api/1.1/people/42/?format=api", "name": "David Plowman", "email": "david.plowman@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/11008/mbox/", "series": [ { "id": 1610, "url": "https://patchwork.libcamera.org/api/1.1/series/1610/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1610", "date": "2021-01-26T15:47:24", "name": "[libcamera-devel] ipa: raspberrypi: Warn when control algorithms are missing; do not fail", "version": 1, "mbox": "https://patchwork.libcamera.org/series/1610/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/11008/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/11008/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 4961FC0F2B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 26 Jan 2021 15:47:32 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BE04C6830F;\n\tTue, 26 Jan 2021 16:47:31 +0100 (CET)", "from mail-ej1-x633.google.com (mail-ej1-x633.google.com\n\t[IPv6:2a00:1450:4864:20::633])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 22A4068301\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Jan 2021 16:47:30 +0100 (CET)", "by mail-ej1-x633.google.com with SMTP id g3so23610401ejb.6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Jan 2021 07:47:29 -0800 (PST)", "from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\tl16sm12631384edw.10.2021.01.26.07.47.28\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 26 Jan 2021 07:47:28 -0800 (PST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"mn9P5KgI\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=UZGTEGqk3F9NqM5bFNbmjHK/uu8P7EOytQl9bnSvWcg=;\n\tb=mn9P5KgIssSMiETvIl4AZsZ5NxaxdW27idwq16odK/cmqzqD/zB5BGp4IDLzGi68Wo\n\tl5rdkB/Hniy0dPtJBhspRUcN3TcwNfulDidlZdeFuLWcrNkDYgcSUdZA5d3m/KYRpyTx\n\t35xZe21qn9/UqpKnsQhsbOlmpbbith1xzg0oxSf7oV0ezo2si5fj8RB+3L5PyS3K8vhZ\n\teyNwEuPu2+x1qgpSgFkMEemAdKUo2aG/TO8mQO3G+aeDonK3ASuTdY64VpbmNepceKY+\n\tsFetBfM0yltJt0bHkfC9+gFK/IOvatt5E5tuhA0Mm08dW0cJ4bn4qKCzGExh5Daqca0d\n\tHdFA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=UZGTEGqk3F9NqM5bFNbmjHK/uu8P7EOytQl9bnSvWcg=;\n\tb=Jm7pams2yp3NtF5/XJSCHwscO1hlSu7SWFIv2TZ81hotl/zb6/cDAkJILm/Kxzt8O4\n\tUeY/IFceKia4YAsXm3w1EwdMyZHIc8iaAgZQYqpyndxTdopRsGYSrvl2RALRU48fSWcx\n\t49BsozD2nmvftKUknMHOAGm0ETOUWFn2wNpKx9WZoAhXCQYaMqW3+eWngGFJF43KmeAb\n\t+z+j8sqjMf7Ncq4Zm5L9PAlNZThhp7gRe4tsgdtE//Sg5S57Tgimldn/xVGv4EYXq6nj\n\torSGMMs6Vsm43xnqFJCNtxrdzEb31yGpQH9zJH/XsiH5vURRmcRfO/75uF93amG9L0nl\n\tm6dQ==", "X-Gm-Message-State": "AOAM530shsLzQRh8Zqjznp7QIYR/uj5iBN7B90lDh5oNAbdSK8wua+ff\n\tet8tpVnvxR8Ki4Lav9J1P05jYQX/X9xSYohX", "X-Google-Smtp-Source": "ABdhPJzzEO9pke8zD+pGzZ0MpPBZBWG/6NM+WqoiYQhXBfIj+sTWr565qZRdSGMOe2qFFN3Vpt5skA==", "X-Received": "by 2002:a17:906:17c3:: with SMTP id\n\tu3mr3736103eje.304.1611676049255; \n\tTue, 26 Jan 2021 07:47:29 -0800 (PST)", "From": "David Plowman <david.plowman@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 26 Jan 2021 15:47:24 +0000", "Message-Id": "<20210126154724.7155-1-david.plowman@raspberrypi.com>", "X-Mailer": "git-send-email 2.20.1", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH] ipa: raspberrypi: Warn when control\n\talgorithms are missing; do not fail", "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>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Users are free to avoid loading certain control algorithms from the\njson tuning file if they wish. Under such circumstances, failing\ncompletely when an application tries to set parameters for that\nalgorithm is unhelpful, and it is better just to issue a warning.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/ipa/raspberrypi/raspberrypi.cpp | 86 ++++++++++++++++++++++++-----\n 1 file changed, 72 insertions(+), 14 deletions(-)", "diff": "diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 5ccc7a65..b57d77e9 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -627,7 +627,12 @@ void IPARPi::queueRequest(const ControlList &controls)\n \t\tswitch (ctrl.first) {\n \t\tcase controls::AE_ENABLE: {\n \t\t\tRPiController::Algorithm *agc = controller_.GetAlgorithm(\"agc\");\n-\t\t\tASSERT(agc);\n+\t\t\tif (!agc) {\n+\t\t\t\tLOG(IPARPI, Warning)\n+\t\t\t\t\t<< \"Could not set AE_ENABLE - no AGC algorithm\";\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n \t\t\tif (ctrl.second.get<bool>() == false)\n \t\t\t\tagc->Pause();\n \t\t\telse\n@@ -640,7 +645,11 @@ void IPARPi::queueRequest(const ControlList &controls)\n \t\tcase controls::EXPOSURE_TIME: {\n \t\t\tRPiController::AgcAlgorithm *agc = dynamic_cast<RPiController::AgcAlgorithm *>(\n \t\t\t\tcontroller_.GetAlgorithm(\"agc\"));\n-\t\t\tASSERT(agc);\n+\t\t\tif (!agc) {\n+\t\t\t\tLOG(IPARPI, Warning)\n+\t\t\t\t\t<< \"Could not set EXPOSURE_TIME - no AGC algorithm\";\n+\t\t\t\tbreak;\n+\t\t\t}\n \n \t\t\t/* This expects units of micro-seconds. */\n \t\t\tagc->SetFixedShutter(ctrl.second.get<int32_t>());\n@@ -652,7 +661,12 @@ void IPARPi::queueRequest(const ControlList &controls)\n \t\tcase controls::ANALOGUE_GAIN: {\n \t\t\tRPiController::AgcAlgorithm *agc = dynamic_cast<RPiController::AgcAlgorithm *>(\n \t\t\t\tcontroller_.GetAlgorithm(\"agc\"));\n-\t\t\tASSERT(agc);\n+\t\t\tif (!agc) {\n+\t\t\t\tLOG(IPARPI, Warning)\n+\t\t\t\t\t<< \"Could not set ANALOGUE_GAIN - no AGC algorithm\";\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n \t\t\tagc->SetFixedAnalogueGain(ctrl.second.get<float>());\n \n \t\t\tlibcameraMetadata_.set(controls::AnalogueGain,\n@@ -663,7 +677,11 @@ void IPARPi::queueRequest(const ControlList &controls)\n \t\tcase controls::AE_METERING_MODE: {\n \t\t\tRPiController::AgcAlgorithm *agc = dynamic_cast<RPiController::AgcAlgorithm *>(\n \t\t\t\tcontroller_.GetAlgorithm(\"agc\"));\n-\t\t\tASSERT(agc);\n+\t\t\tif (!agc) {\n+\t\t\t\tLOG(IPARPI, Warning)\n+\t\t\t\t\t<< \"Could not set AE_METERING_MODE - no AGC algorithm\";\n+\t\t\t\tbreak;\n+\t\t\t}\n \n \t\t\tint32_t idx = ctrl.second.get<int32_t>();\n \t\t\tif (MeteringModeTable.count(idx)) {\n@@ -679,7 +697,11 @@ void IPARPi::queueRequest(const ControlList &controls)\n \t\tcase controls::AE_CONSTRAINT_MODE: {\n \t\t\tRPiController::AgcAlgorithm *agc = dynamic_cast<RPiController::AgcAlgorithm *>(\n \t\t\t\tcontroller_.GetAlgorithm(\"agc\"));\n-\t\t\tASSERT(agc);\n+\t\t\tif (!agc) {\n+\t\t\t\tLOG(IPARPI, Warning)\n+\t\t\t\t\t<< \"Could not set AE_CONSTRAINT_MODE - no AGC algorithm\";\n+\t\t\t\tbreak;\n+\t\t\t}\n \n \t\t\tint32_t idx = ctrl.second.get<int32_t>();\n \t\t\tif (ConstraintModeTable.count(idx)) {\n@@ -695,7 +717,11 @@ void IPARPi::queueRequest(const ControlList &controls)\n \t\tcase controls::AE_EXPOSURE_MODE: {\n \t\t\tRPiController::AgcAlgorithm *agc = dynamic_cast<RPiController::AgcAlgorithm *>(\n \t\t\t\tcontroller_.GetAlgorithm(\"agc\"));\n-\t\t\tASSERT(agc);\n+\t\t\tif (!agc) {\n+\t\t\t\tLOG(IPARPI, Warning)\n+\t\t\t\t\t<< \"Could not set AE_EXPOSURE_MODE - no AGC algorithm\";\n+\t\t\t\tbreak;\n+\t\t\t}\n \n \t\t\tint32_t idx = ctrl.second.get<int32_t>();\n \t\t\tif (ExposureModeTable.count(idx)) {\n@@ -711,7 +737,11 @@ void IPARPi::queueRequest(const ControlList &controls)\n \t\tcase controls::EXPOSURE_VALUE: {\n \t\t\tRPiController::AgcAlgorithm *agc = dynamic_cast<RPiController::AgcAlgorithm *>(\n \t\t\t\tcontroller_.GetAlgorithm(\"agc\"));\n-\t\t\tASSERT(agc);\n+\t\t\tif (!agc) {\n+\t\t\t\tLOG(IPARPI, Warning)\n+\t\t\t\t\t<< \"Could not set EXPOSURE_VALUE - no AGC algorithm\";\n+\t\t\t\tbreak;\n+\t\t\t}\n \n \t\t\t/*\n \t\t\t * The SetEv() method takes in a direct exposure multiplier.\n@@ -726,7 +756,11 @@ void IPARPi::queueRequest(const ControlList &controls)\n \n \t\tcase controls::AWB_ENABLE: {\n \t\t\tRPiController::Algorithm *awb = controller_.GetAlgorithm(\"awb\");\n-\t\t\tASSERT(awb);\n+\t\t\tif (!awb) {\n+\t\t\t\tLOG(IPARPI, Warning)\n+\t\t\t\t\t<< \"Could not set AWB_ENABLE - no AWB algorithm\";\n+\t\t\t\tbreak;\n+\t\t\t}\n \n \t\t\tif (ctrl.second.get<bool>() == false)\n \t\t\t\tawb->Pause();\n@@ -741,7 +775,11 @@ void IPARPi::queueRequest(const ControlList &controls)\n \t\tcase controls::AWB_MODE: {\n \t\t\tRPiController::AwbAlgorithm *awb = dynamic_cast<RPiController::AwbAlgorithm *>(\n \t\t\t\tcontroller_.GetAlgorithm(\"awb\"));\n-\t\t\tASSERT(awb);\n+\t\t\tif (!awb) {\n+\t\t\t\tLOG(IPARPI, Warning)\n+\t\t\t\t\t<< \"Could not set AWB_MODE - no AWB algorithm\";\n+\t\t\t\tbreak;\n+\t\t\t}\n \n \t\t\tint32_t idx = ctrl.second.get<int32_t>();\n \t\t\tif (AwbModeTable.count(idx)) {\n@@ -758,7 +796,11 @@ void IPARPi::queueRequest(const ControlList &controls)\n \t\t\tauto gains = ctrl.second.get<Span<const float>>();\n \t\t\tRPiController::AwbAlgorithm *awb = dynamic_cast<RPiController::AwbAlgorithm *>(\n \t\t\t\tcontroller_.GetAlgorithm(\"awb\"));\n-\t\t\tASSERT(awb);\n+\t\t\tif (!awb) {\n+\t\t\t\tLOG(IPARPI, Warning)\n+\t\t\t\t\t<< \"Could not set COLOUR_GAINS - no AWB algorithm\";\n+\t\t\t\tbreak;\n+\t\t\t}\n \n \t\t\tawb->SetManualGains(gains[0], gains[1]);\n \t\t\tif (gains[0] != 0.0f && gains[1] != 0.0f)\n@@ -771,7 +813,11 @@ void IPARPi::queueRequest(const ControlList &controls)\n \t\tcase controls::BRIGHTNESS: {\n \t\t\tRPiController::ContrastAlgorithm *contrast = dynamic_cast<RPiController::ContrastAlgorithm *>(\n \t\t\t\tcontroller_.GetAlgorithm(\"contrast\"));\n-\t\t\tASSERT(contrast);\n+\t\t\tif (!contrast) {\n+\t\t\t\tLOG(IPARPI, Warning)\n+\t\t\t\t\t<< \"Could not set BRIGHTNESS - no contrast algorithm\";\n+\t\t\t\tbreak;\n+\t\t\t}\n \n \t\t\tcontrast->SetBrightness(ctrl.second.get<float>() * 65536);\n \t\t\tlibcameraMetadata_.set(controls::Brightness,\n@@ -782,7 +828,11 @@ void IPARPi::queueRequest(const ControlList &controls)\n \t\tcase controls::CONTRAST: {\n \t\t\tRPiController::ContrastAlgorithm *contrast = dynamic_cast<RPiController::ContrastAlgorithm *>(\n \t\t\t\tcontroller_.GetAlgorithm(\"contrast\"));\n-\t\t\tASSERT(contrast);\n+\t\t\tif (!contrast) {\n+\t\t\t\tLOG(IPARPI, Warning)\n+\t\t\t\t\t<< \"Could not set CONTRAST - no contrast algorithm\";\n+\t\t\t\tbreak;\n+\t\t\t}\n \n \t\t\tcontrast->SetContrast(ctrl.second.get<float>());\n \t\t\tlibcameraMetadata_.set(controls::Contrast,\n@@ -793,7 +843,11 @@ void IPARPi::queueRequest(const ControlList &controls)\n \t\tcase controls::SATURATION: {\n \t\t\tRPiController::CcmAlgorithm *ccm = dynamic_cast<RPiController::CcmAlgorithm *>(\n \t\t\t\tcontroller_.GetAlgorithm(\"ccm\"));\n-\t\t\tASSERT(ccm);\n+\t\t\tif (!ccm) {\n+\t\t\t\tLOG(IPARPI, Warning)\n+\t\t\t\t\t<< \"Could not set SATURATION - no ccm algorithm\";\n+\t\t\t\tbreak;\n+\t\t\t}\n \n \t\t\tccm->SetSaturation(ctrl.second.get<float>());\n \t\t\tlibcameraMetadata_.set(controls::Saturation,\n@@ -804,7 +858,11 @@ void IPARPi::queueRequest(const ControlList &controls)\n \t\tcase controls::SHARPNESS: {\n \t\t\tRPiController::SharpenAlgorithm *sharpen = dynamic_cast<RPiController::SharpenAlgorithm *>(\n \t\t\t\tcontroller_.GetAlgorithm(\"sharpen\"));\n-\t\t\tASSERT(sharpen);\n+\t\t\tif (!sharpen) {\n+\t\t\t\tLOG(IPARPI, Warning)\n+\t\t\t\t\t<< \"Could not set SHARPNESS - no sharpen algorithm\";\n+\t\t\t\tbreak;\n+\t\t\t}\n \n \t\t\tsharpen->SetStrength(ctrl.second.get<float>());\n \t\t\tlibcameraMetadata_.set(controls::Sharpness,\n", "prefixes": [ "libcamera-devel" ] }