From patchwork Wed Sep 8 08:14:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 13760 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 1B071BDB1D for ; Wed, 8 Sep 2021 08:14:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A5B7B69172; Wed, 8 Sep 2021 10:14:54 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="oLT4+Pk3"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B303860250 for ; Wed, 8 Sep 2021 10:14:52 +0200 (CEST) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AECBD993; Wed, 8 Sep 2021 10:14:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1631088892; bh=DW9K8R8YTP+/gWwo8ixKVrgrVReTM+8xpTr5DL/4DIA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oLT4+Pk3/q6njkHaDge2J/Aj+1MHYWSE3kFHfr9FU4gUECal9P1pO5Jh3ml4yw+Lf ry2Ilb6SxUhEeReeyG2SIzFGIOsIA13vlc80dvaTxMqepMxlCeba89k2tv7CGyGGEJ e2pyZWqXBq02RU8/D7k1Om/ThT/bqxcLnLcpUHRg= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Wed, 8 Sep 2021 17:14:31 +0900 Message-Id: <20210908081437.4022697-2-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210908081437.4022697-1-paul.elder@ideasonboard.com> References: <20210908081437.4022697-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 1/7] v4l2: v4l2_compat_manager: Don't print "camera not found" on openat() 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Some applications (like Firefox) run open() many times on video device nodes. This may lead to user confusion when they see "INFO V4L2Compat v4l2_compat_manager.cpp:146 No camera found for /dev/videoX" over and over again. Lower the log level to debug so that we can still get this information on debug, and so users won't see it all the time. Signed-off-by: Paul Elder Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/v4l2/v4l2_compat_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/v4l2/v4l2_compat_manager.cpp b/src/v4l2/v4l2_compat_manager.cpp index e566125a..690a191f 100644 --- a/src/v4l2/v4l2_compat_manager.cpp +++ b/src/v4l2/v4l2_compat_manager.cpp @@ -143,7 +143,7 @@ int V4L2CompatManager::openat(int dirfd, const char *path, int oflag, mode_t mod ret = getCameraIndex(fd); if (ret < 0) { - LOG(V4L2Compat, Info) << "No camera found for " << path; + LOG(V4L2Compat, Debug) << "No camera found for " << path; return fd; } From patchwork Wed Sep 8 08:14:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 13761 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 9A81EBDB1D for ; Wed, 8 Sep 2021 08:14:57 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 55AFA69172; Wed, 8 Sep 2021 10:14:57 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="diXWxtTY"; dkim-atps=neutral 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 9CF1D69171 for ; Wed, 8 Sep 2021 10:14:54 +0200 (CEST) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 29318993; Wed, 8 Sep 2021 10:14:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1631088894; bh=JMejc/MaHIdBY1OFL9mVei5n5wJLR7z8pnQPG/Av6j8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=diXWxtTYiTReo5XhCyrfNvB7abuNn8r2QlXGbb/5u0JBtvl6n6xp0lTBYCAaacDxD pRpvMQWGCU9aLDXDqszzsXFduz4swGJpBhleVqLw6xYKOjAesKdrCpbPw144AQ+Bwg jUd/EyQRFn3wsJZCUmSBj3OguoWuysYkRZ4ESUqE= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Wed, 8 Sep 2021 17:14:32 +0900 Message-Id: <20210908081437.4022697-3-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210908081437.4022697-1-paul.elder@ideasonboard.com> References: <20210908081437.4022697-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/7] libcamera: v4l2_pixelformat: Add V4L2 description strings 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add V4L2 description strings to the map of V4L2 formats. To achieve this, create an Info struct to wrap them. Update the one current user of the old map. This will be used later in the V4L2 compatibility layer to report the V4L2 format description. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- include/libcamera/internal/v4l2_pixelformat.h | 5 + src/libcamera/v4l2_pixelformat.cpp | 182 ++++++++++++------ 2 files changed, 130 insertions(+), 57 deletions(-) diff --git a/include/libcamera/internal/v4l2_pixelformat.h b/include/libcamera/internal/v4l2_pixelformat.h index 560c5c53..36c690db 100644 --- a/include/libcamera/internal/v4l2_pixelformat.h +++ b/include/libcamera/internal/v4l2_pixelformat.h @@ -20,6 +20,11 @@ namespace libcamera { class V4L2PixelFormat { public: + struct Info { + PixelFormat format; + const char *name; + }; + V4L2PixelFormat() : fourcc_(0) { diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp index d1f3a42f..e0956442 100644 --- a/src/libcamera/v4l2_pixelformat.cpp +++ b/src/libcamera/v4l2_pixelformat.cpp @@ -45,77 +45,145 @@ LOG_DECLARE_CATEGORY(V4L2) namespace { -const std::map vpf2pf{ +const std::map vpf2pf{ /* RGB formats. */ - { V4L2PixelFormat(V4L2_PIX_FMT_RGB565), formats::RGB565 }, - { V4L2PixelFormat(V4L2_PIX_FMT_RGB565X), formats::RGB565_BE }, - { V4L2PixelFormat(V4L2_PIX_FMT_RGB24), formats::BGR888 }, - { V4L2PixelFormat(V4L2_PIX_FMT_BGR24), formats::RGB888 }, - { V4L2PixelFormat(V4L2_PIX_FMT_XBGR32), formats::XRGB8888 }, - { V4L2PixelFormat(V4L2_PIX_FMT_XRGB32), formats::BGRX8888 }, - { V4L2PixelFormat(V4L2_PIX_FMT_RGBX32), formats::XBGR8888 }, - { V4L2PixelFormat(V4L2_PIX_FMT_RGBA32), formats::ABGR8888 }, - { V4L2PixelFormat(V4L2_PIX_FMT_ABGR32), formats::ARGB8888 }, - { V4L2PixelFormat(V4L2_PIX_FMT_ARGB32), formats::BGRA8888 }, - { V4L2PixelFormat(V4L2_PIX_FMT_BGRA32), formats::RGBA8888 }, + { V4L2PixelFormat(V4L2_PIX_FMT_RGB565), + { formats::RGB565, "16-bit RGB 5-6-5" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_RGB565X), + { formats::RGB565_BE, "16-bit RGB 5-6-5 BE" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_RGB24), + { formats::BGR888, "24-bit RGB 8-8-8" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_BGR24), + { formats::RGB888, "24-bit BGR 8-8-8" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_XBGR32), + { formats::XRGB8888, "32-bit BGRX 8-8-8-8" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_XRGB32), + { formats::BGRX8888, "32-bit XRGB 8-8-8-8" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_RGBX32), + { formats::XBGR8888, "32-bit RGBX 8-8-8-8" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_RGBA32), + { formats::ABGR8888, "32-bit RGBA 8-8-8-8" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_ABGR32), + { formats::ARGB8888, "32-bit BGRA 8-8-8-8" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_ARGB32), + { formats::BGRA8888, "32-bit ARGB 8-8-8-8" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_BGRA32), + { formats::RGBA8888, "32-bit ABGR 8-8-8-8" } }, /* YUV packed formats. */ - { V4L2PixelFormat(V4L2_PIX_FMT_YUYV), formats::YUYV }, - { V4L2PixelFormat(V4L2_PIX_FMT_YVYU), formats::YVYU }, - { V4L2PixelFormat(V4L2_PIX_FMT_UYVY), formats::UYVY }, - { V4L2PixelFormat(V4L2_PIX_FMT_VYUY), formats::VYUY }, + { V4L2PixelFormat(V4L2_PIX_FMT_YUYV), + { formats::YUYV, "YUYV 4:2:2" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_YVYU), + { formats::YVYU, "YVYU 4:2:2" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_UYVY), + { formats::UYVY, "UYVY 4:2:2" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_VYUY), + { formats::VYUY, "VYUY 4:2:2" } }, /* YUV planar formats. */ - { V4L2PixelFormat(V4L2_PIX_FMT_NV16), formats::NV16 }, - { V4L2PixelFormat(V4L2_PIX_FMT_NV16M), formats::NV16 }, - { V4L2PixelFormat(V4L2_PIX_FMT_NV61), formats::NV61 }, - { V4L2PixelFormat(V4L2_PIX_FMT_NV61M), formats::NV61 }, - { V4L2PixelFormat(V4L2_PIX_FMT_NV12), formats::NV12 }, - { V4L2PixelFormat(V4L2_PIX_FMT_NV12M), formats::NV12 }, - { V4L2PixelFormat(V4L2_PIX_FMT_NV21), formats::NV21 }, - { V4L2PixelFormat(V4L2_PIX_FMT_NV21M), formats::NV21 }, - { V4L2PixelFormat(V4L2_PIX_FMT_YUV420), formats::YUV420 }, - { V4L2PixelFormat(V4L2_PIX_FMT_YUV420M), formats::YUV420 }, - { V4L2PixelFormat(V4L2_PIX_FMT_YVU420), formats::YVU420 }, - { V4L2PixelFormat(V4L2_PIX_FMT_YVU420M), formats::YVU420 }, - { V4L2PixelFormat(V4L2_PIX_FMT_YUV422P), formats::YUV422 }, - { V4L2PixelFormat(V4L2_PIX_FMT_YUV422M), formats::YUV422 }, + { V4L2PixelFormat(V4L2_PIX_FMT_NV16), + { formats::NV16, "Y/CbCr 4:2:2" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_NV16M), + { formats::NV16, "Y/CbCr 4:2:2 (N-C)" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_NV61), + { formats::NV61, "Y/CrCb 4:2:2" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_NV61M), + { formats::NV61, "Y/CrCb 4:2:2 (N-C)" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_NV12), + { formats::NV12, "Y/CbCr 4:2:0" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_NV12M), + { formats::NV12, "Y/CbCr 4:2:0 (N-C)" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_NV21), + { formats::NV21, "Y/CrCb 4:2:0" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_NV21M), + { formats::NV21, "Y/CrCb 4:2:0 (N-C)" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_YUV420), + { formats::YUV420, "Planar YUV 4:2:0" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_YUV420M), + { formats::YUV420, "Planar YUV 4:2:0 (N-C)" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_YVU420), + { formats::YVU420, "Planar YVU 4:2:0" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_YVU420M), + { formats::YVU420, "Planar YVU 4:2:0 (N-C)" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_YUV422P), + { formats::YUV422, "Planar YUV 4:2:2" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_YUV422M), + { formats::YUV422, "Planar YUV 4:2:2 (N-C)" } }, /* Greyscale formats. */ - { V4L2PixelFormat(V4L2_PIX_FMT_GREY), formats::R8 }, + { V4L2PixelFormat(V4L2_PIX_FMT_GREY), + { formats::R8, "8-bit Greyscale" } }, /* Bayer formats. */ - { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8), formats::SBGGR8 }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8), formats::SGBRG8 }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8), formats::SGRBG8 }, - { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8), formats::SRGGB8 }, - { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10), formats::SBGGR10 }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10), formats::SGBRG10 }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10), formats::SGRBG10 }, - { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10), formats::SRGGB10 }, - { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P), formats::SBGGR10_CSI2P }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P), formats::SGBRG10_CSI2P }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P), formats::SGRBG10_CSI2P }, - { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P), formats::SRGGB10_CSI2P }, - { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12), formats::SBGGR12 }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12), formats::SGBRG12 }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12), formats::SGRBG12 }, - { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12), formats::SRGGB12 }, - { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P), formats::SBGGR12_CSI2P }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P), formats::SGBRG12_CSI2P }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P), formats::SGRBG12_CSI2P }, - { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P), formats::SRGGB12_CSI2P }, - { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16), formats::SBGGR16 }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16), formats::SGBRG16 }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16), formats::SGRBG16 }, - { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16), formats::SRGGB16 }, + { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8), + { formats::SBGGR8, "8-bit Bayer BGBG/GRGR" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8), + { formats::SGBRG8, "8-bit Bayer GBGB/RGRG" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8), + { formats::SGRBG8, "8-bit Bayer GRGR/BGBG" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8), + { formats::SRGGB8, "8-bit Bayer RGRG/GBGB" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10), + { formats::SBGGR10, "10-bit Bayer BGBG/GRGR" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10), + { formats::SGBRG10, "10-bit Bayer GBGB/RGRG" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10), + { formats::SGRBG10, "10-bit Bayer GRGR/BGBG" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10), + { formats::SRGGB10, "10-bit Bayer RGRG/GBGB" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P), + { formats::SBGGR10_CSI2P, "10-bit Bayer BGBG/GRGR Packed" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P), + { formats::SGBRG10_CSI2P, "10-bit Bayer GBGB/RGRG Packed" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P), + { formats::SGRBG10_CSI2P, "10-bit Bayer GRGR/BGBG Packed" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P), + { formats::SRGGB10_CSI2P, "10-bit Bayer RGRG/GBGB Packed" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12), + { formats::SBGGR12, "12-bit Bayer BGBG/GRGR" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12), + { formats::SGBRG12, "12-bit Bayer GBGB/RGRG" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12), + { formats::SGRBG12, "12-bit Bayer GRGR/BGBG" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12), + { formats::SRGGB12, "12-bit Bayer RGRG/GBGB" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P), + { formats::SBGGR12_CSI2P, "12-bit Bayer BGBG/GRGR Packed" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P), + { formats::SGBRG12_CSI2P, "12-bit Bayer GBGB/RGRG Packed" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P), + { formats::SGRBG12_CSI2P, "12-bit Bayer GRGR/BGBG Packed" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P), + { formats::SRGGB12_CSI2P, "12-bit Bayer RGRG/GBGB Packed" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16), + { formats::SBGGR16, "16-bit Bayer BGBG/GRGR" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16), + { formats::SGBRG16, "16-bit Bayer GBGB/RGRG" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16), + { formats::SGRBG16, "16-bit Bayer GRGR/BGBG" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16), + { formats::SRGGB16, "16-bit Bayer RGRG/GBGB" } }, /* Compressed formats. */ - { V4L2PixelFormat(V4L2_PIX_FMT_MJPEG), formats::MJPEG }, + { V4L2PixelFormat(V4L2_PIX_FMT_MJPEG), + { formats::MJPEG, "Motion-JPEG" } }, }; } /* namespace */ +/** + * \struct V4L2PixelFormat::Info + * \brief Information about a V4L2 format + * + * \var V4L2PixelFormat::Info::format + * \brief The corresponding libcamera PixelFormat + * + * \sa PixelFormat + * + * \var V4L2PixelFormat::Info::name + * \brief The human-readable description of the V4L2 format + */ + /** * \fn V4L2PixelFormat::V4L2PixelFormat() * \brief Construct a V4L2PixelFormat with an invalid format @@ -192,7 +260,7 @@ PixelFormat V4L2PixelFormat::toPixelFormat() const return PixelFormat(); } - return iter->second; + return iter->second.format; } /** From patchwork Wed Sep 8 08:14:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 13762 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 80533BDB1D for ; Wed, 8 Sep 2021 08:15:00 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1EF1E69175; Wed, 8 Sep 2021 10:15:00 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="o9OjiucT"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 571086916C for ; Wed, 8 Sep 2021 10:14:56 +0200 (CEST) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 02E00993; Wed, 8 Sep 2021 10:14:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1631088896; bh=M1epm8tdrlLzMakKTLR22L9ePUnyQx9edPZUiSPP62k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o9OjiucTxANumwev44+sXq4SuYBhV5SoYQ2drv7tPUciK6oKehS01QE2F2i++5QTC ZlkV6kHMDfs2k763Y4Cr5mD5m096+Dy4f65EIWf1UFGIPr942+pkdI3DqKehM/DPTk WMNMNpLhjxFYm/BWxsBFHZPbRXkd1JNKVL1I8Dn4= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Wed, 8 Sep 2021 17:14:33 +0900 Message-Id: <20210908081437.4022697-4-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210908081437.4022697-1-paul.elder@ideasonboard.com> References: <20210908081437.4022697-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 3/7] libcamera: v4l2_pixelformat: Add entries for NV24 and NV42 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The entries for NV24 and NV42 were missing from the V4L2PixelFormat map. Add them. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- src/libcamera/v4l2_pixelformat.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp index e0956442..0a8312c4 100644 --- a/src/libcamera/v4l2_pixelformat.cpp +++ b/src/libcamera/v4l2_pixelformat.cpp @@ -97,6 +97,10 @@ const std::map vpf2pf{ { formats::NV21, "Y/CrCb 4:2:0" } }, { V4L2PixelFormat(V4L2_PIX_FMT_NV21M), { formats::NV21, "Y/CrCb 4:2:0 (N-C)" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_NV24), + { formats::NV24, "Y/CbCr 4:4:4" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_NV42), + { formats::NV42, "Y/CrCb 4:4:4" } }, { V4L2PixelFormat(V4L2_PIX_FMT_YUV420), { formats::YUV420, "Planar YUV 4:2:0" } }, { V4L2PixelFormat(V4L2_PIX_FMT_YUV420M), From patchwork Wed Sep 8 08:14:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 13763 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 24340BDB1D for ; Wed, 8 Sep 2021 08:15:01 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DA19869173; Wed, 8 Sep 2021 10:15:00 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="YPdlrjoA"; dkim-atps=neutral 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 3109E6916E for ; Wed, 8 Sep 2021 10:14:58 +0200 (CEST) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B8354993; Wed, 8 Sep 2021 10:14:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1631088897; bh=bfM8kBnyFpaLCAFcna3SlvvocnGZ6yCVKX+y4y4wLO4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YPdlrjoAlMmcr+l+TmMxdYF7Kg7ixZUPUekyuAIPiiAuGn1s5G4xP/uEv6C6XPNOS vpfEw2jStcIBpo3lDINWra/oaJubQy6IA4E999HLOIhxeF/Z8q4PWblwQd4TsbJjQP 3MSEO1LbUU87XluyO32SEMGWX9qLSB2uEwr7v2N4= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Wed, 8 Sep 2021 17:14:34 +0900 Message-Id: <20210908081437.4022697-5-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210908081437.4022697-1-paul.elder@ideasonboard.com> References: <20210908081437.4022697-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 4/7] libcamera: v4l2_pixelformat: Add helper function to get the description 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add a helper function to V4L2PixelFormat for retrieving the V4L2 description string. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- include/libcamera/internal/v4l2_pixelformat.h | 1 + src/libcamera/v4l2_pixelformat.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/include/libcamera/internal/v4l2_pixelformat.h b/include/libcamera/internal/v4l2_pixelformat.h index 36c690db..3b24bc73 100644 --- a/include/libcamera/internal/v4l2_pixelformat.h +++ b/include/libcamera/internal/v4l2_pixelformat.h @@ -40,6 +40,7 @@ public: operator uint32_t() const { return fourcc_; } std::string toString() const; + const char *toDescription() const; PixelFormat toPixelFormat() const; static V4L2PixelFormat fromPixelFormat(const PixelFormat &pixelFormat, diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp index 0a8312c4..f5598d9d 100644 --- a/src/libcamera/v4l2_pixelformat.cpp +++ b/src/libcamera/v4l2_pixelformat.cpp @@ -250,6 +250,23 @@ std::string V4L2PixelFormat::toString() const return ss; } +/** + * \brief Return the V4L2 description corresponding to the V4L2 format + * \return The V4L2 description corresponding to the V4L2 format + */ +const char *V4L2PixelFormat::toDescription() const +{ + const auto iter = vpf2pf.find(*this); + if (iter == vpf2pf.end()) { + LOG(V4L2, Warning) + << "Unsupported V4L2 pixel format " + << toString(); + return ""; + } + + return iter->second.name; +} + /** * \brief Convert the V4L2 pixel format to the corresponding PixelFormat * \return The PixelFormat corresponding to the V4L2 pixel format From patchwork Wed Sep 8 08:14:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 13764 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 7D2FBBDB1D for ; Wed, 8 Sep 2021 08:15:03 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4B06269175; Wed, 8 Sep 2021 10:15:03 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="f3GqtZFA"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0395169171 for ; Wed, 8 Sep 2021 10:15:00 +0200 (CEST) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 917EC993; Wed, 8 Sep 2021 10:14:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1631088899; bh=8UMiSso+TIGsQVLvS4U0pKDQ0qeqUdJY4845Olf00d0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f3GqtZFAoUtmfcpjMwQpZetxQyOzIZmi0GV8iq3e7le4AAVJN56mqtMetjYXIgrSP eebrHaqB45prCA9er++8b1GD0sV4HmkMNmA23hORTFkScmOLmCp6WetfR5wGHZZDA4 QeIyMdMEJpI5DxS3hXlvdsFAAhaekG9TNm6iFH8w= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Wed, 8 Sep 2021 17:14:35 +0900 Message-Id: <20210908081437.4022697-6-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210908081437.4022697-1-paul.elder@ideasonboard.com> References: <20210908081437.4022697-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 5/7] v4l2: v4l2_camera_proxy: Report the proper format name in enum_fmt 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Now that libcamera has the V4L2 format names, retrive and report those names in ENUM_FMT. While at it, refactor the code slightly with PixelFormatInfo. This fixes the test failures on v4l2-compliance with the v4l2 compatilibity layer that were observed in version v4l2-compliance version 1.21.0-4838. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- src/v4l2/v4l2_camera_proxy.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp index aeffef26..5fbfcdd7 100644 --- a/src/v4l2/v4l2_camera_proxy.cpp +++ b/src/v4l2/v4l2_camera_proxy.cpp @@ -274,13 +274,13 @@ int V4L2CameraProxy::vidioc_enum_fmt(V4L2CameraFile *file, struct v4l2_fmtdesc * return -EINVAL; PixelFormat format = streamConfig_.formats().pixelformats()[arg->index]; + const V4L2PixelFormat &v4l2Format = V4L2PixelFormat::fromPixelFormat(format); /* \todo Set V4L2_FMT_FLAG_COMPRESSED for compressed formats. */ arg->flags = 0; - /* \todo Add map from format to description. */ utils::strlcpy(reinterpret_cast(arg->description), - "Video Format Description", sizeof(arg->description)); - arg->pixelformat = V4L2PixelFormat::fromPixelFormat(format); + v4l2Format.toDescription(), sizeof(arg->description)); + arg->pixelformat = v4l2Format; memset(arg->reserved, 0, sizeof(arg->reserved)); From patchwork Wed Sep 8 08:14:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 13765 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 1D848BDB1D for ; Wed, 8 Sep 2021 08:15:04 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C438C69173; Wed, 8 Sep 2021 10:15:03 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="HmlknNCQ"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D1A1B69170 for ; Wed, 8 Sep 2021 10:15:01 +0200 (CEST) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6C91A993; Wed, 8 Sep 2021 10:15:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1631088901; bh=e7+qOd+O9USS3T6+ar5OyTHz/eAJRBVO3xZ1nNRxWr0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HmlknNCQ4KkCx8r8oQP0hbu5GRq16HJ+eqgKYAd2PCU7YGRj2KGNT4kNMpKBzAY9N y4uicTfKyxXU3oddX0D53FCocmchjItAfK62Nrqc7FYdF6QFgHYmpMK+rVfCbBNyI2 614gv6rEIxeC+RA3jCLEMy32IaQ9TBxwEOUB0TYw= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Wed, 8 Sep 2021 17:14:36 +0900 Message-Id: <20210908081437.4022697-7-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210908081437.4022697-1-paul.elder@ideasonboard.com> References: <20210908081437.4022697-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 6/7] v4l2: v4l2_camera_proxy: Set the compressed flag in enum_fmt 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Set the compressed flag in ENUM_FMT if the format is MJPEG. As the only compressed format that libcamera currently supports is MJPEG, this should be sufficient. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- src/v4l2/v4l2_camera_proxy.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp index 5fbfcdd7..9de94fa1 100644 --- a/src/v4l2/v4l2_camera_proxy.cpp +++ b/src/v4l2/v4l2_camera_proxy.cpp @@ -276,8 +276,7 @@ int V4L2CameraProxy::vidioc_enum_fmt(V4L2CameraFile *file, struct v4l2_fmtdesc * PixelFormat format = streamConfig_.formats().pixelformats()[arg->index]; const V4L2PixelFormat &v4l2Format = V4L2PixelFormat::fromPixelFormat(format); - /* \todo Set V4L2_FMT_FLAG_COMPRESSED for compressed formats. */ - arg->flags = 0; + arg->flags = format == formats::MJPEG ? V4L2_FMT_FLAG_COMPRESSED : 0; utils::strlcpy(reinterpret_cast(arg->description), v4l2Format.toDescription(), sizeof(arg->description)); arg->pixelformat = v4l2Format; From patchwork Wed Sep 8 08:14:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 13766 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 7F1A7BDB1D for ; Wed, 8 Sep 2021 08:15:06 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 49D946917A; Wed, 8 Sep 2021 10:15:06 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="o6ApS6wG"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 33D9B69179 for ; Wed, 8 Sep 2021 10:15:04 +0200 (CEST) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 44E87993; Wed, 8 Sep 2021 10:15:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1631088904; bh=h1yQazzvczXDSFiptddBzYZaEVPm0ehcDiNNS8tiw58=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o6ApS6wGq4GoVw9XCFoFEoCEyLRnK9gmFrNjJ9Ss0xptfZrJdu9RDYah+nn2ORBkM dlumCx73yTHQ+b1PBtIC0whtDLqFdskqUkg5bewAUkU5dg7N6rPdOgmGim86D8IjoU Cv1VajW6rBHr8JRJ0yU1QKYKN6g5DA119966pSmA= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Wed, 8 Sep 2021 17:14:37 +0900 Message-Id: <20210908081437.4022697-8-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210908081437.4022697-1-paul.elder@ideasonboard.com> References: <20210908081437.4022697-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 7/7] test: v4l2_compat_test: Fix v4l2-compliance version parsing 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" v4l2-compliance changed their version string: v4l2-compliance 1.21.0-4618 v4l2-compliance SHA: cc211b76476aca2c072ffa83a9b003957d5f3909, 64 bits, 64-bit time_t v4l2-compliance 1.21.0-4838, 64 bits, 64-bit time_t The current parsing takes the last result of split, which works for the former, but not the latter. Take the second result of split instead, and strip away any commas. Signed-off-by: Paul Elder Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart Tested-by: Laurent Pinchart --- test/v4l2_compat/v4l2_compat_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/v4l2_compat/v4l2_compat_test.py b/test/v4l2_compat/v4l2_compat_test.py index 51bfa952..ae892ced 100755 --- a/test/v4l2_compat/v4l2_compat_test.py +++ b/test/v4l2_compat/v4l2_compat_test.py @@ -94,7 +94,7 @@ def main(argv): return TestSkip ret, out = run_with_stdout(v4l2_compliance, '--version') - if ret != 0 or version.parse(out[0].split()[-1]) < MIN_V4L_UTILS_VERSION: + if ret != 0 or version.parse(out[0].split()[1].replace(',', '')) < MIN_V4L_UTILS_VERSION: print('v4l2-compliance version >= 1.21.0 required') return TestSkip