Patch Detail
Show a patch.
GET /api/patches/3741/?format=api
{ "id": 3741, "url": "https://patchwork.libcamera.org/api/patches/3741/?format=api", "web_url": "https://patchwork.libcamera.org/patch/3741/", "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": "<20200510115810.21938-3-laurent.pinchart@ideasonboard.com>", "date": "2020-05-10T11:58:06", "name": "[libcamera-devel,v5,2/6] libcamera: v4l2_videodevice: Support filtering formats by media bus code", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "b1cc28ba91a1c634cf2d801e4f0cd3560ac3905b", "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/3741/mbox/", "series": [ { "id": 890, "url": "https://patchwork.libcamera.org/api/series/890/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=890", "date": "2020-05-10T11:58:04", "name": "Simple pipeline handler", "version": 5, "mbox": "https://patchwork.libcamera.org/series/890/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/3741/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/3741/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 1805360BDC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 10 May 2020 13:58:21 +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 AB56CE1E;\n\tSun, 10 May 2020 13:58:20 +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=\"pXo7CTsN\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1589111900;\n\tbh=sVnTQMDv4xkPyP0pRkuopt2ayTAwvBYZyttY3EM1SqY=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=pXo7CTsNeBDz0rygbVx5QEg35sfDfU7pv3rBpKAX/UdyrBa7NsW5clb2mznYYgqc/\n\tY+1hESXPw1VQfL29H67X02rLcEqN3CsiJ1IWu7vbIofe5XLvko/STg5BhXOVbWUcRF\n\tPVjtu9PYK/l9ELfk3uBYtAPrzY2pGRhY/dT+nOTg=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Martijn Braam <martijn@brixit.nl>", "Date": "Sun, 10 May 2020 14:58:06 +0300", "Message-Id": "<20200510115810.21938-3-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.26.2", "In-Reply-To": "<20200510115810.21938-1-laurent.pinchart@ideasonboard.com>", "References": "<20200510115810.21938-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v5 2/6] 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": "Sun, 10 May 2020 11:58:21 -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>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\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 982fee6bf740..94565b97b6b1 100644\n--- a/src/libcamera/include/v4l2_videodevice.h\n+++ b/src/libcamera/include/v4l2_videodevice.h\n@@ -187,7 +187,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 setSelection(unsigned int target, Rectangle *rect);\n \n@@ -225,7 +225,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 requestBuffers(unsigned int count, enum v4l2_memory memoryType);\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex e95b0c01cc85..4b9f8b5c0413 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -917,16 +917,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@@ -944,15 +947,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", "v5", "2/6" ] }