{"id":16745,"url":"https://patchwork.libcamera.org/api/1.1/patches/16745/?format=json","web_url":"https://patchwork.libcamera.org/patch/16745/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20220723095330.43542-7-jacopo@jmondi.org>","date":"2022-07-23T09:53:28","name":"[libcamera-devel,v2,6/8] 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/1.1/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16745/mbox/","series":[{"id":3320,"url":"https://patchwork.libcamera.org/api/1.1/series/3320/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3320","date":"2022-07-23T09:53:22","name":"libcamera: Map multiple V4L2 formats to a single libcamera::format","version":2,"mbox":"https://patchwork.libcamera.org/series/3320/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16745/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16745/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 5C74EBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 23 Jul 2022 09:54:17 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 197346331B;\n\tSat, 23 Jul 2022 11:54:17 +0200 (CEST)","from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net\n\t[IPv6:2001:4b98:dc4:8::228])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5D0986330E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 23 Jul 2022 11:54:15 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id A15AC1BF20D;\n\tSat, 23 Jul 2022 09:54:12 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658570057;\n\tbh=W4t/laySClNJw1u9vyAMEbpDCAxoN7T8DlUDQfp7+II=;\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=kWrfawqZSpFXs0U93n5xsVQgvE3OJ2H8pMj/L56cYJG3t/O1SjJkf8oKMflvg4iss\n\tez68UDaa5WA1udIBkDh3ewp8g8wsYYXP3fe1fcIFTE7bD8WKhCMttWs5ugzr/4x4Do\n\tbvHirBnenFc8btFCCYxqIYxtdqonAM1zuGJQHjerzoOiHUwt4tqPIn8IFQAVEpOteN\n\tAe02MVQLs9pxV5AlAejubk8cFgKgMcnpRBp3vzK/CEItiiYzkD6glbq45Xg5RafQy2\n\tw5CebjcLd6/ETWjhbq456TbHzLgvBRkG4JjRsrilmEqVl+pJq2M87YdouCiDEnluLe\n\t8UxAgP/Wig6jQ==","To":"libcamera-devel@lists.libcamera.org","Date":"Sat, 23 Jul 2022 11:53:28 +0200","Message-Id":"<20220723095330.43542-7-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.37.1","In-Reply-To":"<20220723095330.43542-1-jacopo@jmondi.org>","References":"<20220723095330.43542-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 6/8] 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","v2","6/8"]}