{"id":16644,"url":"https://patchwork.libcamera.org/api/patches/16644/?format=json","web_url":"https://patchwork.libcamera.org/patch/16644/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220715135007.53574-7-jacopo@jmondi.org>","date":"2022-07-15T13:50:06","name":"[libcamera-devel,6/7] libcamera: v4l2_videodevice: Add multiplanar argument to toV4L2PixelFormat","commit_ref":null,"pull_url":null,"state":"superseded","archived":true,"hash":"2b42805a715bb7bcd13df52c81ef189e7956148d","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16644/mbox/","series":[{"id":3288,"url":"https://patchwork.libcamera.org/api/series/3288/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3288","date":"2022-07-15T13:50:00","name":"libcamera: Map multiple V4L2 formats to a single libcamera::format","version":1,"mbox":"https://patchwork.libcamera.org/series/3288/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16644/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16644/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 1FF75BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 15 Jul 2022 13:50:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D37246331E;\n\tFri, 15 Jul 2022 15:50:30 +0200 (CEST)","from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net\n\t[IPv6:2001:4b98:dc4:8::223])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 68B2D63316\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Jul 2022 15:50:27 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id 3F29860005;\n\tFri, 15 Jul 2022 13:50:26 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1657893030;\n\tbh=xsOmi0ExAprMxJ0HW3/9PchbaC2LQxkXWJ+JkZTpw/w=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=aIrKU66eVOSLnfLcMY7DnZRQviKQaKvqHAmpwSCKdGnvALwiqz7gb1jB4vkXjctRs\n\thOMRHriPqUB9VLxd9wpLLK3g4BVsLe3v0OL6Ns+eOke4dGURNX0VeXsebt50E/RqUE\n\trDC1nK3deaZG7JfG9QtVJGXV6Ztr4oCjv9yPE3qkknvZ3MvD8ON7VfFtB+piWwGHc2\n\tM6hNuqY42489QYdyhM5oaM+6Fe6Rz+32X6Y+/mVGOdC0SB3JgHVe1x+cW72/wGUaJk\n\t6SbEaI7Q9Y/vKiE56GbKl1UTiXJH4EoVQfM2MukFoYhmrLcS/GHPTYwoJsvMz+xt+G\n\tJHj+CoQpXuf5Q==","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 15 Jul 2022 15:50:06 +0200","Message-Id":"<20220715135007.53574-7-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.36.1","In-Reply-To":"<20220715135007.53574-1-jacopo@jmondi.org>","References":"<20220715135007.53574-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 6/7] libcamera: v4l2_videodevice: Add\n\tmultiplanar argument to toV4L2PixelFormat","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>","From":"Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"jozef@mlich.cz, Pavel Machek <pavel@ucw.cz>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The toV4L2PixelFormat() function selects which V4L2 format variant to\nuse (contiguous planes vs non-contiguous version) by using video device\nmultiplanar API from the capabilities.\n\nThe isMultiplanar() function however verifies if the video device uses\nthe singleplanar or the multiplanar V4L2 API, something which is\nunrelated to the format variant to use.\n\nAdd a 'multiplanar' flag, which defaults to false, to the\ntoV4L2PixelFormat() function to allow explicit selection of the format\nvariant.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/libcamera/internal/v4l2_videodevice.h |  3 ++-\n src/libcamera/v4l2_videodevice.cpp            | 13 +++++++------\n 2 files changed, 9 insertions(+), 7 deletions(-)","diff":"diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\nindex 6d8850c99afd..64296c5849f2 100644\n--- a/include/libcamera/internal/v4l2_videodevice.h\n+++ b/include/libcamera/internal/v4l2_videodevice.h\n@@ -228,7 +228,8 @@ public:\n \tstatic std::unique_ptr<V4L2VideoDevice>\n \tfromEntityName(const MediaDevice *media, const std::string &entity);\n \n-\tV4L2PixelFormat toV4L2PixelFormat(const PixelFormat &pixelFormat) const;\n+\tV4L2PixelFormat toV4L2PixelFormat(const PixelFormat &pixelFormat,\n+\t\t\t\t\t  bool multiplanar = false) const;\n \n protected:\n \tstd::string logPrefix() const override;\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex a3242ba755c0..767ab2361ef5 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -1992,23 +1992,24 @@ V4L2VideoDevice::fromEntityName(const MediaDevice *media,\n /**\n  * \\brief Convert \\a PixelFormat to one of the device supported V4L2 FourCC\n  * \\param[in] pixelFormat The PixelFormat to convert\n+ * \\param[in] multiplanar Use the multiplanar format version, default to false\n  *\n  * Convert a\\ pixelformat to a V4L2 FourCC that is known to be supported by\n  * the video device.\n  *\n- * For multiplanar formats, the V4L2 format variant (contiguous or\n- * non-contiguous planes) is selected automatically based on the capabilities\n- * of the video device. If the video device supports the V4L2 multiplanar API,\n- * non-contiguous formats are preferred.\n+ * V4L2 defines different format variants for the same format when using\n+ * contiguous or non-contiguous planes. The \\a multiplanar parameter allows\n+ * to select which variant to use.\n  *\n  * \\return The V4L2PixelFormat corresponding to \\a pixelFormat or an invalid\n  * PixelFormat if \\a pixelFormat is not supported by the video device\n  */\n-V4L2PixelFormat V4L2VideoDevice::toV4L2PixelFormat(const PixelFormat &pixelFormat) const\n+V4L2PixelFormat V4L2VideoDevice::toV4L2PixelFormat(const PixelFormat &pixelFormat,\n+\t\t\t\t\t\t   bool multiplanar) const\n {\n \tstd::vector<V4L2PixelFormat> deviceFormats = enumPixelformats(0);\n \tstd::vector<V4L2PixelFormat> v4l2PixelFormats =\n-\t\tV4L2PixelFormat::fromPixelFormat(pixelFormat, caps_.isMultiplanar());\n+\t\tV4L2PixelFormat::fromPixelFormat(pixelFormat, multiplanar);\n \n \tfor (const V4L2PixelFormat &v4l2Format : v4l2PixelFormats) {\n \t\tauto it = std::find_if(deviceFormats.begin(), deviceFormats.end(),\n","prefixes":["libcamera-devel","6/7"]}