[{"id":36679,"web_url":"https://patchwork.libcamera.org/comment/36679/","msgid":"<176226877007.106261.12813691021182507312@isaac-ThinkPad-T16-Gen-2>","date":"2025-11-04T15:06:10","subject":"Re: [PATCH v1] treewide: Use proper enum types for\n\tcontrols/properties","submitter":{"id":215,"url":"https://patchwork.libcamera.org/api/people/215/","name":"Isaac Scott","email":"isaac.scott@ideasonboard.com"},"content":"Hi Barnabás,\n\nThank you for the patch!\n\nQuoting Barnabás Pőcze (2025-11-03 14:49:17)\n> The enumerated controls/properties use `int32_t` as their backing type.\n> In multiple cases, when parsing such an enum value from a source, an\n> integer type is used. Replace the integer type with the proper enum\n> type where it is trivially doable.\n> \n> This change also brings `CameraSensorLegacy::initProperties()` in line\n> with `CameraSensorRaw::initProperties()`, by defaulting the color\n> filter arrangement to `MONO`.\n> \n> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> ---\n>  src/ipa/libipa/agc_mean_luminance.cpp         | 2 +-\n>  src/ipa/rpi/common/ipa_base.cpp               | 4 +++-\n>  src/libcamera/sensor/camera_sensor_legacy.cpp | 5 +++--\n>  src/libcamera/sensor/camera_sensor_raw.cpp    | 5 ++---\n>  4 files changed, 9 insertions(+), 7 deletions(-)\n> \n> diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp\n> index 64f36bd75d..0c46329c09 100644\n> --- a/src/ipa/libipa/agc_mean_luminance.cpp\n> +++ b/src/ipa/libipa/agc_mean_luminance.cpp\n> @@ -297,7 +297,7 @@ int AgcMeanLuminance::parseExposureModes(const YamlObject &tuningData)\n>          * possible before touching gain.\n>          */\n>         if (availableExposureModes.empty()) {\n> -               int32_t exposureModeId = controls::ExposureNormal;\n> +               auto exposureModeId = controls::ExposureNormal;\n\nWhat is the type of 'auto' here? I'm not sure how I feel about using\nauto, because I'm not sure its more readable (especially in the case of\nthe MONO below).\n\nAssuming its still a int32_t, looks good to me!\n\nReviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>\n\n>                 std::vector<std::pair<utils::Duration, double>> stages = { };\n>  \n>                 std::shared_ptr<ExposureModeHelper> helper =\n> diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\n> index 8dfe35cc32..865035e578 100644\n> --- a/src/ipa/rpi/common/ipa_base.cpp\n> +++ b/src/ipa/rpi/common/ipa_base.cpp\n> @@ -1584,7 +1584,9 @@ void IpaBase::reportMetadata(unsigned int ipaContext)\n>  \n>         const AfStatus *afStatus = rpiMetadata.getLocked<AfStatus>(\"af.status\");\n>         if (afStatus) {\n> -               int32_t s, p;\n> +               controls::AfStateEnum s;\n> +               controls::AfPauseStateEnum p;\n> +\n>                 switch (afStatus->state) {\n>                 case AfState::Scanning:\n>                         s = controls::AfStateScanning;\n> diff --git a/src/libcamera/sensor/camera_sensor_legacy.cpp b/src/libcamera/sensor/camera_sensor_legacy.cpp\n> index f9e685a9ac..8b6df10ee6 100644\n> --- a/src/libcamera/sensor/camera_sensor_legacy.cpp\n> +++ b/src/libcamera/sensor/camera_sensor_legacy.cpp\n> @@ -571,7 +571,7 @@ int CameraSensorLegacy::initProperties()\n>         const auto &orientation = controls.find(V4L2_CID_CAMERA_ORIENTATION);\n>         if (orientation != controls.end()) {\n>                 int32_t v4l2Orientation = orientation->second.def().get<int32_t>();\n> -               int32_t propertyValue;\n> +               properties::LocationEnum propertyValue;\n>  \n>                 switch (v4l2Orientation) {\n>                 default:\n> @@ -624,7 +624,8 @@ int CameraSensorLegacy::initProperties()\n>  \n>         /* Color filter array pattern, register only for RAW sensors. */\n>         if (bayerFormat_) {\n> -               int32_t cfa;\n> +               auto cfa = properties::draft::MONO;\n> +\n>                 switch (bayerFormat_->order) {\n>                 case BayerFormat::BGGR:\n>                         cfa = properties::draft::BGGR;\n> diff --git a/src/libcamera/sensor/camera_sensor_raw.cpp b/src/libcamera/sensor/camera_sensor_raw.cpp\n> index 8ea4423698..cabaa21635 100644\n> --- a/src/libcamera/sensor/camera_sensor_raw.cpp\n> +++ b/src/libcamera/sensor/camera_sensor_raw.cpp\n> @@ -576,7 +576,7 @@ int CameraSensorRaw::initProperties()\n>         const auto &orientation = controls.find(V4L2_CID_CAMERA_ORIENTATION);\n>         if (orientation != controls.end()) {\n>                 int32_t v4l2Orientation = orientation->second.def().get<int32_t>();\n> -               int32_t propertyValue;\n> +               properties::LocationEnum propertyValue;\n>  \n>                 switch (v4l2Orientation) {\n>                 default:\n> @@ -628,7 +628,7 @@ int CameraSensorRaw::initProperties()\n>         properties_.set(properties::PixelArrayActiveAreas, { activeArea_ });\n>  \n>         /* Color filter array pattern. */\n> -       uint32_t cfa;\n> +       auto cfa = properties::draft::MONO;\n>  \n>         switch (cfaPattern_) {\n>         case BayerFormat::BGGR:\n> @@ -644,7 +644,6 @@ int CameraSensorRaw::initProperties()\n>                 cfa = properties::draft::RGGB;\n>                 break;\n>         case BayerFormat::MONO:\n> -       default:\n>                 cfa = properties::draft::MONO;\n>                 break;\n>         }\n> -- \n> 2.51.2\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 B6FB9C3241\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  4 Nov 2025 15:06:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CE8A360A8B;\n\tTue,  4 Nov 2025 16:06:14 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 06FBD6069A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  4 Nov 2025 16:06:13 +0100 (CET)","from thinkpad.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 27CC69FC;\n\tTue,  4 Nov 2025 16:04:19 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"GZgKeMNO\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1762268659;\n\tbh=VJqmWGKsjP5HqP73rDfAivug+wadNZ2nQtQEhanjiLk=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=GZgKeMNOfdk3TyVHh2zAG4T5n1838FeK4PGZugxV7JWsIpWB6sxWwn1kvzhhE1m2g\n\t0UYGnGBj0bjm4o7o5G26aDhevdAix2k0IUDW7s6aOE9X1/xZiN2hU7cScvhq8XAzDd\n\tbN6lTtjcPAT3u2nYblLB+0bs+3xCykz4p6hF+G/8=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20251103144917.439212-1-barnabas.pocze@ideasonboard.com>","References":"<20251103144917.439212-1-barnabas.pocze@ideasonboard.com>","Subject":"Re: [PATCH v1] treewide: Use proper enum types for\n\tcontrols/properties","From":"Isaac Scott <isaac.scott@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Tue, 04 Nov 2025 15:06:10 +0000","Message-ID":"<176226877007.106261.12813691021182507312@isaac-ThinkPad-T16-Gen-2>","User-Agent":"alot/0.10","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>"}},{"id":36732,"web_url":"https://patchwork.libcamera.org/comment/36732/","msgid":"<d958f3b2-47f8-4ac4-af52-b1873da542bc@ideasonboard.com>","date":"2025-11-06T13:43:20","subject":"Re: [PATCH v1] treewide: Use proper enum types for\n\tcontrols/properties","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"Hi\n\n2025. 11. 04. 16:06 keltezéssel, Isaac Scott írta:\n> Hi Barnabás,\n> \n> Thank you for the patch!\n> \n> Quoting Barnabás Pőcze (2025-11-03 14:49:17)\n>> The enumerated controls/properties use `int32_t` as their backing type.\n>> In multiple cases, when parsing such an enum value from a source, an\n>> integer type is used. Replace the integer type with the proper enum\n>> type where it is trivially doable.\n>>\n>> This change also brings `CameraSensorLegacy::initProperties()` in line\n>> with `CameraSensorRaw::initProperties()`, by defaulting the color\n>> filter arrangement to `MONO`.\n>>\n>> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n>> ---\n>>   src/ipa/libipa/agc_mean_luminance.cpp         | 2 +-\n>>   src/ipa/rpi/common/ipa_base.cpp               | 4 +++-\n>>   src/libcamera/sensor/camera_sensor_legacy.cpp | 5 +++--\n>>   src/libcamera/sensor/camera_sensor_raw.cpp    | 5 ++---\n>>   4 files changed, 9 insertions(+), 7 deletions(-)\n>>\n>> diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp\n>> index 64f36bd75d..0c46329c09 100644\n>> --- a/src/ipa/libipa/agc_mean_luminance.cpp\n>> +++ b/src/ipa/libipa/agc_mean_luminance.cpp\n>> @@ -297,7 +297,7 @@ int AgcMeanLuminance::parseExposureModes(const YamlObject &tuningData)\n>>           * possible before touching gain.\n>>           */\n>>          if (availableExposureModes.empty()) {\n>> -               int32_t exposureModeId = controls::ExposureNormal;\n>> +               auto exposureModeId = controls::ExposureNormal;\n> \n> What is the type of 'auto' here? I'm not sure how I feel about using\n> auto, because I'm not sure its more readable (especially in the case of\n> the MONO below).\n\nThe type would be `controls::AeExposureModeEnum` here and `controls::draft::ColorFilterArrangementEnum`\nfor \"MONO\"; but I thought they would be a bit long.\n\n\n> \n> Assuming its still a int32_t, looks good to me!\n> \n> Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>\n> \n>>                  std::vector<std::pair<utils::Duration, double>> stages = { };\n>>   \n>>                  std::shared_ptr<ExposureModeHelper> helper =\n>> diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\n>> index 8dfe35cc32..865035e578 100644\n>> --- a/src/ipa/rpi/common/ipa_base.cpp\n>> +++ b/src/ipa/rpi/common/ipa_base.cpp\n>> @@ -1584,7 +1584,9 @@ void IpaBase::reportMetadata(unsigned int ipaContext)\n>>   \n>>          const AfStatus *afStatus = rpiMetadata.getLocked<AfStatus>(\"af.status\");\n>>          if (afStatus) {\n>> -               int32_t s, p;\n>> +               controls::AfStateEnum s;\n>> +               controls::AfPauseStateEnum p;\n>> +\n>>                  switch (afStatus->state) {\n>>                  case AfState::Scanning:\n>>                          s = controls::AfStateScanning;\n>> diff --git a/src/libcamera/sensor/camera_sensor_legacy.cpp b/src/libcamera/sensor/camera_sensor_legacy.cpp\n>> index f9e685a9ac..8b6df10ee6 100644\n>> --- a/src/libcamera/sensor/camera_sensor_legacy.cpp\n>> +++ b/src/libcamera/sensor/camera_sensor_legacy.cpp\n>> @@ -571,7 +571,7 @@ int CameraSensorLegacy::initProperties()\n>>          const auto &orientation = controls.find(V4L2_CID_CAMERA_ORIENTATION);\n>>          if (orientation != controls.end()) {\n>>                  int32_t v4l2Orientation = orientation->second.def().get<int32_t>();\n>> -               int32_t propertyValue;\n>> +               properties::LocationEnum propertyValue;\n>>   \n>>                  switch (v4l2Orientation) {\n>>                  default:\n>> @@ -624,7 +624,8 @@ int CameraSensorLegacy::initProperties()\n>>   \n>>          /* Color filter array pattern, register only for RAW sensors. */\n>>          if (bayerFormat_) {\n>> -               int32_t cfa;\n>> +               auto cfa = properties::draft::MONO;\n>> +\n>>                  switch (bayerFormat_->order) {\n>>                  case BayerFormat::BGGR:\n>>                          cfa = properties::draft::BGGR;\n>> diff --git a/src/libcamera/sensor/camera_sensor_raw.cpp b/src/libcamera/sensor/camera_sensor_raw.cpp\n>> index 8ea4423698..cabaa21635 100644\n>> --- a/src/libcamera/sensor/camera_sensor_raw.cpp\n>> +++ b/src/libcamera/sensor/camera_sensor_raw.cpp\n>> @@ -576,7 +576,7 @@ int CameraSensorRaw::initProperties()\n>>          const auto &orientation = controls.find(V4L2_CID_CAMERA_ORIENTATION);\n>>          if (orientation != controls.end()) {\n>>                  int32_t v4l2Orientation = orientation->second.def().get<int32_t>();\n>> -               int32_t propertyValue;\n>> +               properties::LocationEnum propertyValue;\n>>   \n>>                  switch (v4l2Orientation) {\n>>                  default:\n>> @@ -628,7 +628,7 @@ int CameraSensorRaw::initProperties()\n>>          properties_.set(properties::PixelArrayActiveAreas, { activeArea_ });\n>>   \n>>          /* Color filter array pattern. */\n>> -       uint32_t cfa;\n>> +       auto cfa = properties::draft::MONO;\n>>   \n>>          switch (cfaPattern_) {\n>>          case BayerFormat::BGGR:\n>> @@ -644,7 +644,6 @@ int CameraSensorRaw::initProperties()\n>>                  cfa = properties::draft::RGGB;\n>>                  break;\n>>          case BayerFormat::MONO:\n>> -       default:\n>>                  cfa = properties::draft::MONO;\n>>                  break;\n>>          }\n>> -- \n>> 2.51.2\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 3F3A9BDE4C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  6 Nov 2025 13:43:27 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8CFDB609D8;\n\tThu,  6 Nov 2025 14:43:26 +0100 (CET)","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 B2531606E6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  6 Nov 2025 14:43:24 +0100 (CET)","from [192.168.33.20] (185.221.140.239.nat.pool.zt.hu\n\t[185.221.140.239])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 57ECC6AF;\n\tThu,  6 Nov 2025 14:41:29 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"CJWmk47Y\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1762436489;\n\tbh=/FbRKAlSWBqpsmE//jom9B0qWzz2rPb3De9htbZ1mJE=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=CJWmk47YOq8xw508xujqldeZg4yD2R29WsXwiBOO7e9lBlzaub6nr8TRrsMaRgH2L\n\ti7WPggMqo0x0VEgvz78cn0w8KPkg46z/bnwisldLwMpc19Xyzgb+oNlPJMtFYvpjDk\n\tKQH5hiE32Ka68EHYJPsIyrXQ/FElEk7Ph/Z3dueo=","Message-ID":"<d958f3b2-47f8-4ac4-af52-b1873da542bc@ideasonboard.com>","Date":"Thu, 6 Nov 2025 14:43:20 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v1] treewide: Use proper enum types for\n\tcontrols/properties","To":"Isaac Scott <isaac.scott@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20251103144917.439212-1-barnabas.pocze@ideasonboard.com>\n\t<176226877007.106261.12813691021182507312@isaac-ThinkPad-T16-Gen-2>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<176226877007.106261.12813691021182507312@isaac-ThinkPad-T16-Gen-2>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","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>"}},{"id":36762,"web_url":"https://patchwork.libcamera.org/comment/36762/","msgid":"<176279651871.2141792.2309104174066656251@ping.linuxembedded.co.uk>","date":"2025-11-10T17:41:58","subject":"Re: [PATCH v1] treewide: Use proper enum types for\n\tcontrols/properties","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Barnabás Pőcze (2025-11-03 14:49:17)\n> The enumerated controls/properties use `int32_t` as their backing type.\n> In multiple cases, when parsing such an enum value from a source, an\n> integer type is used. Replace the integer type with the proper enum\n> type where it is trivially doable.\n> \n> This change also brings `CameraSensorLegacy::initProperties()` in line\n> with `CameraSensorRaw::initProperties()`, by defaulting the color\n> filter arrangement to `MONO`.\n> \n> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> ---\n>  src/ipa/libipa/agc_mean_luminance.cpp         | 2 +-\n>  src/ipa/rpi/common/ipa_base.cpp               | 4 +++-\n>  src/libcamera/sensor/camera_sensor_legacy.cpp | 5 +++--\n>  src/libcamera/sensor/camera_sensor_raw.cpp    | 5 ++---\n>  4 files changed, 9 insertions(+), 7 deletions(-)\n> \n> diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp\n> index 64f36bd75d..0c46329c09 100644\n> --- a/src/ipa/libipa/agc_mean_luminance.cpp\n> +++ b/src/ipa/libipa/agc_mean_luminance.cpp\n> @@ -297,7 +297,7 @@ int AgcMeanLuminance::parseExposureModes(const YamlObject &tuningData)\n>          * possible before touching gain.\n>          */\n>         if (availableExposureModes.empty()) {\n> -               int32_t exposureModeId = controls::ExposureNormal;\n> +               auto exposureModeId = controls::ExposureNormal;\n>                 std::vector<std::pair<utils::Duration, double>> stages = { };\n>  \n>                 std::shared_ptr<ExposureModeHelper> helper =\n> diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\n> index 8dfe35cc32..865035e578 100644\n> --- a/src/ipa/rpi/common/ipa_base.cpp\n> +++ b/src/ipa/rpi/common/ipa_base.cpp\n> @@ -1584,7 +1584,9 @@ void IpaBase::reportMetadata(unsigned int ipaContext)\n>  \n>         const AfStatus *afStatus = rpiMetadata.getLocked<AfStatus>(\"af.status\");\n>         if (afStatus) {\n> -               int32_t s, p;\n> +               controls::AfStateEnum s;\n> +               controls::AfPauseStateEnum p;\n> +\n>                 switch (afStatus->state) {\n>                 case AfState::Scanning:\n>                         s = controls::AfStateScanning;\n> diff --git a/src/libcamera/sensor/camera_sensor_legacy.cpp b/src/libcamera/sensor/camera_sensor_legacy.cpp\n> index f9e685a9ac..8b6df10ee6 100644\n> --- a/src/libcamera/sensor/camera_sensor_legacy.cpp\n> +++ b/src/libcamera/sensor/camera_sensor_legacy.cpp\n> @@ -571,7 +571,7 @@ int CameraSensorLegacy::initProperties()\n>         const auto &orientation = controls.find(V4L2_CID_CAMERA_ORIENTATION);\n>         if (orientation != controls.end()) {\n>                 int32_t v4l2Orientation = orientation->second.def().get<int32_t>();\n> -               int32_t propertyValue;\n> +               properties::LocationEnum propertyValue;\n>  \n>                 switch (v4l2Orientation) {\n>                 default:\n> @@ -624,7 +624,8 @@ int CameraSensorLegacy::initProperties()\n>  \n>         /* Color filter array pattern, register only for RAW sensors. */\n>         if (bayerFormat_) {\n> -               int32_t cfa;\n> +               auto cfa = properties::draft::MONO;\n> +\n>                 switch (bayerFormat_->order) {\n>                 case BayerFormat::BGGR:\n>                         cfa = properties::draft::BGGR;\n> diff --git a/src/libcamera/sensor/camera_sensor_raw.cpp b/src/libcamera/sensor/camera_sensor_raw.cpp\n> index 8ea4423698..cabaa21635 100644\n> --- a/src/libcamera/sensor/camera_sensor_raw.cpp\n> +++ b/src/libcamera/sensor/camera_sensor_raw.cpp\n> @@ -576,7 +576,7 @@ int CameraSensorRaw::initProperties()\n>         const auto &orientation = controls.find(V4L2_CID_CAMERA_ORIENTATION);\n>         if (orientation != controls.end()) {\n>                 int32_t v4l2Orientation = orientation->second.def().get<int32_t>();\n> -               int32_t propertyValue;\n> +               properties::LocationEnum propertyValue;\n>  \n>                 switch (v4l2Orientation) {\n>                 default:\n> @@ -628,7 +628,7 @@ int CameraSensorRaw::initProperties()\n>         properties_.set(properties::PixelArrayActiveAreas, { activeArea_ });\n>  \n>         /* Color filter array pattern. */\n> -       uint32_t cfa;\n> +       auto cfa = properties::draft::MONO;\n\nI'm fine with this patch so:\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n\nBut (I expect this is yak-shaving) - can we take this opportunity to get\nrid of the only ::draft:: property ?\n\n5d3d0dcedb36f991b7f395c15b9112694f44d87d introduced this back in 2020!\n\n    libcamera: properties: ColorFilterArrangement draft property\n\n    Define the 'ColorFilterArrangement' draft property. The property is\n    currently identical to ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT.\n\n    Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n    Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nIf we drop the text \"Currently identical to\nANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT.\"\n\nI think we can move this to a real property.\n\nThis should never have been a draft :-) I think we can be fairly sure\nthat these are accepted CFA arrangements.\n\nMaybe we'll add some more exotic arrangements later - but I don't think\nthere's anything /wrong/ with these as they are.\n\n--\nKieran\n\n\n>  \n>         switch (cfaPattern_) {\n>         case BayerFormat::BGGR:\n> @@ -644,7 +644,6 @@ int CameraSensorRaw::initProperties()\n>                 cfa = properties::draft::RGGB;\n>                 break;\n>         case BayerFormat::MONO:\n> -       default:\n>                 cfa = properties::draft::MONO;\n>                 break;\n>         }\n> -- \n> 2.51.2\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 1E98DC3263\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 10 Nov 2025 17:42:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 42FF0609D8;\n\tMon, 10 Nov 2025 18:42:03 +0100 (CET)","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 AD57D60856\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 10 Nov 2025 18:42:01 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 149ADC6F;\n\tMon, 10 Nov 2025 18:40:03 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"N1uNZge5\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1762796403;\n\tbh=znHGRzJZGJBPjsvcE0SEInXBjXI/ULm4lJgQj12G8WI=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=N1uNZge5vrcb90lejuKoryz8U8oux7cWjm/w3dO01SNZ4M0UM2+av9h9f3v/hX04n\n\t8axAJnJJi0wJ+vqUUGctu0IZzGO6Dnr3E2N59rk1DPLEusAq9S1c8uJTQfIcQ5q/Xm\n\tOHgyH+mmQTyAYwDjKKKQmBibzuMmZR8G1T8wloH4=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20251103144917.439212-1-barnabas.pocze@ideasonboard.com>","References":"<20251103144917.439212-1-barnabas.pocze@ideasonboard.com>","Subject":"Re: [PATCH v1] treewide: Use proper enum types for\n\tcontrols/properties","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 10 Nov 2025 17:41:58 +0000","Message-ID":"<176279651871.2141792.2309104174066656251@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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>"}},{"id":36776,"web_url":"https://patchwork.libcamera.org/comment/36776/","msgid":"<20251111173810.GC12331@pendragon.ideasonboard.com>","date":"2025-11-11T17:38:10","subject":"Re: [PATCH v1] treewide: Use proper enum types for\n\tcontrols/properties","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Thu, Nov 06, 2025 at 02:43:20PM +0100, Barnabás Pőcze wrote:\n> 2025. 11. 04. 16:06 keltezéssel, Isaac Scott írta:\n> > Quoting Barnabás Pőcze (2025-11-03 14:49:17)\n> >> The enumerated controls/properties use `int32_t` as their backing type.\n> >> In multiple cases, when parsing such an enum value from a source, an\n> >> integer type is used. Replace the integer type with the proper enum\n> >> type where it is trivially doable.\n> >>\n> >> This change also brings `CameraSensorLegacy::initProperties()` in line\n> >> with `CameraSensorRaw::initProperties()`, by defaulting the color\n> >> filter arrangement to `MONO`.\n> >>\n> >> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> >> ---\n> >>   src/ipa/libipa/agc_mean_luminance.cpp         | 2 +-\n> >>   src/ipa/rpi/common/ipa_base.cpp               | 4 +++-\n> >>   src/libcamera/sensor/camera_sensor_legacy.cpp | 5 +++--\n> >>   src/libcamera/sensor/camera_sensor_raw.cpp    | 5 ++---\n> >>   4 files changed, 9 insertions(+), 7 deletions(-)\n> >>\n> >> diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp\n> >> index 64f36bd75d..0c46329c09 100644\n> >> --- a/src/ipa/libipa/agc_mean_luminance.cpp\n> >> +++ b/src/ipa/libipa/agc_mean_luminance.cpp\n> >> @@ -297,7 +297,7 @@ int AgcMeanLuminance::parseExposureModes(const YamlObject &tuningData)\n> >>           * possible before touching gain.\n> >>           */\n> >>          if (availableExposureModes.empty()) {\n> >> -               int32_t exposureModeId = controls::ExposureNormal;\n> >> +               auto exposureModeId = controls::ExposureNormal;\n> > \n> > What is the type of 'auto' here? I'm not sure how I feel about using\n> > auto, because I'm not sure its more readable (especially in the case of\n> > the MONO below).\n> \n> The type would be `controls::AeExposureModeEnum` here and `controls::draft::ColorFilterArrangementEnum`\n> for \"MONO\"; but I thought they would be a bit long.\n\n\t\tcontrols::AeExposureModeEnum exposureModeId = controls::ExposureNormal;\n\nIt's a bit long, but I agree with Isaac, I think auto hinders\nreadability here. \n\n> > Assuming its still a int32_t, looks good to me!\n> > \n> > Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>\n> > \n> >>                  std::vector<std::pair<utils::Duration, double>> stages = { };\n> >>   \n> >>                  std::shared_ptr<ExposureModeHelper> helper =\n> >> diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\n> >> index 8dfe35cc32..865035e578 100644\n> >> --- a/src/ipa/rpi/common/ipa_base.cpp\n> >> +++ b/src/ipa/rpi/common/ipa_base.cpp\n> >> @@ -1584,7 +1584,9 @@ void IpaBase::reportMetadata(unsigned int ipaContext)\n> >>   \n> >>          const AfStatus *afStatus = rpiMetadata.getLocked<AfStatus>(\"af.status\");\n> >>          if (afStatus) {\n> >> -               int32_t s, p;\n> >> +               controls::AfStateEnum s;\n> >> +               controls::AfPauseStateEnum p;\n> >> +\n> >>                  switch (afStatus->state) {\n> >>                  case AfState::Scanning:\n> >>                          s = controls::AfStateScanning;\n> >> diff --git a/src/libcamera/sensor/camera_sensor_legacy.cpp b/src/libcamera/sensor/camera_sensor_legacy.cpp\n> >> index f9e685a9ac..8b6df10ee6 100644\n> >> --- a/src/libcamera/sensor/camera_sensor_legacy.cpp\n> >> +++ b/src/libcamera/sensor/camera_sensor_legacy.cpp\n> >> @@ -571,7 +571,7 @@ int CameraSensorLegacy::initProperties()\n> >>          const auto &orientation = controls.find(V4L2_CID_CAMERA_ORIENTATION);\n> >>          if (orientation != controls.end()) {\n> >>                  int32_t v4l2Orientation = orientation->second.def().get<int32_t>();\n> >> -               int32_t propertyValue;\n> >> +               properties::LocationEnum propertyValue;\n> >>   \n> >>                  switch (v4l2Orientation) {\n> >>                  default:\n> >> @@ -624,7 +624,8 @@ int CameraSensorLegacy::initProperties()\n> >>   \n> >>          /* Color filter array pattern, register only for RAW sensors. */\n> >>          if (bayerFormat_) {\n> >> -               int32_t cfa;\n> >> +               auto cfa = properties::draft::MONO;\n\n\t\tcontrols::draft::ColorFilterArrangementEnum cfa = properties::draft::MONO;\n\nEven a bit longer, but if we drop draft as requested by Kieran... :-)\n\nThis being said, once we rename the enumerators (or switch to enum\nclass) as discussed separately, this would become (without draft)\n\n\t\tcontrols::ColorFilterArrangementEnum cfa = properties::ColorFilterArrangementEnum::MONO;\n\nor\n\n\t\tcontrols::ColorFilterArrangementEnum cfa =\n\t\t\tproperties::ColorFilterArrangementEnum::MONO;\n\ncompared to\n\n\t\tauto cfa = properties::ColorFilterArrangementEnum::MONO;\n\nI think I would have less problems with using auto in his case as the\ntype is conveyed by the right hand side operand (even if I still prefer\nexplicit types).\n\n> >> +\n> >>                  switch (bayerFormat_->order) {\n> >>                  case BayerFormat::BGGR:\n> >>                          cfa = properties::draft::BGGR;\n> >> diff --git a/src/libcamera/sensor/camera_sensor_raw.cpp b/src/libcamera/sensor/camera_sensor_raw.cpp\n> >> index 8ea4423698..cabaa21635 100644\n> >> --- a/src/libcamera/sensor/camera_sensor_raw.cpp\n> >> +++ b/src/libcamera/sensor/camera_sensor_raw.cpp\n> >> @@ -576,7 +576,7 @@ int CameraSensorRaw::initProperties()\n> >>          const auto &orientation = controls.find(V4L2_CID_CAMERA_ORIENTATION);\n> >>          if (orientation != controls.end()) {\n> >>                  int32_t v4l2Orientation = orientation->second.def().get<int32_t>();\n> >> -               int32_t propertyValue;\n> >> +               properties::LocationEnum propertyValue;\n> >>   \n> >>                  switch (v4l2Orientation) {\n> >>                  default:\n> >> @@ -628,7 +628,7 @@ int CameraSensorRaw::initProperties()\n> >>          properties_.set(properties::PixelArrayActiveAreas, { activeArea_ });\n> >>   \n> >>          /* Color filter array pattern. */\n> >> -       uint32_t cfa;\n> >> +       auto cfa = properties::draft::MONO;\n> >>   \n> >>          switch (cfaPattern_) {\n> >>          case BayerFormat::BGGR:\n> >> @@ -644,7 +644,6 @@ int CameraSensorRaw::initProperties()\n> >>                  cfa = properties::draft::RGGB;\n> >>                  break;\n> >>          case BayerFormat::MONO:\n> >> -       default:\n> >>                  cfa = properties::draft::MONO;\n> >>                  break;\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 D2815C3263\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 11 Nov 2025 17:38:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3164D606D5;\n\tTue, 11 Nov 2025 18:38:18 +0100 (CET)","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 4F533606A0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 11 Nov 2025 18:38:16 +0100 (CET)","from pendragon.ideasonboard.com (82-203-161-95.bb.dnainternet.fi\n\t[82.203.161.95])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 3F39B1D29; \n\tTue, 11 Nov 2025 18:36:17 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"pEqV17/w\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1762882577;\n\tbh=+YdHH7fBbaZlt8TMCY9bz0TgbWQuymU8gWruryJuO+Y=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=pEqV17/wZHYXxd0GFEX5MbhjISrpaSBEjZ5cWn35k/TP3J2NR6fQlRGViBaN9tmII\n\tvLoXL7DH3CkR5SubJwoeFuHpkO8yhlEyIcWnJ15JI5Zo8QRTFV3TWhC+ub2KTzAHDz\n\tVjnxTQtdwJuPqXUwOZGlMs2IQaSEBjGdCPBxztIE=","Date":"Tue, 11 Nov 2025 19:38:10 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Cc":"Isaac Scott <isaac.scott@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v1] treewide: Use proper enum types for\n\tcontrols/properties","Message-ID":"<20251111173810.GC12331@pendragon.ideasonboard.com>","References":"<20251103144917.439212-1-barnabas.pocze@ideasonboard.com>\n\t<176226877007.106261.12813691021182507312@isaac-ThinkPad-T16-Gen-2>\n\t<d958f3b2-47f8-4ac4-af52-b1873da542bc@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<d958f3b2-47f8-4ac4-af52-b1873da542bc@ideasonboard.com>","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>"}}]