{"id":13017,"url":"https://patchwork.libcamera.org/api/1.1/patches/13017/?format=json","web_url":"https://patchwork.libcamera.org/patch/13017/","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":"<20210716105631.158153-12-paul.elder@ideasonboard.com>","date":"2021-07-16T10:56:21","name":"[libcamera-devel,RFC,v4,11/21] controls: Replace AwbEnable with AwbMode","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"d6e4c45cdab0c0912508b9a4dbb6be044ffe378c","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/1.1/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/13017/mbox/","series":[{"id":2244,"url":"https://patchwork.libcamera.org/api/1.1/series/2244/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2244","date":"2021-07-16T10:56:10","name":"Preliminary FULL plumbing","version":4,"mbox":"https://patchwork.libcamera.org/series/2244/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/13017/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13017/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 0BD14C3229\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 16 Jul 2021 10:57:14 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AB8A46854B;\n\tFri, 16 Jul 2021 12:57:13 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 943FE68539\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 16 Jul 2021 12:57:12 +0200 (CEST)","from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id ED04CA24;\n\tFri, 16 Jul 2021 12:57:10 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"qBF1OQ++\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1626433032;\n\tbh=dk7l7xi6vDH52evgCp+MC4f4IJnbO7xrCo9O70NbB+s=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=qBF1OQ++TJEQYPhXnebzSw2RH500LvAPsYLYyVUMUF/mFiu7xQk8WOk0/7OqTaAdL\n\tdoF6ysBAuo0NDuit529ndkX1XxIMX5QywLSyeKqvQnMDLNGkSQof0+E1TKwxAtE4yU\n\tBzktgHFGTOZyEbhKuPOAde0jstPKjsJx347hKhJo=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 16 Jul 2021 19:56:21 +0900","Message-Id":"<20210716105631.158153-12-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20210716105631.158153-1-paul.elder@ideasonboard.com>","References":"<20210716105631.158153-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [RFC PATCH v4 11/21] controls: Replace AwbEnable\n\twith AwbMode","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":"Previously it was possible to have AwbEnable set to false, yet have\nAwbMode on anything. This caused a confusion situation, so merge the two\ninto AwbMode. While at it, pull in the android AWB modes.\n\nAdjust the previous users of AwbEnable accordingly.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nChanges in v3:\n- resume raspberrypi awb on any non-off mode\n---\n include/libcamera/ipa/raspberrypi.h |  1 -\n src/ipa/raspberrypi/raspberrypi.cpp | 27 ++++++++----------------\n src/libcamera/control_ids.yaml      | 32 +++++++++++++++--------------\n test/controls/control_list.cpp      |  6 +++---\n 4 files changed, 29 insertions(+), 37 deletions(-)","diff":"diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h\nindex a8790000..63392a26 100644\n--- a/include/libcamera/ipa/raspberrypi.h\n+++ b/include/libcamera/ipa/raspberrypi.h\n@@ -35,7 +35,6 @@ static const ControlInfoMap Controls = {\n \t{ &controls::AeConstraintMode, ControlInfo(controls::AeConstraintModeValues) },\n \t{ &controls::AeExposureMode, ControlInfo(controls::AeExposureModeValues) },\n \t{ &controls::ExposureValue, ControlInfo(0.0f, 16.0f) },\n-\t{ &controls::AwbEnable, ControlInfo(false, true) },\n \t{ &controls::ColourGains, ControlInfo(0.0f, 32.0f) },\n \t{ &controls::AwbMode, ControlInfo(controls::AwbModeValues) },\n \t{ &controls::Brightness, ControlInfo(-1.0f, 1.0f) },\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 2739db28..f80d6c66 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -746,24 +746,6 @@ void IPARPi::queueRequest(const ControlList &controls)\n \t\t\tbreak;\n \t\t}\n \n-\t\tcase controls::AWB_ENABLE: {\n-\t\t\tRPiController::Algorithm *awb = controller_.GetAlgorithm(\"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-\t\t\telse\n-\t\t\t\tawb->Resume();\n-\n-\t\t\tlibcameraMetadata_.set(controls::AwbEnable,\n-\t\t\t\t\t       ctrl.second.get<bool>());\n-\t\t\tbreak;\n-\t\t}\n-\n \t\tcase controls::AWB_MODE: {\n \t\t\tRPiController::AwbAlgorithm *awb = dynamic_cast<RPiController::AwbAlgorithm *>(\n \t\t\t\tcontroller_.GetAlgorithm(\"awb\"));\n@@ -774,6 +756,15 @@ void IPARPi::queueRequest(const ControlList &controls)\n \t\t\t}\n \n \t\t\tint32_t idx = ctrl.second.get<int32_t>();\n+\n+\t\t\tif (idx == controls::AwbOff) {\n+\t\t\t\tawb->Pause();\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n+\t\t\tif (awb->IsPaused())\n+\t\t\t\tawb->Resume();\n+\n \t\t\tif (AwbModeTable.count(idx)) {\n \t\t\t\tawb->SetMode(AwbModeTable.at(idx));\n \t\t\t\tlibcameraMetadata_.set(controls::AwbMode, idx);\ndiff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml\nindex 5717bc1f..2e62f61b 100644\n--- a/src/libcamera/control_ids.yaml\n+++ b/src/libcamera/control_ids.yaml\n@@ -229,13 +229,6 @@ controls:\n         Report an estimate of the current illuminance level in lux. The Lux\n         control can only be returned in metadata.\n \n-  - AwbEnable:\n-      type: bool\n-      description: |\n-        Enable or disable the AWB.\n-\n-        \\sa ColourGains\n-\n   # AwbMode needs further attention:\n   # - Auto-generate max enum value.\n   # - Better handling of custom types.\n@@ -245,29 +238,38 @@ controls:\n         Specify the range of illuminants to use for the AWB algorithm. The modes\n         supported are platform specific, and not all modes may be supported.\n       enum:\n-        - name: AwbAuto\n+        - name: AwbOff\n           value: 0\n+          description: The AWB routune is disabled.\n+        - name: AwbAuto\n+          value: 1\n           description: Search over the whole colour temperature range.\n         - name: AwbIncandescent\n-          value: 1\n-          description: Incandescent AWB lamp mode.\n-        - name: AwbTungsten\n           value: 2\n-          description: Tungsten AWB lamp mode.\n+          description: Incandescent AWB lamp mode.\n         - name: AwbFluorescent\n           value: 3\n           description: Fluorescent AWB lamp mode.\n-        - name: AwbIndoor\n+        - name: AwbWarmFluorescent\n           value: 4\n-          description: Indoor AWB lighting mode.\n+          description: Warm fluorescent AWB lamp mode.\n         - name: AwbDaylight\n           value: 5\n           description: Daylight AWB lighting mode.\n         - name: AwbCloudy\n           value: 6\n           description: Cloudy AWB lighting mode.\n-        - name: AwbCustom\n+        - name: AwbTwilight\n           value: 7\n+          description: Twilight AWB lamp mode.\n+        - name: AwbTungsten\n+          value: 8\n+          description: Tungsten AWB lamp mode.\n+        - name: AwbIndoor\n+          value: 9\n+          description: Indoor AWB lighting mode.\n+        - name: AwbCustom\n+          value: 10\n           description: Custom AWB mode.\n \n   - AwbLocked:\ndiff --git a/test/controls/control_list.cpp b/test/controls/control_list.cpp\nindex 70cf61b8..ce55d09b 100644\n--- a/test/controls/control_list.cpp\n+++ b/test/controls/control_list.cpp\n@@ -143,10 +143,10 @@ protected:\n \t\t * Attempt to set an invalid control and verify that the\n \t\t * operation failed.\n \t\t */\n-\t\tlist.set(controls::AwbEnable, true);\n+\t\tlist.set(controls::AwbMode, true);\n \n-\t\tif (list.contains(controls::AwbEnable)) {\n-\t\t\tcout << \"List shouldn't contain AwbEnable control\" << endl;\n+\t\tif (list.contains(controls::AwbMode)) {\n+\t\t\tcout << \"List shouldn't contain AwbMode control\" << endl;\n \t\t\treturn TestFail;\n \t\t}\n \n","prefixes":["libcamera-devel","RFC","v4","11/21"]}