Patch Detail
Show a patch.
GET /api/patches/25008/?format=api
{ "id": 25008, "url": "https://patchwork.libcamera.org/api/patches/25008/?format=api", "web_url": "https://patchwork.libcamera.org/patch/25008/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/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": "<20251112090941.2626202-1-barnabas.pocze@ideasonboard.com>", "date": "2025-11-12T09:09:41", "name": "[v2] treewide: Use proper enum types for controls/properties", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "50ec7a1b2bcad96b2e58b184ffc9c505a537ee0b", "submitter": { "id": 216, "url": "https://patchwork.libcamera.org/api/people/216/?format=api", "name": "Barnabás Pőcze", "email": "barnabas.pocze@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/25008/mbox/", "series": [ { "id": 5584, "url": "https://patchwork.libcamera.org/api/series/5584/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5584", "date": "2025-11-12T09:09:41", "name": "[v2] treewide: Use proper enum types for controls/properties", "version": 2, "mbox": "https://patchwork.libcamera.org/series/5584/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/25008/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/25008/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 CBB98C3263\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 12 Nov 2025 09:09:48 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8069660A86;\n\tWed, 12 Nov 2025 10:09:48 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 18B19609DE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 12 Nov 2025 10:09:47 +0100 (CET)", "from pb-laptop.local (185.221.140.239.nat.pool.zt.hu\n\t[185.221.140.239])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id ED77815E9;\n\tWed, 12 Nov 2025 10:07:46 +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=\"TRT+MX/c\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1762938467;\n\tbh=Zzk+mU9XuIUiWuyNVPTNQfB0NRu4gtzoUjlYK2ePfg0=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=TRT+MX/cYktTUTd4AcpckydFsBCY86S2yfnlyQZChYjU9CZsydIkCrs2N+V3g5GzI\n\tD0hqn7fP3WDAOcJtbHpjAXL2NS/fe5rKECpgWp3IlCazWbohMiWJCvjv5bYCUI2pxW\n\tDCxtZFGrOUfnIquT2okixac2bcbdjZF4MaK36Tgs=", "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Kieran Bingham <kieran.bingham@ideasonboard.com>", "Subject": "[PATCH v2] treewide: Use proper enum types for controls/properties", "Date": "Wed, 12 Nov 2025 10:09:41 +0100", "Message-ID": "<20251112090941.2626202-1-barnabas.pocze@ideasonboard.com>", "X-Mailer": "git-send-email 2.51.2", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "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>" }, "content": "The enumerated controls/properties use `int32_t` as their backing type.\nIn multiple cases, when parsing such an enum value from a source, an\ninteger type is used. Replace the integer type with the proper enum\ntype where it is trivially doable.\n\nThis change also brings `CameraSensorLegacy::initProperties()` in line\nwith `CameraSensorRaw::initProperties()`, by defaulting the color\nfilter arrangement to `MONO`.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\nchanges in v2:\n * don't use `auto`\n\nv1: https://patchwork.libcamera.org/patch/24954/\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--\n2.51.2", "diff": "diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp\nindex 64f36bd75d..4df1201892 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 \t * possible before touching gain.\n \t */\n \tif (availableExposureModes.empty()) {\n-\t\tint32_t exposureModeId = controls::ExposureNormal;\n+\t\tcontrols::AeExposureModeEnum exposureModeId = controls::ExposureNormal;\n \t\tstd::vector<std::pair<utils::Duration, double>> stages = { };\n\n \t\tstd::shared_ptr<ExposureModeHelper> helper =\ndiff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\nindex 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 \tconst AfStatus *afStatus = rpiMetadata.getLocked<AfStatus>(\"af.status\");\n \tif (afStatus) {\n-\t\tint32_t s, p;\n+\t\tcontrols::AfStateEnum s;\n+\t\tcontrols::AfPauseStateEnum p;\n+\n \t\tswitch (afStatus->state) {\n \t\tcase AfState::Scanning:\n \t\t\ts = controls::AfStateScanning;\ndiff --git a/src/libcamera/sensor/camera_sensor_legacy.cpp b/src/libcamera/sensor/camera_sensor_legacy.cpp\nindex f9e685a9ac..8f45ec9e15 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 \tconst auto &orientation = controls.find(V4L2_CID_CAMERA_ORIENTATION);\n \tif (orientation != controls.end()) {\n \t\tint32_t v4l2Orientation = orientation->second.def().get<int32_t>();\n-\t\tint32_t propertyValue;\n+\t\tproperties::LocationEnum propertyValue;\n\n \t\tswitch (v4l2Orientation) {\n \t\tdefault:\n@@ -624,7 +624,8 @@ int CameraSensorLegacy::initProperties()\n\n \t/* Color filter array pattern, register only for RAW sensors. */\n \tif (bayerFormat_) {\n-\t\tint32_t cfa;\n+\t\tproperties::draft::ColorFilterArrangementEnum cfa = properties::draft::MONO;\n+\n \t\tswitch (bayerFormat_->order) {\n \t\tcase BayerFormat::BGGR:\n \t\t\tcfa = properties::draft::BGGR;\ndiff --git a/src/libcamera/sensor/camera_sensor_raw.cpp b/src/libcamera/sensor/camera_sensor_raw.cpp\nindex 8ea4423698..1aabc0485b 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 \tconst auto &orientation = controls.find(V4L2_CID_CAMERA_ORIENTATION);\n \tif (orientation != controls.end()) {\n \t\tint32_t v4l2Orientation = orientation->second.def().get<int32_t>();\n-\t\tint32_t propertyValue;\n+\t\tproperties::LocationEnum propertyValue;\n\n \t\tswitch (v4l2Orientation) {\n \t\tdefault:\n@@ -628,7 +628,7 @@ int CameraSensorRaw::initProperties()\n \tproperties_.set(properties::PixelArrayActiveAreas, { activeArea_ });\n\n \t/* Color filter array pattern. */\n-\tuint32_t cfa;\n+\tproperties::draft::ColorFilterArrangementEnum cfa = properties::draft::MONO;\n\n \tswitch (cfaPattern_) {\n \tcase BayerFormat::BGGR:\n@@ -644,7 +644,6 @@ int CameraSensorRaw::initProperties()\n \t\tcfa = properties::draft::RGGB;\n \t\tbreak;\n \tcase BayerFormat::MONO:\n-\tdefault:\n \t\tcfa = properties::draft::MONO;\n \t\tbreak;\n \t}\n", "prefixes": [ "v2" ] }