From patchwork Tue Sep 8 07:36:38 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 28198 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 4B91DC3273 for ; Tue, 8 Sep 2026 07:36:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DA1F268616; Tue, 8 Sep 2026 09:36:47 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="IvdXudq3"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 364CA68613 for ; Tue, 8 Sep 2026 09:36:44 +0200 (CEST) Received: from pb-laptop.local (185.221.140.18.nat.pool.zt.hu [185.221.140.18]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4C537447 for ; Tue, 8 Sep 2026 09:35:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1788852908; bh=L+XbzB+vNjQDFeTSdQ3McI319JBzcYVPsIHVLZWYKqg=; h=From:To:Subject:Date:From; b=IvdXudq3F3BmlMU+ox8ksdhmkpWvpzpl0PDc6j2Qsygc9HIcvKWvibYm0fQPgyR51 dway78wcLHxbunj3RZ3zIQK8pQCMYONw/220xb4fVhbxYXKPcSP7gMf+OQBgxpmR7Y rAi7w3YYHVW4SbJ1qmtuw1bwPgo6JEmi17I6OJcg= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [PATCH v1 1/3] libcamera: v4l2_videodevice: V4L2DeviceFormat: Expand formatting Date: Tue, 8 Sep 2026 09:36:38 +0200 Message-ID: <20260908073640.39654-1-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.55.0 MIME-Version: 1.0 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" Currently, only the size, the pixel format, and the color space is included when a `V4L2DeviceFormat` is formatted into a stream. Print the data about the planes as well (size and bytes-per-line), as it can immensely help debugging if it is readily available in the log. Example: 640x480-YUYV[614400/1280]/Rec709/Rec709/Rec601/Limited where the / pairs are printed inside the "[]" separated by ':'. Signed-off-by: Barnabás Pőcze Reviewed-by: Kieran Bingham --- src/libcamera/v4l2_videodevice.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index 41dc5d0f65..bc539884e5 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -447,8 +447,19 @@ std::string V4L2DeviceFormat::toString() const */ std::ostream &operator<<(std::ostream &out, const V4L2DeviceFormat &f) { - out << f.size << "-" << f.fourcc << "/" - << ColorSpace::toString(f.colorSpace); + out << f.size << '-' << f.fourcc << '['; + + for (size_t i = 0; i < f.planesCount; i++) { + const auto &p = f.planes[i]; + + out << p.size << '/' << p.bpl; + + if (i + 1 < f.planesCount) + out << ':'; + } + + out << "]/" << ColorSpace::toString(f.colorSpace); + return out; } From patchwork Tue Sep 8 07:36:39 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 28197 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 100AAC3257 for ; Tue, 8 Sep 2026 07:36:48 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 93EE568620; Tue, 8 Sep 2026 09:36:46 +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="DgF9P1Xu"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1A368685D7 for ; Tue, 8 Sep 2026 09:36:44 +0200 (CEST) Received: from pb-laptop.local (185.221.140.18.nat.pool.zt.hu [185.221.140.18]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 82848C13 for ; Tue, 8 Sep 2026 09:35:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1788852908; bh=XitR50jVsz+tEh4uSFjdob3gm0RBbKKqjTlYZ/gQzdk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=DgF9P1Xuzi32TXDBLETnd83z+Cjlug3C5kc38cR55iQ6Hnaf6qSmPLLeoZIcqGB8S 6nnvnQahMKuygI0dlD1Z7vkHrB0epvi5y90b01rNWBjai9h3F+0Qhk4X5pymgyG7ab +Oh+OyQqKV193yDlHx+jDAh24JsNdikIAk+ti0zA= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [PATCH v1 2/3] libcamera: v4l2_videodevice: {get, set, try}Format(): Log format Date: Tue, 8 Sep 2026 09:36:39 +0200 Message-ID: <20260908073640.39654-2-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260908073640.39654-1-barnabas.pocze@ideasonboard.com> References: <20260908073640.39654-1-barnabas.pocze@ideasonboard.com> MIME-Version: 1.0 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" These functions have not been logging the v4l2 formats that they receive and the ones that the device actually returns. This makes debugging much more difficult. And multiple pipeline handlers work around this by adding logging around `setFormat()` calls, but those can be missed, and they don't necessarily include the path of the device node. So add these log messages into the `{get,set,try}Format()` methods themselves. Example: DEBUG V4L2 v4l2_videodevice.cpp:859 /dev/video0[13:cap]: trying format: 640x480-YUYV[]/Unset DEBUG V4L2 v4l2_videodevice.cpp:882 /dev/video0[13:cap]: returned format: 640x480-YUYV[614400/1280]/Rec709/Rec709/Rec601/Limited Signed-off-by: Barnabás Pőcze Reviewed-by: Kieran Bingham --- src/libcamera/v4l2_videodevice.cpp | 48 +++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index bc539884e5..ea6270fdf2 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -814,19 +814,32 @@ std::string V4L2VideoDevice::logPrefix() const */ int V4L2VideoDevice::getFormat(V4L2DeviceFormat *format) { + int ret; + switch (bufferType_) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: case V4L2_BUF_TYPE_VIDEO_OUTPUT: - return getFormatSingleplane(format); + ret = getFormatSingleplane(format); + break; case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: - return getFormatMultiplane(format); + ret = getFormatMultiplane(format); + break; case V4L2_BUF_TYPE_META_CAPTURE: case V4L2_BUF_TYPE_META_OUTPUT: - return getFormatMeta(format); + ret = getFormatMeta(format); + break; default: - return -EINVAL; + ret = -EINVAL; + break; } + + if (ret) + return ret; + + LOG(V4L2, Debug) << "returned format: " << *format; + + return 0; } /** @@ -841,19 +854,34 @@ int V4L2VideoDevice::getFormat(V4L2DeviceFormat *format) */ int V4L2VideoDevice::tryFormat(V4L2DeviceFormat *format) { + int ret; + + LOG(V4L2, Debug) << "trying format: " << *format; + switch (bufferType_) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: case V4L2_BUF_TYPE_VIDEO_OUTPUT: - return trySetFormatSingleplane(format, false); + ret = trySetFormatSingleplane(format, false); + break; case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: - return trySetFormatMultiplane(format, false); + ret = trySetFormatMultiplane(format, false); + break; case V4L2_BUF_TYPE_META_CAPTURE: case V4L2_BUF_TYPE_META_OUTPUT: - return trySetFormatMeta(format, false); + ret = trySetFormatMeta(format, false); + break; default: - return -EINVAL; + ret = -EINVAL; + break; } + + if (ret) + return ret; + + LOG(V4L2, Debug) << "returned format: " << *format; + + return 0; } /** @@ -869,6 +897,8 @@ int V4L2VideoDevice::setFormat(V4L2DeviceFormat *format) { int ret; + LOG(V4L2, Debug) << "setting format: " << *format; + switch (bufferType_) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: case V4L2_BUF_TYPE_VIDEO_OUTPUT: @@ -894,6 +924,8 @@ int V4L2VideoDevice::setFormat(V4L2DeviceFormat *format) format_ = *format; formatInfo_ = &PixelFormatInfo::info(format_.fourcc); + LOG(V4L2, Debug) << "returned format: " << *format; + return 0; } From patchwork Tue Sep 8 07:36:40 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 28199 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 5DB51C3350 for ; Tue, 8 Sep 2026 07:36:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B35876861D; Tue, 8 Sep 2026 09:36:48 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="O2ckMceV"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 733E168614 for ; Tue, 8 Sep 2026 09:36:44 +0200 (CEST) Received: from pb-laptop.local (185.221.140.18.nat.pool.zt.hu [185.221.140.18]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B80F1C64 for ; Tue, 8 Sep 2026 09:35:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1788852908; bh=vuga/jCLT6Wh7gIphFnLuL4G4p1GqKTA7CXtOV57UrA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=O2ckMceV5TpTv5L5Dwj6ns1z5niLN+cemxVinUajVDa/97u0vobNFQrO12pIbygm1 f4r94I7CqqwQAdU4VY2AYUUQvVEMUfsx9X7eWwD6DtGVFfKJtuZ+hAvBM7BnQN7BcA nqo+ar5HBoT2K3qPIcNdazY6VcaWtv2cff1DQdWA= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [PATCH v1 3/3] libcamera: stream: StreamConfiguration: Adjust formatting Date: Tue, 8 Sep 2026 09:36:40 +0200 Message-ID: <20260908073640.39654-3-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260908073640.39654-1-barnabas.pocze@ideasonboard.com> References: <20260908073640.39654-1-barnabas.pocze@ideasonboard.com> MIME-Version: 1.0 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" Adjust the formatting of how a `StreamConfiguration` is formatted to a stream. Specifically, print the `frameSize` and `stride` members in a format similar to how it is done for `V4L2DeviceFormat`. Example: configuring streams: (0) 640x480-YUYV[614400/1280]/Rec709/Rec709/Rec601/Limited Signed-off-by: Barnabás Pőcze Reviewed-by: Kieran Bingham --- src/libcamera/stream.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp index be0c80cbcf..af730ff8a5 100644 --- a/src/libcamera/stream.cpp +++ b/src/libcamera/stream.cpp @@ -407,8 +407,9 @@ std::string StreamConfiguration::toString() const */ std::ostream &operator<<(std::ostream &out, const StreamConfiguration &cfg) { - out << cfg.size << "-" << cfg.pixelFormat << "/" - << ColorSpace::toString(cfg.colorSpace); + out << cfg.size << '-' << cfg.pixelFormat + << '[' << cfg.frameSize << '/' << cfg.stride << ']' + << '/' << ColorSpace::toString(cfg.colorSpace); return out; }