Show a patch.

GET /api/1.1/patches/3088/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 3088,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/3088/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/3088/",
    "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": "<20200313233856.25202-5-laurent.pinchart@ideasonboard.com>",
    "date": "2020-03-13T23:38:52",
    "name": "[libcamera-devel,4/8] libcamera: v4l2_videodevice: Support filtering formats by media bus code",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "c2363f6cfc924cc19dc27168c915fc974e293003",
    "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/3088/mbox/",
    "series": [
        {
            "id": 718,
            "url": "https://patchwork.libcamera.org/api/1.1/series/718/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=718",
            "date": "2020-03-13T23:38:48",
            "name": "Simple pipeline handler",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/718/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/3088/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/3088/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 5023862826\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 14 Mar 2020 00:39:07 +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 96F8D143F;\n\tSat, 14 Mar 2020 00:39:06 +0100 (CET)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1584142747;\n\tbh=l85MigF0qRX6ZlqK91ZOjfx5Ybo9V3LC2jZ+5ypO6Fo=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=S06GE9lTCKCE4DKvVT6BeoF8rTZ/C7BI3ydjrR2HtIjT04bTNhC47EIxK1fB1ZW4n\n\tc8HIAB49tUl5gfdARfJSSRsKUPTu5GuzCDIWbUypxugaP54YzGVZkEjvMD3fBcGMnX\n\tee7c2vXHS68/F5wDZacfKAK+8azWsYXdQZnRdjVY=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Martijn Braam <martijn@brixit.nl>,\n\tAndrey Konovalov <andrey.konovalov@linaro.org>,\n\tMickael GUENE <mickael.guene@st.com>,\n\tBenjamin GAIGNARD <benjamin.gaignard@st.com>",
        "Date": "Sat, 14 Mar 2020 01:38:52 +0200",
        "Message-Id": "<20200313233856.25202-5-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.24.1",
        "In-Reply-To": "<20200313233856.25202-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20200313233856.25202-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 4/8] libcamera: v4l2_videodevice: Support\n\tfiltering 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, 13 Mar 2020 23:39:08 -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 d051c9060f09..72e7a50e6c3d 100644\n--- a/src/libcamera/include/v4l2_videodevice.h\n+++ b/src/libcamera/include/v4l2_videodevice.h\n@@ -184,7 +184,7 @@ public:\n \n \tint getFormat(V4L2DeviceFormat *format);\n \tint setFormat(V4L2DeviceFormat *format);\n-\tImageFormats formats();\n+\tImageFormats formats(uint32_t code = 0);\n \n \tint setCrop(Rectangle *rect);\n \tint setCompose(Rectangle *rect);\n@@ -220,7 +220,7 @@ private:\n \tint getFormatSingleplane(V4L2DeviceFormat *format);\n \tint setFormatSingleplane(V4L2DeviceFormat *format);\n \n-\tstd::vector<unsigned int> enumPixelformats();\n+\tstd::vector<unsigned int> enumPixelformats(uint32_t code);\n \tstd::vector<SizeRange> enumSizes(unsigned int 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 ca0d147f5fc1..ccc5faba3c27 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -839,16 +839,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-ImageFormats V4L2VideoDevice::formats()\n+ImageFormats V4L2VideoDevice::formats(uint32_t code)\n {\n \tImageFormats formats;\n \n-\tfor (unsigned int pixelformat : enumPixelformats()) {\n+\tfor (unsigned int pixelformat : enumPixelformats(code)) {\n \t\tstd::vector<SizeRange> sizes = enumSizes(pixelformat);\n \t\tif (sizes.empty())\n \t\t\treturn {};\n@@ -864,7 +867,7 @@ ImageFormats V4L2VideoDevice::formats()\n \treturn formats;\n }\n \n-std::vector<unsigned int> V4L2VideoDevice::enumPixelformats()\n+std::vector<unsigned int> V4L2VideoDevice::enumPixelformats(uint32_t code)\n {\n \tstd::vector<unsigned int> formats;\n \tint ret;\n@@ -873,11 +876,18 @@ std::vector<unsigned int> V4L2VideoDevice::enumPixelformats()\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 \t\t\tbreak;\n \n+\t\tif (code && !(pixelformatEnum.flags & V4L2_FMT_FLAG_MBUS_CODE)) {\n+\t\t\tLOG(V4L2, Error)\n+\t\t\t\t<< \"Media bus code filtering not supported by the device\";\n+\t\t\treturn {};\n+\t\t}\n+\n \t\tformats.push_back(pixelformatEnum.pixelformat);\n \t}\n \n",
    "prefixes": [
        "libcamera-devel",
        "4/8"
    ]
}