Patch Detail
Show a patch.
GET /api/patches/21734/?format=api
{ "id": 21734, "url": "https://patchwork.libcamera.org/api/patches/21734/?format=api", "web_url": "https://patchwork.libcamera.org/patch/21734/", "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": "<20241022095737.4127210-3-chenghaoyang@chromium.org>", "date": "2024-10-22T09:56:05", "name": "[v2,2/2] libcamera: Add Unsigned 16-bits Control Type", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "cbeebc3984f6a8d5847bd48651ad626799a53d96", "submitter": { "id": 117, "url": "https://patchwork.libcamera.org/api/people/117/?format=api", "name": "Cheng-Hao Yang", "email": "chenghaoyang@chromium.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/21734/mbox/", "series": [ { "id": 4734, "url": "https://patchwork.libcamera.org/api/series/4734/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4734", "date": "2024-10-22T09:56:03", "name": "Add U16 & U32 support in controls", "version": 2, "mbox": "https://patchwork.libcamera.org/series/4734/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/21734/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/21734/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 18FCDC3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 22 Oct 2024 09:57:54 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A2AE865398;\n\tTue, 22 Oct 2024 11:57:53 +0200 (CEST)", "from mail-oi1-x22d.google.com (mail-oi1-x22d.google.com\n\t[IPv6:2607:f8b0:4864:20::22d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3EF056538B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Oct 2024 11:57:49 +0200 (CEST)", "by mail-oi1-x22d.google.com with SMTP id\n\t5614622812f47-3e5f86e59f1so2461950b6e.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Oct 2024 02:57:49 -0700 (PDT)", "from chenghaoyang-low.c.googlers.com.com\n\t(199.211.81.34.bc.googleusercontent.com. [34.81.211.199])\n\tby smtp.gmail.com with ESMTPSA id\n\t41be03b00d2f7-7eaeabb9e6fsm4614282a12.66.2024.10.22.02.57.45\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 22 Oct 2024 02:57:47 -0700 (PDT)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"WwBcqwWb\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=chromium.org; s=google; t=1729591068; x=1730195868;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=h2/Q5hwH59FK3yFBhQBoLSB5gH0qRMHNdLiESlpoNW0=;\n\tb=WwBcqwWbCvrpHg0Gc6d5l9kmm8/vCwmpcr0hWn1R9jHJrbvrzl0OCd/wXr+zvd53uG\n\tDRYWssx1M3a8u38hVZuYmBVgYyFKeLa/BmVOflz+PISJC7excW24jMQV6myvNau5+nPQ\n\tybYZIVUP7hbcvKpxawAjafu13YT/JcTOazL10=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1729591068; x=1730195868;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=h2/Q5hwH59FK3yFBhQBoLSB5gH0qRMHNdLiESlpoNW0=;\n\tb=WksrlGfMxMLNLL2x6aQA05N3/ozcLMrrJpoyydw7l6LIrWk7DsQlviqp9BytAYJWbi\n\tywnzAJfozPn33zC7uC8yRY9YaQBX4py6hZw0UO9BZb2YuaV3S3BUzAh66j4MKOfNEEgf\n\t1ObVla4Ivs9EFM/Bi7HeM8GblU5SUwhl5ySc1DeBUw44OL51YQlbA+G+HuL6rq5Y3+lY\n\tIjaaZXSA5gFPRhaPI3DJftCkioY28GLNdhKuZYgzVxBHY8SZee0C667Na6+SArxJyfKG\n\tngrE2qZkxoQrit1q0FcQSMGjM0ulxRr4d/sLSWTXo2MZNulsn7bRSDItTIcCBraAnUEM\n\tpMvA==", "X-Gm-Message-State": "AOJu0YwGrfiAzi+rDfYiGR4wXD1ye53+CgCT5vnWMVtlq0PHQ4T2p+od\n\txNOzool9WrzBB3xIsMEOOwIJ+kZx+Bp0fD2inLLE4MMMhQ9Pkit6dWXxXDWELJqgCAJVPvMEcEo\n\t=", "X-Google-Smtp-Source": "AGHT+IFCk/Me+ANxGqXbc3X1P1ND7aYAfWuDEnd/RIJIObenHJQTD1io0U1F+Us2tp/x9GbcHHJEzg==", "X-Received": "by 2002:a05:6808:2112:b0:3e3:e67f:5d3a with SMTP id\n\t5614622812f47-3e61d03a7dbmr1952685b6e.45.1729591067688; \n\tTue, 22 Oct 2024 02:57:47 -0700 (PDT)", "From": "Harvey Yang <chenghaoyang@chromium.org>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Yudhistira Erlandinata <yerlandinata@chromium.org>,\n\tHarvey Yang <chenghaoyang@chromium.org>", "Subject": "[PATCH v2 2/2] libcamera: Add Unsigned 16-bits Control Type", "Date": "Tue, 22 Oct 2024 09:56:05 +0000", "Message-ID": "<20241022095737.4127210-3-chenghaoyang@chromium.org>", "X-Mailer": "git-send-email 2.47.0.105.g07ac214952-goog", "In-Reply-To": "<20241022095737.4127210-1-chenghaoyang@chromium.org>", "References": "<20241022095737.4127210-1-chenghaoyang@chromium.org>", "MIME-Version": "1.0", "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": "From: Yudhistira Erlandinata <yerlandinata@chromium.org>\n\nSome camera metadata is of length 16-bits,\nfor example JPEG metadata headers.\n\nSigned-off-by: Yudhistira Erlandinata <yerlandinata@chromium.org>\nCo-developed-by: Harvey Yang <chenghaoyang@chromium.org>\nSigned-off-by: Harvey Yang <chenghaoyang@chromium.org>\n---\n include/libcamera/controls.h | 7 +++++++\n src/libcamera/controls.cpp | 8 ++++++++\n src/libcamera/v4l2_device.cpp | 9 +++++++++\n 3 files changed, 24 insertions(+)", "diff": "diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\nindex 6da8ad2c3..162115bb5 100644\n--- a/include/libcamera/controls.h\n+++ b/include/libcamera/controls.h\n@@ -29,6 +29,7 @@ enum ControlType {\n \tControlTypeNone,\n \tControlTypeBool,\n \tControlTypeByte,\n+\tControlTypeUnsigned16,\n \tControlTypeUnsigned32,\n \tControlTypeInteger32,\n \tControlTypeInteger64,\n@@ -63,6 +64,12 @@ struct control_type<uint8_t> {\n \tstatic constexpr std::size_t size = 0;\n };\n \n+template<>\n+struct control_type<uint16_t> {\n+\tstatic constexpr ControlType value = ControlTypeUnsigned16;\n+\tstatic constexpr std::size_t size = 0;\n+};\n+\n template<>\n struct control_type<uint32_t> {\n \tstatic constexpr ControlType value = ControlTypeUnsigned32;\ndiff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\nindex 8ae295191..3a840bb22 100644\n--- a/src/libcamera/controls.cpp\n+++ b/src/libcamera/controls.cpp\n@@ -54,6 +54,7 @@ static constexpr size_t ControlValueSize[] = {\n \t[ControlTypeNone]\t\t= 0,\n \t[ControlTypeBool]\t\t= sizeof(bool),\n \t[ControlTypeByte]\t\t= sizeof(uint8_t),\n+\t[ControlTypeUnsigned16]\t\t= sizeof(uint16_t),\n \t[ControlTypeUnsigned32]\t\t= sizeof(uint32_t),\n \t[ControlTypeInteger32]\t\t= sizeof(int32_t),\n \t[ControlTypeInteger64]\t\t= sizeof(int64_t),\n@@ -75,6 +76,8 @@ static constexpr size_t ControlValueSize[] = {\n * The control stores a boolean value\n * \\var ControlTypeByte\n * The control stores a byte value as an unsigned 8-bit integer\n+ * \\var ControlTypeUnsigned16\n+ * The control stores an unsigned 16-bit integer value\n * \\var ControlTypeUnsigned32\n * The control stores an unsigned 32-bit integer value\n * \\var ControlTypeInteger32\n@@ -233,6 +236,11 @@ std::string ControlValue::toString() const\n \t\t\tstr += std::to_string(*value);\n \t\t\tbreak;\n \t\t}\n+\t\tcase ControlTypeUnsigned16: {\n+\t\t\tconst uint16_t *value = reinterpret_cast<const uint16_t *>(data);\n+\t\t\tstr += std::to_string(*value);\n+\t\t\tbreak;\n+\t\t}\n \t\tcase ControlTypeUnsigned32: {\n \t\t\tconst uint32_t *value = reinterpret_cast<const uint32_t *>(data);\n \t\t\tstr += std::to_string(*value);\ndiff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 0ba8dcfa0..f1b5a25a0 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -492,6 +492,9 @@ ControlType V4L2Device::v4l2CtrlType(uint32_t ctrlType)\n \tcase V4L2_CTRL_TYPE_BOOLEAN:\n \t\treturn ControlTypeBool;\n \n+\tcase V4L2_CTRL_TYPE_U16:\n+\t\treturn ControlTypeUnsigned16;\n+\n \tcase V4L2_CTRL_TYPE_U32:\n \t\treturn ControlTypeUnsigned32;\n \n@@ -543,6 +546,11 @@ std::optional<ControlInfo> V4L2Device::v4l2ControlInfo(const v4l2_query_ext_ctrl\n \t\t\t\t static_cast<uint8_t>(ctrl.maximum),\n \t\t\t\t static_cast<uint8_t>(ctrl.default_value));\n \n+\tcase V4L2_CTRL_TYPE_U16:\n+\t\treturn ControlInfo(static_cast<uint16_t>(ctrl.minimum),\n+\t\t\t\t static_cast<uint16_t>(ctrl.maximum),\n+\t\t\t\t static_cast<uint16_t>(ctrl.default_value));\n+\n \tcase V4L2_CTRL_TYPE_U32:\n \t\treturn ControlInfo(static_cast<uint32_t>(ctrl.minimum),\n \t\t\t\t static_cast<uint32_t>(ctrl.maximum),\n@@ -634,6 +642,7 @@ void V4L2Device::listControls()\n \t\tcase V4L2_CTRL_TYPE_BITMASK:\n \t\tcase V4L2_CTRL_TYPE_INTEGER_MENU:\n \t\tcase V4L2_CTRL_TYPE_U8:\n+\t\tcase V4L2_CTRL_TYPE_U16:\n \t\tcase V4L2_CTRL_TYPE_U32:\n \t\t\tbreak;\n \t\t/* \\todo Support other control types. */\n", "prefixes": [ "v2", "2/2" ] }