Patch Detail
Show a patch.
GET /api/1.1/patches/3213/?format=api
{ "id": 3213, "url": "https://patchwork.libcamera.org/api/1.1/patches/3213/?format=api", "web_url": "https://patchwork.libcamera.org/patch/3213/", "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": "<20200320014839.14683-6-laurent.pinchart@ideasonboard.com>", "date": "2020-03-20T01:48:33", "name": "[libcamera-devel,v3,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/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/3213/mbox/", "series": [ { "id": 749, "url": "https://patchwork.libcamera.org/api/1.1/series/749/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=749", "date": "2020-03-20T01:48:28", "name": "Simple pipeline handler", "version": 3, "mbox": "https://patchwork.libcamera.org/series/749/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/3213/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/3213/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 3F16862B7E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 20 Mar 2020 02:48:54 +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 8AC7014EC;\n\tFri, 20 Mar 2020 02:48:53 +0100 (CET)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1584668933;\n\tbh=PCjLBuxhzldYsVxjC0yVZYh/XNqCrJvpF9uOV7KHUFU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=hJtvRKIHrbBC09nuYzRpSuacG78ziIzAHnFYlsYLQ5gpRdgnzJ/x+38tZnf9R0dDF\n\tuqINtiqOSP1MXcs1yYIsEy6uijpruk4tlvIzwHD+4tu0J/bhhv5m/hlb/PVVxVTHWz\n\t13IqV8vedUoZLrF4sd3qoVuiWlBPsnSSZ9JTT2YQ=", "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": "Fri, 20 Mar 2020 03:48:33 +0200", "Message-Id": "<20200320014839.14683-6-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.24.1", "In-Reply-To": "<20200320014839.14683-1-laurent.pinchart@ideasonboard.com>", "References": "<20200320014839.14683-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 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": "Fri, 20 Mar 2020 01:48:54 -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 b20c8c77260f..c11936fa2d5a 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -959,16 +959,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@@ -986,15 +989,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", "v3", "05/11" ] }