libcamera: v4l2_videodevice: Add color space to format string representation
diff mbox series

Message ID 20250723223907.23698-1-laurent.pinchart@ideasonboard.com
State New
Headers show
Series
  • libcamera: v4l2_videodevice: Add color space to format string representation
Related show

Commit Message

Laurent Pinchart July 23, 2025, 10:39 p.m. UTC
To debug color issues in a pipeline it is necessary to know the color
space used. Therefore add the color space to the string representation
of V4L2DeviceFormat that is returned by toString() and operator<<(). The
format gets for example printed as

[0:05:52.981684000] [230] DEBUG RkISP1 rkisp1_path.cpp:468 Configured main resizer video device with 1920x1080-NV12/sYCC

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/v4l2_videodevice.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


base-commit: b65df7e7554b45e2d3d7fdb5b37c2ab7df3db4fe
--
Regards,

Laurent Pinchart

Comments

Umang Jain July 24, 2025, 3:20 a.m. UTC | #1
On Thu, Jul 24, 2025 at 01:39:07AM +0300, Laurent Pinchart wrote:
> To debug color issues in a pipeline it is necessary to know the color
> space used. Therefore add the color space to the string representation
> of V4L2DeviceFormat that is returned by toString() and operator<<(). The
> format gets for example printed as
> 
> [0:05:52.981684000] [230] DEBUG RkISP1 rkisp1_path.cpp:468 Configured main resizer video device with 1920x1080-NV12/sYCC
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

LGTM,

Reviewed-by: Umang Jain <uajain@igalia.com>

> ---
>  src/libcamera/v4l2_videodevice.cpp | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
> index 76bdad40ca8d..71cc7e895d8c 100644
> --- a/src/libcamera/v4l2_videodevice.cpp
> +++ b/src/libcamera/v4l2_videodevice.cpp
> @@ -446,7 +446,8 @@ const std::string V4L2DeviceFormat::toString() const
>   */
>  std::ostream &operator<<(std::ostream &out, const V4L2DeviceFormat &f)
>  {
> -	out << f.size << "-" << f.fourcc;
> +	out << f.size << "-" << f.fourcc << "/"
> +	    << ColorSpace::toString(f.colorSpace);
>  	return out;
>  }
> 
> 
> base-commit: b65df7e7554b45e2d3d7fdb5b37c2ab7df3db4fe
> --
> Regards,
> 
> Laurent Pinchart
>
Paul Elder July 24, 2025, 7:04 a.m. UTC | #2
Quoting Laurent Pinchart (2025-07-24 07:39:07)
> To debug color issues in a pipeline it is necessary to know the color
> space used. Therefore add the color space to the string representation
> of V4L2DeviceFormat that is returned by toString() and operator<<(). The
> format gets for example printed as
> 
> [0:05:52.981684000] [230] DEBUG RkISP1 rkisp1_path.cpp:468 Configured main resizer video device with 1920x1080-NV12/sYCC
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  src/libcamera/v4l2_videodevice.cpp | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
> index 76bdad40ca8d..71cc7e895d8c 100644
> --- a/src/libcamera/v4l2_videodevice.cpp
> +++ b/src/libcamera/v4l2_videodevice.cpp
> @@ -446,7 +446,8 @@ const std::string V4L2DeviceFormat::toString() const
>   */
>  std::ostream &operator<<(std::ostream &out, const V4L2DeviceFormat &f)
>  {
> -       out << f.size << "-" << f.fourcc;
> +       out << f.size << "-" << f.fourcc << "/"
> +           << ColorSpace::toString(f.colorSpace);
>         return out;
>  }
> 
> 
> base-commit: b65df7e7554b45e2d3d7fdb5b37c2ab7df3db4fe
> --
> Regards,
> 
> Laurent Pinchart
>
Kieran Bingham July 24, 2025, 7:40 a.m. UTC | #3
Quoting Laurent Pinchart (2025-07-23 23:39:07)
> To debug color issues in a pipeline it is necessary to know the color
> space used. Therefore add the color space to the string representation
> of V4L2DeviceFormat that is returned by toString() and operator<<(). The
> format gets for example printed as
> 
> [0:05:52.981684000] [230] DEBUG RkISP1 rkisp1_path.cpp:468 Configured main resizer video device with 1920x1080-NV12/sYCC

I was about to say ... but we already did this ... and now I see this is
the V4L2Device, and we've only extended the V4L2SubDevice so aligning
both with this definitely helps.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  src/libcamera/v4l2_videodevice.cpp | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
> index 76bdad40ca8d..71cc7e895d8c 100644
> --- a/src/libcamera/v4l2_videodevice.cpp
> +++ b/src/libcamera/v4l2_videodevice.cpp
> @@ -446,7 +446,8 @@ const std::string V4L2DeviceFormat::toString() const
>   */
>  std::ostream &operator<<(std::ostream &out, const V4L2DeviceFormat &f)
>  {
> -       out << f.size << "-" << f.fourcc;
> +       out << f.size << "-" << f.fourcc << "/"
> +           << ColorSpace::toString(f.colorSpace);
>         return out;
>  }
> 
> 
> base-commit: b65df7e7554b45e2d3d7fdb5b37c2ab7df3db4fe
> --
> Regards,
> 
> Laurent Pinchart
>

Patch
diff mbox series

diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
index 76bdad40ca8d..71cc7e895d8c 100644
--- a/src/libcamera/v4l2_videodevice.cpp
+++ b/src/libcamera/v4l2_videodevice.cpp
@@ -446,7 +446,8 @@  const std::string V4L2DeviceFormat::toString() const
  */
 std::ostream &operator<<(std::ostream &out, const V4L2DeviceFormat &f)
 {
-	out << f.size << "-" << f.fourcc;
+	out << f.size << "-" << f.fourcc << "/"
+	    << ColorSpace::toString(f.colorSpace);
 	return out;
 }