Show a patch.

GET /api/patches/24954/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 24954,
    "url": "https://patchwork.libcamera.org/api/patches/24954/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/24954/",
    "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": "<20251103144917.439212-1-barnabas.pocze@ideasonboard.com>",
    "date": "2025-11-03T14:49:17",
    "name": "[v1] treewide: Use proper enum types for controls/properties",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "f7908a7b795542f3e134bb034f031697e0e1b417",
    "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/24954/mbox/",
    "series": [
        {
            "id": 5558,
            "url": "https://patchwork.libcamera.org/api/series/5558/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5558",
            "date": "2025-11-03T14:49:17",
            "name": "[v1] treewide: Use proper enum types for controls/properties",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5558/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/24954/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/24954/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 3AE9CBDE4C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  3 Nov 2025 14:49:22 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DF74760A80;\n\tMon,  3 Nov 2025 15:49:21 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2F9C0606A0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  3 Nov 2025 15:49:21 +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 457FD7CE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  3 Nov 2025 15:47:28 +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=\"A+vY/Ut7\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1762181248;\n\tbh=u4nzrQgCtW+z35fq/frBap6W/i9M+xf1v1XaT0GanA4=;\n\th=From:To:Subject:Date:From;\n\tb=A+vY/Ut7uy2Ht0yUHYSg/xHNTLCqHmpOylNasNKMmWOKAA9DBIs8/159X57E6YRVq\n\tafmFaRs9+H6RdDzL/4l7o8Vo5Pb7XqhqNfeI+uddYDJ8XwMpjOhw2V8PIZGqK0OqLz\n\t0yDiQZ0Fq7zJuHO44BjDU9oCL3jPaVLCLKHVLzcE=",
        "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Subject": "[PATCH v1] treewide: Use proper enum types for controls/properties",
        "Date": "Mon,  3 Nov 2025 15:49:17 +0100",
        "Message-ID": "<20251103144917.439212-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>\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(-)",
    "diff": "diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp\nindex 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 \t * possible before touching gain.\n \t */\n \tif (availableExposureModes.empty()) {\n-\t\tint32_t exposureModeId = controls::ExposureNormal;\n+\t\tauto 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..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 \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\tauto 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..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 \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+\tauto 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": [
        "v1"
    ]
}