Patch Detail
Show a patch.
GET /api/1.1/patches/1816/?format=api
{ "id": 1816, "url": "https://patchwork.libcamera.org/api/1.1/patches/1816/?format=api", "web_url": "https://patchwork.libcamera.org/patch/1816/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20190817105937.29353-5-jacopo@jmondi.org>", "date": "2019-08-17T10:59:36", "name": "[libcamera-devel,4/5] libcamera: v4l2_subdevice: Add G_SELECTION ioctl support", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "ac58763e9c21dcd8f9877ebb4d1d54c9465731f1", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/1816/mbox/", "series": [ { "id": 462, "url": "https://patchwork.libcamera.org/api/1.1/series/462/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=462", "date": "2019-08-17T10:59:32", "name": "libcamera: camera_sensor: Collect camera location and sizes", "version": 1, "mbox": "https://patchwork.libcamera.org/series/462/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/1816/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/1816/checks/", "tags": {}, "headers": { "Return-Path": "<jacopo@jmondi.org>", "Received": [ "from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net\n\t[217.70.183.197])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A788061917\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 17 Aug 2019 12:58:18 +0200 (CEST)", "from uno.homenet.telecomitalia.it\n\t(host64-130-dynamic.5-87-r.retail.telecomitalia.it [87.5.130.64])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 1E4CE1C0002;\n\tSat, 17 Aug 2019 10:58:17 +0000 (UTC)" ], "X-Originating-IP": "87.5.130.64", "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sat, 17 Aug 2019 12:59:36 +0200", "Message-Id": "<20190817105937.29353-5-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.22.0", "In-Reply-To": "<20190817105937.29353-1-jacopo@jmondi.org>", "References": "<20190817105937.29353-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 4/5] libcamera: v4l2_subdevice: Add\n\tG_SELECTION ioctl support", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.23", "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": "Sat, 17 Aug 2019 10:58:18 -0000" }, "content": "Add a private operation to perform G_SELECTION ioctl on the v4l2\nsubdevice and create two public methods to retrieve the crop bound\nrectangle and the subdevice native area size.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/include/v4l2_subdevice.h | 4 +++\n src/libcamera/v4l2_subdevice.cpp | 48 ++++++++++++++++++++++++++\n 2 files changed, 52 insertions(+)", "diff": "diff --git a/src/libcamera/include/v4l2_subdevice.h b/src/libcamera/include/v4l2_subdevice.h\nindex 9c077674f997..5316617c6873 100644\n--- a/src/libcamera/include/v4l2_subdevice.h\n+++ b/src/libcamera/include/v4l2_subdevice.h\n@@ -43,6 +43,8 @@ public:\n \n \tint setCrop(unsigned int pad, Rectangle *rect);\n \tint setCompose(unsigned int pad, Rectangle *rect);\n+\tint getCropBounds(unsigned int pad, Rectangle *rect);\n+\tint getNativeSize(unsigned int pad, Rectangle *rect);\n \n \tImageFormats formats(unsigned int pad);\n \n@@ -62,6 +64,8 @@ private:\n \n \tint setSelection(unsigned int pad, unsigned int target,\n \t\t\t Rectangle *rect);\n+\tint getSelection(unsigned int pad, unsigned int target,\n+\t\t\t Rectangle *rect);\n \n \tconst MediaEntity *entity_;\n };\ndiff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\nindex a188298de34c..5e661e2ef1fc 100644\n--- a/src/libcamera/v4l2_subdevice.cpp\n+++ b/src/libcamera/v4l2_subdevice.cpp\n@@ -148,6 +148,28 @@ int V4L2Subdevice::setCompose(unsigned int pad, Rectangle *rect)\n \treturn setSelection(pad, V4L2_SEL_TGT_COMPOSE, rect);\n }\n \n+/**\n+ * \\brief Get the crop bounds rectangle on one of the V4L2 subdevice pads\n+ * \\param[in] pad The 0-indexed pad number the rectangle is retrived from\n+ * \\param[out] rect The rectangle describing the crop bounds area\n+ * \\return 0 on success or a negative error code otherwise\n+ */\n+int V4L2Subdevice::getCropBounds(unsigned int pad, Rectangle *rect)\n+{\n+\treturn getSelection(pad, V4L2_SEL_TGT_CROP_BOUNDS, rect);\n+}\n+\n+/**\n+ * \\brief Get the native area size on one of the V4L2 subdevice pads\n+ * \\param[in] pad The 0-indexed pad number the native area is retrieved from\n+ * \\param[out] rect The rectangle describing the native size area\n+ * \\return 0 on success or a negative error code otherwise\n+ */\n+int V4L2Subdevice::getNativeSize(unsigned int pad, Rectangle *rect)\n+{\n+\treturn getSelection(pad, V4L2_SEL_TGT_NATIVE_SIZE, rect);\n+}\n+\n /**\n * \\brief Enumerate all media bus codes and frame sizes on a \\a pad\n * \\param[in] pad The 0-indexed pad number to enumerate formats on\n@@ -360,4 +382,30 @@ int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target,\n \treturn 0;\n }\n \n+int V4L2Subdevice::getSelection(unsigned int pad, unsigned int target,\n+\t\t\t\tRectangle *rect)\n+{\n+\tstruct v4l2_subdev_selection sel = {};\n+\n+\tsel.which = V4L2_SUBDEV_FORMAT_ACTIVE;\n+\tsel.pad = pad;\n+\tsel.target = target;\n+\tsel.flags = 0;\n+\n+\tint ret = ioctl(VIDIOC_SUBDEV_G_SELECTION, &sel);\n+\tif (ret < 0) {\n+\t\tLOG(V4L2, Error)\n+\t\t\t<< \"Unable to get rectangle \" << target << \" on pad \"\n+\t\t\t<< pad << \": \" << strerror(-ret);\n+\t\treturn ret;\n+\t}\n+\n+\trect->x = sel.r.left;\n+\trect->y = sel.r.top;\n+\trect->w = sel.r.width;\n+\trect->h = sel.r.height;\n+\n+\treturn 0;\n+}\n+\n } /* namespace libcamera */\n", "prefixes": [ "libcamera-devel", "4/5" ] }