From patchwork Thu Jul 7 15:03:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 16572 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 36D5FBD1F1 for ; Thu, 7 Jul 2022 15:03:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F0A4F6330D; Thu, 7 Jul 2022 17:03:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1657206215; bh=OAeJmK8a13WscnZ1ICAIDS1SW7rRRDaCgvXjA5EWLhg=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=A4R3eCrukFlfq/I14KR2MTTAJGU2B7OC/8n43HFLD7BY9K99C4VurFbJl+nHNkUMb 053BlD1A4BkHM/y1np3iI/kchJOTjmBVW8jr9X0CFu7F7VLBDsbb8gvWHB6Y1b9Ap/ A8pMqCVuTtsU0oRorYrpLLAVcoL71tI7qsN9HXSk402j4+PqHPv99weM95yIZ+qKU8 zn8/EmsNjaR3t1na+RvB4wM1VXuLTLzoy3/j/E5BG2EQgZvTiVWkxkwsCemsDYORI7 oDpcftUMu0FwjQ//VMwBERy9nZ6pdrSe3hRdUHn+w2L+t3QUinyfGJDuSvo23VAJys b1X9qhYVWEUMA== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5B0A76043F for ; Thu, 7 Jul 2022 17:03:32 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="smKmU3gG"; dkim-atps=neutral Received: from pyrite.rasen.tech (softbank036240121080.bbtec.net [36.240.121.80]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id EDB2DD01; Thu, 7 Jul 2022 17:03:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1657206212; bh=OAeJmK8a13WscnZ1ICAIDS1SW7rRRDaCgvXjA5EWLhg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=smKmU3gGRY5yiGUMvcrb2wdHlOklVCSvraWkQoe35vyqH2L42VRV77zGlpFyFtJcM cxb0mYnod5tUtlnm27PxwdkP7gm2wdzYt3kkrrvHMVcD8jOUaC6zdBxUlAb0XM16x6 vv+GxEZpA3+ZYWiw5hMyr892LzkSK4cNuv4Tu1G4= To: libcamera-devel@lists.libcamera.org Date: Fri, 8 Jul 2022 00:03:07 +0900 Message-Id: <20220707150310.3645858-2-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220707150310.3645858-1-paul.elder@ideasonboard.com> References: <20220707150310.3645858-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/4] pipeline: rkisp1: Add output support for YUV420 and YVU420 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Paul Elder via libcamera-devel From: Paul Elder Reply-To: Paul Elder Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" YUV420 and YVU420 are already supported as output formats by the rkisp1 driver. Add them to the pipeline handler to support them in libcamera as well. Signed-off-by: Paul Elder --- src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp index 6f175758..c34e4147 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp @@ -130,6 +130,8 @@ int RkISP1Path::configure(const StreamConfiguration &config, switch (config.pixelFormat) { case formats::NV12: case formats::NV21: + case formats::YUV420: + case formats::YVU420: ispFormat.mbus_code = MEDIA_BUS_FMT_YUYV8_1_5X8; break; default: @@ -207,8 +209,10 @@ void RkISP1Path::stop() namespace { constexpr Size RKISP1_RSZ_MP_SRC_MIN{ 32, 16 }; constexpr Size RKISP1_RSZ_MP_SRC_MAX{ 4416, 3312 }; -constexpr std::array RKISP1_RSZ_MP_FORMATS{ +constexpr std::array RKISP1_RSZ_MP_FORMATS{ formats::YUYV, + formats::YUV420, + formats::YVU420, formats::NV16, formats::NV61, formats::NV21, From patchwork Thu Jul 7 15:03:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 16573 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 6A427BD1F1 for ; Thu, 7 Jul 2022 15:03:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8155C6048D; Thu, 7 Jul 2022 17:03:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1657206215; bh=YjLFLMawFqx4ktHg3snvp3H1fxzHguA1o6Y9LJI0U/Y=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=LbvEMdpTgFNvQfq7loH3KdpOlJ/EOXntYKUUKAwcdVNLP2jUl/S4/6gKh8yqbS0VA fN2Qqwwn/TYGXGtEftEFrar4uk5S5s0VKyPPKstDWPvTenjyjhRitg7dn9hS8XpXfE aCYoBcdIKCJeh/uXnvLZn+2NKmHvLKE3p0oW0VRegcDoApmaFGXAP4UhYOMOHNxaRa qtrKeKrH8h8cACgHzpmPNMkXANI0MhGek1yhUKi+2KsntSVJfYuzsskiul6NNtqC2y kVVX56kDLMNxscyruPivthUBK+o15b7FGc5V79tr3vxRNpx5uXO5xB8MPSIDb5Zplx cWtH+44nG1Exw== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3E93960400 for ; Thu, 7 Jul 2022 17:03:34 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="osFyxhUS"; dkim-atps=neutral Received: from pyrite.rasen.tech (softbank036240121080.bbtec.net [36.240.121.80]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C31896CA; Thu, 7 Jul 2022 17:03:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1657206214; bh=YjLFLMawFqx4ktHg3snvp3H1fxzHguA1o6Y9LJI0U/Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=osFyxhUSCsDWV4D9+mM7V/4PE3FHb7ctSMfnz+4pZUPknQQn/O6pBPVMoMhTdydbX ju/dKWSCW2C9nXNU6SLdTRgRUkbu8+Bt0JYDU6KSDm8LupJ+ab4H72dBnsWK0QLB4Y SSjIX6GrN6BZ/HlV02O+4lGb9b9hQfO2zQq66hAs= To: libcamera-devel@lists.libcamera.org Date: Fri, 8 Jul 2022 00:03:08 +0900 Message-Id: <20220707150310.3645858-3-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220707150310.3645858-1-paul.elder@ideasonboard.com> References: <20220707150310.3645858-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/4] libcamera: v4l2_pixelformat: Use multiplanar if single is unavailable X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Paul Elder via libcamera-devel From: Paul Elder Reply-To: Paul Elder Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Some formats, such as YVU422 (but *not* YUV422), YUV444, and YVU444, have only a multiplanar v4l2 format and no singleplanar format. When using V4L2PixelFormat::fromPixelFormat() to convert a libcamera format to V4L2PixelFormat, the default is to fetch the singleplanar format, and for those three formats an invalid format will be returned. The caller shouldn't be expected to check first if it should request the singleplanar or multiplanar version (that's the whole point of V4L2PixelFormat::fromPixelFormat()), so the solution that this patch implements is if fetching singleplanar/multiplanar fails, try fetching the other one. The side effect is that as most formats have only singleplanar v4l2 format and no multiplanar format, if a multiplanar format is request for these formats then the singleplanar one will be automatically returned. Since currently all callers of V4L2PixelFormat::fromPixelFormat() use the default singleplanar call, it is reasoned that this is not an issue. Signed-off-by: Paul Elder --- src/libcamera/v4l2_pixelformat.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp index 58fc4e9d..0d2bc350 100644 --- a/src/libcamera/v4l2_pixelformat.cpp +++ b/src/libcamera/v4l2_pixelformat.cpp @@ -321,7 +321,14 @@ V4L2PixelFormat V4L2PixelFormat::fromPixelFormat(const PixelFormat &pixelFormat, if (!info.isValid()) return V4L2PixelFormat(); - return multiplanar ? info.v4l2Formats.multi : info.v4l2Formats.single; + V4L2PixelFormat ret = multiplanar ? info.v4l2Formats.multi + : info.v4l2Formats.single; + /* Try the other of multi/single if the proper one doesn't exist */ + if (!ret.isValid()) + ret = multiplanar ? info.v4l2Formats.single + : info.v4l2Formats.multi; + + return ret; } /** From patchwork Thu Jul 7 15:03:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 16574 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 33577BD1F1 for ; Thu, 7 Jul 2022 15:03:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DA81663315; Thu, 7 Jul 2022 17:03:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1657206217; bh=W/fkLtNY3HSnCbs4zt9sFFBG9AmC8RU3aDGdKLpJ4vI=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=HfhiaR/1Vr5J8sU/RbYzgesaNAnBRyPGZx/VmttmDJU8lZ9LxTgvv8syhlHEd11jr 9wSTT1iW4/LQtQmQG5cWkLlWV9N+vbe0kDc7shy7Hpv9D3ab92R9OjLwrtRtaIZunD Ldb0QdvT5CnXMMEljvQ/68oKhTyO+x+o7SghEl+FO9K0VBSaB+4nZ36rMPapLid4qM piHPbqNGFjYsI4HoAeymz49Xqo1Kx541ZpfPyG7dwbVO3lCkPBcjFCT3YIf9X331gO 30Bsiz9LrfjOutRQ8hmCtYwYGi66jkTLcWTPVwxFrET8SPFp7b61LgnP4JiSkHvMTF VpE14qoVzTAkg== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 202EC60400 for ; Thu, 7 Jul 2022 17:03:36 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="bFWDD93+"; dkim-atps=neutral Received: from pyrite.rasen.tech (softbank036240121080.bbtec.net [36.240.121.80]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A5AA8D01; Thu, 7 Jul 2022 17:03:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1657206215; bh=W/fkLtNY3HSnCbs4zt9sFFBG9AmC8RU3aDGdKLpJ4vI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bFWDD93+hnmyesQScxpRsV1+MiNYq8gvEMCKur4iiyy3nSPMAkggQD705FuDkYxY+ 7qZH47AkOzJz/r8/UXS/jRMKjPMxTD8XWVssJ0ZqGcpqYe74oJDJS55EHYU6wFHlYI jzE7tApfFgich2nWauCU/y5kr930cMR+Vx3Q1Qoo= To: libcamera-devel@lists.libcamera.org Date: Fri, 8 Jul 2022 00:03:09 +0900 Message-Id: <20220707150310.3645858-4-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220707150310.3645858-1-paul.elder@ideasonboard.com> References: <20220707150310.3645858-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/4] pipeline: rkisp1: Add support for YUV422 and YVU422 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Paul Elder via libcamera-devel From: Paul Elder Reply-To: Paul Elder Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" YUV422 and YVU422 are already supported as output formats by the rkisp1 driver. Add them to the pipeline handler to support them in libcamera as well. Signed-off-by: Paul Elder --- src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp index c34e4147..24ff62e1 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp @@ -209,10 +209,12 @@ void RkISP1Path::stop() namespace { constexpr Size RKISP1_RSZ_MP_SRC_MIN{ 32, 16 }; constexpr Size RKISP1_RSZ_MP_SRC_MAX{ 4416, 3312 }; -constexpr std::array RKISP1_RSZ_MP_FORMATS{ +constexpr std::array RKISP1_RSZ_MP_FORMATS{ formats::YUYV, formats::YUV420, formats::YVU420, + formats::YUV422, + formats::YVU422, formats::NV16, formats::NV61, formats::NV21, From patchwork Thu Jul 7 15:03:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 16575 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id BA1D5BD1F1 for ; Thu, 7 Jul 2022 15:03:39 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 73CA36331F; Thu, 7 Jul 2022 17:03:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1657206219; bh=wAvMxEfZn8715RVc8QhSgtUfojBsiCXx7C3tPNskzHs=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=3qKI79q9005Gt7VVSchAGxZAj6nkV+UYpPdGoUWCQ+FwYmypjwI7GGoRMOViAzBWG sclCcGr+KTGkflRJiKDolPeHjySkKuJfoVbZUHT6Z+f8GnKKPhUrgq1DmDh0+5OFxi npgJpTxho2ab0O48/S0GJ7XV1Tw3B9Xg/z8ysb9SCCzNAEe8O9o3EGiZInxtvSADjI Ja2bIuwqk8dEjggmYJrgSOK7EQ7KFyKHRYzkGYwUZv6jaosnVIs2CamJFdI7isI0OD nN3FXmUemsgjGdRdqIPZ70JZAX8pd8NOSNaFoALYhDw78aZX8uqvCjTJpoalKQwkKO WkjIXPH+aPd3w== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 50A296331B for ; Thu, 7 Jul 2022 17:03:38 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="uUNKU5iv"; dkim-atps=neutral Received: from pyrite.rasen.tech (softbank036240121080.bbtec.net [36.240.121.80]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 899766CA; Thu, 7 Jul 2022 17:03:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1657206217; bh=wAvMxEfZn8715RVc8QhSgtUfojBsiCXx7C3tPNskzHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uUNKU5ivFZCASDrYAvL4evUD0FRbHLajMj85ehNESPtBt+NMJV64LVL0g6Uv8p06O /Ef3cfqwaSPsOYIRSQf/M2/+fHwK10Va1/b7Rg4IGF+s8OAlwVA294jTqSJye/Ojca 98uTU5dMue/OMpo6KZYqoSNf0GjOSZubNT5AEYfo= To: libcamera-devel@lists.libcamera.org Date: Fri, 8 Jul 2022 00:03:10 +0900 Message-Id: <20220707150310.3645858-5-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220707150310.3645858-1-paul.elder@ideasonboard.com> References: <20220707150310.3645858-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH 4/4] pipeline: rkisp1: Add support for UYVY X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Paul Elder via libcamera-devel From: Paul Elder Reply-To: Paul Elder Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Support for UYVY will be added soon in the rkisp1 driver. Add it to the pipeline handler to support it in libcamera as well. Signed-off-by: Paul Elder --- Besides the fact that support hasn't been merged (or sent yet, for that matter) in the rkisp1 driver, how do we deal with older versions of the driver that won't have UYVY support? Should we enumerate the formats and check if it's available? Just for UYVY or for all formats? --- src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp index 24ff62e1..6b4c4ed5 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp @@ -209,8 +209,9 @@ void RkISP1Path::stop() namespace { constexpr Size RKISP1_RSZ_MP_SRC_MIN{ 32, 16 }; constexpr Size RKISP1_RSZ_MP_SRC_MAX{ 4416, 3312 }; -constexpr std::array RKISP1_RSZ_MP_FORMATS{ +constexpr std::array RKISP1_RSZ_MP_FORMATS{ formats::YUYV, + formats::UYVY, formats::YUV420, formats::YVU420, formats::YUV422,