From patchwork Thu Sep 9 08:08:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 13772 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 C1646BDC71 for ; Thu, 9 Sep 2021 08:09:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 89CAD69171; Thu, 9 Sep 2021 10:09:16 +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="YZ2XX2Gv"; 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 C81CD6916D for ; Thu, 9 Sep 2021 10:09:15 +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 0EEBA24F; Thu, 9 Sep 2021 10:09:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1631174955; bh=DW9K8R8YTP+/gWwo8ixKVrgrVReTM+8xpTr5DL/4DIA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YZ2XX2Gv7jRmGntY3ba1hE9/JqbhMs+3TvV1zCHfY8R0dlAPM72Wix08iRX1UjQrV yJt0UWfe7iAPmF69hKogP8nPbi5ADyCFHnT20N1NBdbaNmKlnL1dlKD2hyCWDsgDur hWCtsvJbknB/Gs2eED2iwtYJUi7kLqUL5PWl6joI= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Thu, 9 Sep 2021 17:08:56 +0900 Message-Id: <20210909080902.239533-2-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210909080902.239533-1-paul.elder@ideasonboard.com> References: <20210909080902.239533-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 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 Thu Sep 9 08:08:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 13773 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 31AD0BDC71 for ; Thu, 9 Sep 2021 08:09:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E7DB26916A; Thu, 9 Sep 2021 10:09:18 +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="dtohjpMb"; 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 CB2756024E for ; Thu, 9 Sep 2021 10:09:17 +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 25A9224F; Thu, 9 Sep 2021 10:09:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1631174957; bh=OiRwClVxtVwF+qT/6cpbd6tHquFzhN/cHMffs0aodMc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dtohjpMb/tjHPNi/Ii1VRiwTbeU1aZ68TEmZ6dP2OoZ/7ouabh2YihQhZ8XhrCGs7 fE35F+fxMM6xL3H5OHjA9RkgApemUtDSg5CH3ATw5fZ0cOSSzL9ckkcFBOgdE+d67Q JCr5BEijxDjrbWFBPupoaBQ/OwqhGxQ7cNMg5x7c= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Thu, 9 Sep 2021 17:08:57 +0900 Message-Id: <20210909080902.239533-3-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210909080902.239533-1-paul.elder@ideasonboard.com> References: <20210909080902.239533-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 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 Reviewed-by: Jean-Michel Hautbois --- 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..87872542 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 *description; + }; + V4L2PixelFormat() : fourcc_(0) { diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp index d1f3a42f..795da771 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 pixel format + * + * \var V4L2PixelFormat::Info::format + * \brief The corresponding libcamera PixelFormat + * + * \sa PixelFormat + * + * \var V4L2PixelFormat::Info::description + * \brief The human-readable description of the V4L2 pixel 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 Thu Sep 9 08:08:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 13774 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 8CC0EBDC71 for ; Thu, 9 Sep 2021 08:09:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 45EA36916F; Thu, 9 Sep 2021 10:09:21 +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="fmGo0Pg+"; 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 A42266024E for ; Thu, 9 Sep 2021 10:09:19 +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 29A3524F; Thu, 9 Sep 2021 10:09:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1631174959; bh=oZvizcrdIbjhiiEIl6SlsdusM5v4Tb8v1IbiNKKK1lI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fmGo0Pg+TnfyysSWIk+/byVLnUeDgYTral7yB7j1fgklgKB6got2LtkipIScnXOfk Gtg8Gdk8VwQMLAvKpt+DC7Lv1L7SjSKArefrE3PyIBWAFYJVrb73DNyoctX3lK01rh K2pmfqLLIuY6GyrbeO+ocDVGkEgmFfZc6sN2Sa1A= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Thu, 9 Sep 2021 17:08:58 +0900 Message-Id: <20210909080902.239533-4-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210909080902.239533-1-paul.elder@ideasonboard.com> References: <20210909080902.239533-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 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 Reviewed-by: Jean-Michel Hautbois --- 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 795da771..2c8167a7 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 Thu Sep 9 08:08:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 13775 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 DFCC9BDC71 for ; Thu, 9 Sep 2021 08:09:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A223169178; Thu, 9 Sep 2021 10:09:22 +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="nXv04fz6"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8CEB469177 for ; Thu, 9 Sep 2021 10:09:21 +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 0307C24F; Thu, 9 Sep 2021 10:09:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1631174961; bh=kcl1JC+vWPyfwvqCjoA5NVVXXDkUDuFfoOec44dSbvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nXv04fz6yrAVpiDW1WnCQet0FN13/hQ5sXdige9ssjfliYjhsxVNa68J3rYC+xT8l lCIL7pRgSjQcX9arJiywxb+vmEJd9CxgI2fWrWBj9wErnTDZ9uFIL0dFWdm0aclzDi c9XNUwEYpELORBO0Tyd+epQ3n9YMWV94CtuWz11E= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Thu, 9 Sep 2021 17:08:59 +0900 Message-Id: <20210909080902.239533-5-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210909080902.239533-1-paul.elder@ideasonboard.com> References: <20210909080902.239533-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 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 Reviewed-by: Jean-Michel Hautbois --- include/libcamera/internal/v4l2_pixelformat.h | 1 + src/libcamera/v4l2_pixelformat.cpp | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/include/libcamera/internal/v4l2_pixelformat.h b/include/libcamera/internal/v4l2_pixelformat.h index 87872542..e3cda699 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 *description() 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 2c8167a7..fed31238 100644 --- a/src/libcamera/v4l2_pixelformat.cpp +++ b/src/libcamera/v4l2_pixelformat.cpp @@ -250,6 +250,27 @@ std::string V4L2PixelFormat::toString() const return ss; } +/** + * \brief Retrieve the V4L2 description for the format + * + * The description matches the value used by the kernel, as would be reported + * by the VIDIOC_ENUM_FMT ioctl. + * + * \return The V4L2 description corresponding to the V4L2 format + */ +const char *V4L2PixelFormat::description() const +{ + const auto iter = vpf2pf.find(*this); + if (iter == vpf2pf.end()) { + LOG(V4L2, Warning) + << "Unsupported V4L2 pixel format " + << toString(); + return "Unsupported format"; + } + + return iter->second.description; +} + /** * \brief Convert the V4L2 pixel format to the corresponding PixelFormat * \return The PixelFormat corresponding to the V4L2 pixel format From patchwork Thu Sep 9 08:09:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 13776 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 8025CBDC71 for ; Thu, 9 Sep 2021 08:09:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3F23869177; Thu, 9 Sep 2021 10:09:25 +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="DAs6J6So"; 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 4B9506916A for ; Thu, 9 Sep 2021 10:09:23 +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 C905D883; Thu, 9 Sep 2021 10:09:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1631174963; bh=QysgIK5Sl6jafgrOuXAafwucD89COeuu3iCcGYtJ2kM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DAs6J6SozbNQgeDKPpOwTPLPdaOFd7iXvyFnAkCipluunRJ748HGS+FWAXJD6ztTY UWFiIQDpWZHRUMjudSGgK8E0XKD2Kw2s8MxAQQzTjoLooYnt4+8teV9k3wunSNPs31 pNsx/K5TnqJxpN5vx46P+WMKQ19F+o6wkdVGdSWA= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Thu, 9 Sep 2021 17:09:00 +0900 Message-Id: <20210909080902.239533-6-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210909080902.239533-1-paul.elder@ideasonboard.com> References: <20210909080902.239533-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 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 Reviewed-by: Jean-Michel Hautbois --- 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..abb30820 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]; + 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.description(), sizeof(arg->description)); + arg->pixelformat = v4l2Format; memset(arg->reserved, 0, sizeof(arg->reserved)); From patchwork Thu Sep 9 08:09:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 13777 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 D1F1DBDC71 for ; Thu, 9 Sep 2021 08:09:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9D37D69175; Thu, 9 Sep 2021 10:09:26 +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="Knqmtd8X"; 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 168866916A for ; Thu, 9 Sep 2021 10:09:25 +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 992B824F; Thu, 9 Sep 2021 10:09:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1631174964; bh=iFPFSSZyX+1wIG96rnLR/RY21bSWy/RoaWuFI9HmG2E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Knqmtd8X7lRcYKuOO603bUtCOPvye7AoX88+MopgOb5dTjUfkS7HoTV2BNwEUCyko YiE7whN4qMdIbQUCbDORVkDgWonXVdvfM1tkR1jT869hqqIG0nzuV56xcm9SmKJYhH 5/lAsy5nSQDPl8xMSc+91NAmajuOEA2PPJ/y5XIE= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Thu, 9 Sep 2021 17:09:01 +0900 Message-Id: <20210909080902.239533-7-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210909080902.239533-1-paul.elder@ideasonboard.com> References: <20210909080902.239533-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 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 Reviewed-by: Jean-Michel Hautbois --- 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 abb30820..3610e63c 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]; 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.description(), sizeof(arg->description)); arg->pixelformat = v4l2Format; From patchwork Thu Sep 9 08:09:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 13778 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 4745DBDC71 for ; Thu, 9 Sep 2021 08:09:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F232E6916F; Thu, 9 Sep 2021 10:09:28 +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="vzt/JEJY"; 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 243D46916A for ; Thu, 9 Sep 2021 10:09:28 +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 69A2B24F; Thu, 9 Sep 2021 10:09:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1631174966; bh=h1yQazzvczXDSFiptddBzYZaEVPm0ehcDiNNS8tiw58=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vzt/JEJYq4ACKomLn6WvrN2gU8XdDiwq9I/II+0O5pHgeAdna0lqxdQo+UmtHRqyo ebE0HaEeLr7EoreKf3ljEsh4YqlB9QwN1YndimqOId8jIZvCtqTJ3bDRpURrlJJZdD VcPAm6njoyhlyHmCOodM8NIHh+gQiB6dRe9Lin04= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Thu, 9 Sep 2021 17:09:02 +0900 Message-Id: <20210909080902.239533-8-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210909080902.239533-1-paul.elder@ideasonboard.com> References: <20210909080902.239533-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 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