Show a patch.

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

{
    "id": 16884,
    "url": "https://patchwork.libcamera.org/api/patches/16884/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16884/",
    "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": "<20220801000543.3501-8-laurent.pinchart@ideasonboard.com>",
    "date": "2022-08-01T00:05:37",
    "name": "[libcamera-devel,07/13] libcamera: v4l2_subdevice: Collect subdev capabilities",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "7bdb0764ed443358d4e4099ec067ee591f9f73d0",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/16884/mbox/",
    "series": [
        {
            "id": 3352,
            "url": "https://patchwork.libcamera.org/api/series/3352/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3352",
            "date": "2022-08-01T00:05:30",
            "name": "libcamera: pipeline: simple: Support the NXP i.MX8 ISI",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3352/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/16884/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16884/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 D876CBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  1 Aug 2022 00:06:00 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9488563324;\n\tMon,  1 Aug 2022 02:06:00 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2D1D563322\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  1 Aug 2022 02:05:59 +0200 (CEST)",
            "from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A8F3730B;\n\tMon,  1 Aug 2022 02:05:58 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1659312360;\n\tbh=kZQqKOqEk25DG04dnPMzNXJsFpWWwX0BeBdyUElzE4s=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=iWjbYLQgoK5EF5nbYQw6n76F5ZcVenQqpagN8XtGjqHfl0aQUIg65HA5WNAufORWo\n\tZoiZao+yHF4doShKmKnHiLKyUdCf6qZ1+Jg5Sbbcd1EpfLmFUilSF04fi5ZxZy5/Pt\n\tuSLk8eZj8YEz8mfh6wgvVyXGmJ85TUqwky52TRcqZuBj1cKH6uzjVl5+orWEfzoSvx\n\t/xw4lWiH4l3spYw7lqFkRVMyPlqWlsEZbJWHTdy7h2bzjcRjTZ+xmG66Zh7fmpnjuz\n\tqalhP+Yjaj+7EZC2DY0VqNP+odBMbUbdGwSFqdV8TgMjl65PneY4IR6c1CsA2aTQ0A\n\tF5EqvqPg2jyqw==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1659312358;\n\tbh=kZQqKOqEk25DG04dnPMzNXJsFpWWwX0BeBdyUElzE4s=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=ZZjDcquczei57pn2jrO3mGKLK9A8r0su+d6odTrbBhodyNFrimS6GLpsvqaHxtmQ6\n\t8sszYz1ZO0Zo/CgGjrNz3/w78QeqEwoU+YIA9vHCfYjsMLv44Y4/q/wA3Dgl2exQox\n\tY+uspw+rGDExK0uT0tdE44fpwBOBErqM4M4PYYlE="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"ZZjDcquc\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon,  1 Aug 2022 03:05:37 +0300",
        "Message-Id": "<20220801000543.3501-8-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.35.1",
        "In-Reply-To": "<20220801000543.3501-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20220801000543.3501-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 07/13] libcamera: v4l2_subdevice: Collect\n\tsubdev capabilities",
        "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>",
        "From": "Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "From: Jacopo Mondi <jacopo@jmondi.org>\n\nCollect subdev capabilities at open() time.\n\nModel the V4L2SubdevCapabilties as V4L2Capability from the video\ndevice class.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\nChanges on top of Jacopo's initial work:\n\n- Rename V4L2SubdevCapabilities to V4L2SubdeviceCapability and make it\n  final, to match the V4L2VideoDevice class\n- Add V4L2Subdevice::caps()\n---\n include/libcamera/internal/v4l2_subdevice.h | 13 ++++++\n src/libcamera/v4l2_subdevice.cpp            | 50 ++++++++++++++++++++-\n 2 files changed, 62 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h\nindex 2db392d5e37a..a1d3144c6a7f 100644\n--- a/include/libcamera/internal/v4l2_subdevice.h\n+++ b/include/libcamera/internal/v4l2_subdevice.h\n@@ -29,6 +29,17 @@ namespace libcamera {\n \n class MediaDevice;\n \n+struct V4L2SubdeviceCapability final : v4l2_subdev_capability {\n+\tbool isReadOnly() const\n+\t{\n+\t\treturn capabilities & V4L2_SUBDEV_CAP_RO_SUBDEV;\n+\t}\n+\tbool hasStreams() const\n+\t{\n+\t\treturn capabilities & V4L2_SUBDEV_CAP_MPLEXED;\n+\t}\n+};\n+\n struct V4L2SubdeviceFormat {\n \tuint32_t mbus_code;\n \tSize size;\n@@ -70,6 +81,7 @@ public:\n \t\t      Whence whence = ActiveFormat);\n \n \tconst std::string &model();\n+\tconst V4L2SubdeviceCapability &caps() const { return caps_; }\n \n \tstatic std::unique_ptr<V4L2Subdevice>\n \tfromEntityName(const MediaDevice *media, const std::string &entity);\n@@ -87,6 +99,7 @@ private:\n \tconst MediaEntity *entity_;\n \n \tstd::string model_;\n+\tstruct V4L2SubdeviceCapability caps_;\n };\n \n } /* namespace libcamera */\ndiff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\nindex 37960b76a044..a1672b2365f2 100644\n--- a/src/libcamera/v4l2_subdevice.cpp\n+++ b/src/libcamera/v4l2_subdevice.cpp\n@@ -133,6 +133,30 @@ const std::map<uint32_t, V4L2SubdeviceFormatInfo> formatInfoMap = {\n \n } /* namespace */\n \n+/**\n+ * \\struct V4L2SubdeviceCapability\n+ * \\brief struct v4l2_subdev_capability object wrapper and helpers\n+ *\n+ * The V4L2SubdeviceCapability structure manages the information returned by the\n+ * VIDIOC_SUBDEV_QUERYCAP ioctl.\n+ */\n+\n+/**\n+ * \\fn V4L2SubdeviceCapability::isReadOnly()\n+ * \\brief Retrieve if a subdevice is registered as read-only\n+ *\n+ * A V4L2 subdevice is registered as read-only if V4L2_SUBDEV_CAP_RO_SUBDEV\n+ * is listed as part of its capabilities.\n+ *\n+ * \\return True if the subdevice is registered as read-only, false otherwise\n+ */\n+\n+/**\n+ * \\fn V4L2SubdeviceCapability::hasStreams()\n+ * \\brief Retrieve if a subdevice supports the V4L2 streams API\n+ * \\return True if the subdevice supports the streams API, false otherwise\n+ */\n+\n /**\n  * \\struct V4L2SubdeviceFormat\n  * \\brief The V4L2 sub-device image format and sizes\n@@ -284,7 +308,25 @@ V4L2Subdevice::~V4L2Subdevice()\n  */\n int V4L2Subdevice::open()\n {\n-\treturn V4L2Device::open(O_RDWR);\n+\tint ret = V4L2Device::open(O_RDWR);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\t/*\n+\t * Try to query the subdev capabilities. The VIDIOC_SUBDEV_QUERYCAP API\n+\t * was introduced in kernel v5.8, ENOTTY errors must be ignored to\n+\t * support older kernels.\n+\t */\n+\tcaps_ = {};\n+\tret = ioctl(VIDIOC_SUBDEV_QUERYCAP, &caps_);\n+\tif (ret < 0 && errno != ENOTTY) {\n+\t\tret = -errno;\n+\t\tLOG(V4L2, Error)\n+\t\t\t<< \"Unable to query capabilities: \" << strerror(-ret);\n+\t\treturn ret;\n+\t}\n+\n+\treturn 0;\n }\n \n /**\n@@ -527,6 +569,12 @@ const std::string &V4L2Subdevice::model()\n \treturn model_;\n }\n \n+/**\n+ * \\fn V4L2Subdevice::caps()\n+ * \\brief Retrieve the subdevice V4L2 capabilities\n+ * \\return The subdevice V4L2 capabilities\n+ */\n+\n /**\n  * \\brief Create a new video subdevice instance from \\a entity in media device\n  * \\a media\n",
    "prefixes": [
        "libcamera-devel",
        "07/13"
    ]
}