Patch Detail
Show a patch.
GET /api/patches/3382/?format=api
{ "id": 3382, "url": "https://patchwork.libcamera.org/api/patches/3382/?format=api", "web_url": "https://patchwork.libcamera.org/patch/3382/", "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": "<20200404004438.17992-6-laurent.pinchart@ideasonboard.com>", "date": "2020-04-04T00:44:32", "name": "[libcamera-devel,v4,05/11] libcamera: v4l2_videodevice: Support filtering formats by media bus code", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "d9c9dcc9f5d324cb2e40773c682c796fc3b7ae8a", "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/3382/mbox/", "series": [ { "id": 796, "url": "https://patchwork.libcamera.org/api/series/796/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=796", "date": "2020-04-04T00:44:27", "name": "Simple pipeline handler", "version": 4, "mbox": "https://patchwork.libcamera.org/series/796/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/3382/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/3382/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3C19462DAF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 4 Apr 2020 02:44:54 +0200 (CEST)", "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 A89FF130D;\n\tSat, 4 Apr 2020 02:44:53 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"AK1ZazhQ\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1585961094;\n\tbh=9w5UTR+aZxJ4jswklEa3wwomaex0lboSeIl20AObEAc=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=AK1ZazhQDSb/xy4plfEjue8ipgL5gsPA6BNcKLE8MNKMyyPkPLjji7BQOHLjpOfNu\n\tISBs6mC7UvczKXCRNZDaXUyTgTzTtRDjzFpSG/GEAIJB7+uTatR5IsitBz+jMiplAm\n\tPV+qrzbOVjl3ZDvl3c94kSccPbWfU6gd0qAd6RVU=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Martijn Braam <martijn@brixit.nl>,\n\tBenjamin GAIGNARD <benjamin.gaignard@st.com>,\n\tAndrey Konovalov <andrey.konovalov@linaro.org>", "Date": "Sat, 4 Apr 2020 03:44:32 +0300", "Message-Id": "<20200404004438.17992-6-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.24.1", "In-Reply-To": "<20200404004438.17992-1-laurent.pinchart@ideasonboard.com>", "References": "<20200404004438.17992-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v4 05/11] libcamera: v4l2_videodevice:\n\tSupport filtering formats by media bus code", "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": "Sat, 04 Apr 2020 00:44:55 -0000" }, "content": "Add support for the recent V4L2 extension to VIDIOC_ENUM_FMT that allows\nfiltering pixel formats by media bus codes.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/include/v4l2_videodevice.h | 4 ++--\n src/libcamera/v4l2_videodevice.cpp | 16 +++++++++++++---\n 2 files changed, 15 insertions(+), 5 deletions(-)", "diff": "diff --git a/src/libcamera/include/v4l2_videodevice.h b/src/libcamera/include/v4l2_videodevice.h\nindex 7d7c4a9e6ebd..7b011d3b4e87 100644\n--- a/src/libcamera/include/v4l2_videodevice.h\n+++ b/src/libcamera/include/v4l2_videodevice.h\n@@ -207,7 +207,7 @@ public:\n \n \tint getFormat(V4L2DeviceFormat *format);\n \tint setFormat(V4L2DeviceFormat *format);\n-\tstd::map<V4L2PixelFormat, std::vector<SizeRange>> formats();\n+\tstd::map<V4L2PixelFormat, std::vector<SizeRange>> formats(uint32_t code = 0);\n \n \tint setCrop(Rectangle *rect);\n \tint setCompose(Rectangle *rect);\n@@ -246,7 +246,7 @@ private:\n \tint getFormatSingleplane(V4L2DeviceFormat *format);\n \tint setFormatSingleplane(V4L2DeviceFormat *format);\n \n-\tstd::vector<V4L2PixelFormat> enumPixelformats();\n+\tstd::vector<V4L2PixelFormat> enumPixelformats(uint32_t code);\n \tstd::vector<SizeRange> enumSizes(V4L2PixelFormat pixelFormat);\n \n \tint setSelection(unsigned int target, Rectangle *rect);\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex eb33a68e50d6..f7b98272d247 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -973,16 +973,19 @@ int V4L2VideoDevice::setFormatSingleplane(V4L2DeviceFormat *format)\n \n /**\n * \\brief Enumerate all pixel formats and frame sizes\n+ * \\param[in] code Restrict formats to this media bus code.\n *\n * Enumerate all pixel formats and frame sizes supported by the video device.\n+ * If the \\a code argument is not zero, only formats compatible with that media\n+ * bus code will be enumerated.\n *\n * \\return A list of the supported video device formats\n */\n-std::map<V4L2PixelFormat, std::vector<SizeRange>> V4L2VideoDevice::formats()\n+std::map<V4L2PixelFormat, std::vector<SizeRange>> V4L2VideoDevice::formats(uint32_t code)\n {\n \tstd::map<V4L2PixelFormat, std::vector<SizeRange>> formats;\n \n-\tfor (V4L2PixelFormat pixelFormat : enumPixelformats()) {\n+\tfor (V4L2PixelFormat pixelFormat : enumPixelformats(code)) {\n \t\tstd::vector<SizeRange> sizes = enumSizes(pixelFormat);\n \t\tif (sizes.empty())\n \t\t\treturn {};\n@@ -1000,15 +1003,22 @@ std::map<V4L2PixelFormat, std::vector<SizeRange>> V4L2VideoDevice::formats()\n \treturn formats;\n }\n \n-std::vector<V4L2PixelFormat> V4L2VideoDevice::enumPixelformats()\n+std::vector<V4L2PixelFormat> V4L2VideoDevice::enumPixelformats(uint32_t code)\n {\n \tstd::vector<V4L2PixelFormat> formats;\n \tint ret;\n \n+\tif (code && !(caps_.device_caps() & V4L2_CAP_IO_MC)) {\n+\t\tLOG(V4L2, Error)\n+\t\t\t<< \"Media bus code filtering not supported by the device\";\n+\t\treturn {};\n+\t}\n+\n \tfor (unsigned int index = 0; ; index++) {\n \t\tstruct v4l2_fmtdesc pixelformatEnum = {};\n \t\tpixelformatEnum.index = index;\n \t\tpixelformatEnum.type = bufferType_;\n+\t\tpixelformatEnum.mbus_code = code;\n \n \t\tret = ioctl(VIDIOC_ENUM_FMT, &pixelformatEnum);\n \t\tif (ret)\n", "prefixes": [ "libcamera-devel", "v4", "05/11" ] }