Patch Detail
Show a patch.
GET /api/patches/3120/?format=api
{ "id": 3120, "url": "https://patchwork.libcamera.org/api/patches/3120/?format=api", "web_url": "https://patchwork.libcamera.org/patch/3120/", "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": "<20200316214310.27665-4-laurent.pinchart@ideasonboard.com>", "date": "2020-03-16T21:43:03", "name": "[libcamera-devel,v2,03/10] libcamera: v4l2_subdevice: Extend [gs]etFormat() to specify format type", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "191c05b034931f8f69d385209ec72de50c4df322", "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/3120/mbox/", "series": [ { "id": 724, "url": "https://patchwork.libcamera.org/api/series/724/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=724", "date": "2020-03-16T21:43:00", "name": "Simple pipeline handler", "version": 2, "mbox": "https://patchwork.libcamera.org/series/724/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/3120/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/3120/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9C8D262928\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Mar 2020 22:43:22 +0100 (CET)", "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 97E6A112C;\n\tMon, 16 Mar 2020 22:43:21 +0100 (CET)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1584395002;\n\tbh=HY5E+dmJgzVhi3bW0GlrGoGcl2rHZOGUTpyfj6s9R6M=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Hv5TcRUoxAz5rIWrq8kx4a6QEqHegYJ9PH9bB1ObTn6ywZPjxOS+P7vtq7CqDOWoB\n\tDHxowuQq3ONuLXeWxgVL2Nrfs3CfUdplAIPyztF70g+m3VY6X7zHZ1bZtR8XZn/skt\n\tjjBZRET3ZgTKu+NdMEWTk5A2c9lTCs39jwD9c0jY=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Martijn Braam <martijn@brixit.nl>, Mickael GUENE <mickael.guene@st.com>, \n\tBenjamin GAIGNARD <benjamin.gaignard@st.com>,\n\tAndrey Konovalov <andrey.konovalov@linaro.org>", "Date": "Mon, 16 Mar 2020 23:43:03 +0200", "Message-Id": "<20200316214310.27665-4-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.24.1", "In-Reply-To": "<20200316214310.27665-1-laurent.pinchart@ideasonboard.com>", "References": "<20200316214310.27665-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 03/10] libcamera: v4l2_subdevice:\n\tExtend [gs]etFormat() to specify format type", "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>", "X-List-Received-Date": "Mon, 16 Mar 2020 21:43:22 -0000" }, "content": "The V4L2 subdevice API exposes ACTIVE and TRY formats, but the\nV4L2Subdevice getFormat() and setFormat() operations only apply on\nACTIVE formats. Extend them to support TRY formats as well.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/libcamera/include/v4l2_subdevice.h | 11 +++++++++--\n src/libcamera/v4l2_subdevice.cpp | 23 +++++++++++++++++++----\n 2 files changed, 28 insertions(+), 6 deletions(-)", "diff": "diff --git a/src/libcamera/include/v4l2_subdevice.h b/src/libcamera/include/v4l2_subdevice.h\nindex 9c077674f997..4a04eadfb1f9 100644\n--- a/src/libcamera/include/v4l2_subdevice.h\n+++ b/src/libcamera/include/v4l2_subdevice.h\n@@ -32,6 +32,11 @@ struct V4L2SubdeviceFormat {\n class V4L2Subdevice : public V4L2Device\n {\n public:\n+\tenum Whence {\n+\t\tActiveFormat,\n+\t\tTryFormat,\n+\t};\n+\n \texplicit V4L2Subdevice(const MediaEntity *entity);\n \tV4L2Subdevice(const V4L2Subdevice &) = delete;\n \tV4L2Subdevice &operator=(const V4L2Subdevice &) = delete;\n@@ -46,8 +51,10 @@ public:\n \n \tImageFormats formats(unsigned int pad);\n \n-\tint getFormat(unsigned int pad, V4L2SubdeviceFormat *format);\n-\tint setFormat(unsigned int pad, V4L2SubdeviceFormat *format);\n+\tint getFormat(unsigned int pad, V4L2SubdeviceFormat *format,\n+\t\t Whence whence = ActiveFormat);\n+\tint setFormat(unsigned int pad, V4L2SubdeviceFormat *format,\n+\t\t Whence whence = ActiveFormat);\n \n \tstatic V4L2Subdevice *fromEntityName(const MediaDevice *media,\n \t\t\t\t\t const std::string &entity);\ndiff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\nindex 8b9da81e8ab3..fb9bdbce2610 100644\n--- a/src/libcamera/v4l2_subdevice.cpp\n+++ b/src/libcamera/v4l2_subdevice.cpp\n@@ -95,6 +95,15 @@ const std::string V4L2SubdeviceFormat::toString() const\n * any device left open will be closed, and any resources released.\n */\n \n+/**\n+ * \\enum V4L2Subdevice::Whence\n+ * \\brief Specify the type of format for getFormat() and setFormat() operations\n+ * \\var V4L2Subdevice::ActiveFormat\n+ * \\brief The format operation applies to ACTIVE formats\n+ * \\var V4L2Subdevice::TryFormat\n+ * \\brief The format operation applies to TRY formats\n+ */\n+\n /**\n * \\brief Create a V4L2 subdevice from a MediaEntity using its device node\n * path\n@@ -184,12 +193,15 @@ ImageFormats V4L2Subdevice::formats(unsigned int pad)\n * \\brief Retrieve the image format set on one of the V4L2 subdevice pads\n * \\param[in] pad The 0-indexed pad number the format is to be retrieved from\n * \\param[out] format The image bus format\n+ * \\param[in] whence The format to retrieve, ACTIVE or TRY\n * \\return 0 on success or a negative error code otherwise\n */\n-int V4L2Subdevice::getFormat(unsigned int pad, V4L2SubdeviceFormat *format)\n+int V4L2Subdevice::getFormat(unsigned int pad, V4L2SubdeviceFormat *format,\n+\t\t\t Whence whence)\n {\n \tstruct v4l2_subdev_format subdevFmt = {};\n-\tsubdevFmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;\n+\tsubdevFmt.which = whence == ActiveFormat ? V4L2_SUBDEV_FORMAT_ACTIVE\n+\t\t\t: V4L2_SUBDEV_FORMAT_TRY;\n \tsubdevFmt.pad = pad;\n \n \tint ret = ioctl(VIDIOC_SUBDEV_G_FMT, &subdevFmt);\n@@ -211,6 +223,7 @@ int V4L2Subdevice::getFormat(unsigned int pad, V4L2SubdeviceFormat *format)\n * \\brief Set an image format on one of the V4L2 subdevice pads\n * \\param[in] pad The 0-indexed pad number the format is to be applied to\n * \\param[inout] format The image bus format to apply to the subdevice's pad\n+ * \\param[in] whence The format to set, ACTIVE or TRY\n *\n * Apply the requested image format to the desired media pad and return the\n * actually applied format parameters, as \\ref V4L2Subdevice::getFormat would\n@@ -218,10 +231,12 @@ int V4L2Subdevice::getFormat(unsigned int pad, V4L2SubdeviceFormat *format)\n *\n * \\return 0 on success or a negative error code otherwise\n */\n-int V4L2Subdevice::setFormat(unsigned int pad, V4L2SubdeviceFormat *format)\n+int V4L2Subdevice::setFormat(unsigned int pad, V4L2SubdeviceFormat *format,\n+\t\t\t Whence whence)\n {\n \tstruct v4l2_subdev_format subdevFmt = {};\n-\tsubdevFmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;\n+\tsubdevFmt.which = whence == ActiveFormat ? V4L2_SUBDEV_FORMAT_ACTIVE\n+\t\t\t: V4L2_SUBDEV_FORMAT_TRY;\n \tsubdevFmt.pad = pad;\n \tsubdevFmt.format.width = format->size.width;\n \tsubdevFmt.format.height = format->size.height;\n", "prefixes": [ "libcamera-devel", "v2", "03/10" ] }