[v2,2/2] lc-compliance: Ensure stream's colorspace is set after validate()
diff mbox series

Message ID 20250701112922.62285-3-uajain@igalia.com
State New
Headers show
Series
  • lc-compliance: Ensure stream's colorspace is set after validate()
Related show

Commit Message

Umang Jain July 1, 2025, 11:29 a.m. UTC
StreamConfiguration::colorspace is a std::optional<> and if unset by
the user, it should be populated by the pipeline handler after the
CameraConfiguration::validate().

Add a EXPECT_TRUE() check to ensure that each stream in the
CameraConfiguration has a colorspace set.

Signed-off-by: Umang Jain <uajain@igalia.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 src/apps/lc-compliance/helpers/capture.cpp | 3 +++
 1 file changed, 3 insertions(+)

Comments

Kieran Bingham July 10, 2025, 7:46 a.m. UTC | #1
Quoting Umang Jain (2025-07-01 12:29:22)
> StreamConfiguration::colorspace is a std::optional<> and if unset by
> the user, it should be populated by the pipeline handler after the
> CameraConfiguration::validate().
> 
> Add a EXPECT_TRUE() check to ensure that each stream in the
> CameraConfiguration has a colorspace set.
> 
> Signed-off-by: Umang Jain <uajain@igalia.com>
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

From Robert, for Patchwork:

Tested-by: Robert Mader <robert.mader@collabora.com>

> ---
>  src/apps/lc-compliance/helpers/capture.cpp | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/apps/lc-compliance/helpers/capture.cpp b/src/apps/lc-compliance/helpers/capture.cpp
> index 2a3fa3b6..e767e45e 100644
> --- a/src/apps/lc-compliance/helpers/capture.cpp
> +++ b/src/apps/lc-compliance/helpers/capture.cpp
> @@ -52,6 +52,9 @@ void Capture::configure(libcamera::Span<const libcamera::StreamRole> roles)
>                 FAIL() << "Configuration not valid";
>         }
>  
> +       for (auto &cfg : *config_)
> +               EXPECT_TRUE(cfg.colorSpace) << cfg << " - colorspace not set.";
> +
>         if (camera_->configure(config_.get())) {
>                 config_.reset();
>                 FAIL() << "Failed to configure camera";
> -- 
> 2.50.0
>
Barnabás Pőcze July 14, 2025, 10 a.m. UTC | #2
Hi

I believe the usual prefix is "apps: lc-compliance: ".

2025. 07. 01. 13:29 keltezéssel, Umang Jain írta:
> StreamConfiguration::colorspace is a std::optional<> and if unset by
> the user, it should be populated by the pipeline handler after the
> CameraConfiguration::validate().
> 
> Add a EXPECT_TRUE() check to ensure that each stream in the
> CameraConfiguration has a colorspace set.
> 
> Signed-off-by: Umang Jain <uajain@igalia.com>
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> ---
>   src/apps/lc-compliance/helpers/capture.cpp | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/src/apps/lc-compliance/helpers/capture.cpp b/src/apps/lc-compliance/helpers/capture.cpp
> index 2a3fa3b6..e767e45e 100644
> --- a/src/apps/lc-compliance/helpers/capture.cpp
> +++ b/src/apps/lc-compliance/helpers/capture.cpp
> @@ -52,6 +52,9 @@ void Capture::configure(libcamera::Span<const libcamera::StreamRole> roles)
>   		FAIL() << "Configuration not valid";
>   	}
>   
> +	for (auto &cfg : *config_)

   const auto &


> +		EXPECT_TRUE(cfg.colorSpace) << cfg << " - colorspace not set.";

Could you remove the period at the end? Other message don't have it. And I would
probably print `cfg` at the end, i.e. `"Color space not set for stream: " << cfg;`

Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>


Regards,
Barnabás Pőcze



> +
>   	if (camera_->configure(config_.get())) {
>   		config_.reset();
>   		FAIL() << "Failed to configure camera";
Barnabás Pőcze July 14, 2025, 10:20 a.m. UTC | #3
Hi

2025. 07. 01. 13:29 keltezéssel, Umang Jain írta:
> StreamConfiguration::colorspace is a std::optional<> and if unset by
> the user, it should be populated by the pipeline handler after the
> CameraConfiguration::validate().

The documentation of `StreamConfiguration::colorSpace` states:

/**
  * \var StreamConfiguration::colorSpace
  * \brief The ColorSpace for this stream
  *
  * This field allows a ColorSpace to be selected for this Stream.
  *
  * The field is optional and an application can choose to leave it unset.
  * Platforms that support the use of color spaces may provide default
  * values through the generateConfiguration() method. An application can
  * override these when necessary.
  *
  * [...]
  */

I feel that the text allows pipeline handlers to leave it unset. If this
has changed, this documentation should be adjusted, same applies to the
pipeline handler writers' guide.


Regards,
Barnabás Pőcze



> 
> Add a EXPECT_TRUE() check to ensure that each stream in the
> CameraConfiguration has a colorspace set.
> 
> Signed-off-by: Umang Jain <uajain@igalia.com>
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> ---
>   src/apps/lc-compliance/helpers/capture.cpp | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/src/apps/lc-compliance/helpers/capture.cpp b/src/apps/lc-compliance/helpers/capture.cpp
> index 2a3fa3b6..e767e45e 100644
> --- a/src/apps/lc-compliance/helpers/capture.cpp
> +++ b/src/apps/lc-compliance/helpers/capture.cpp
> @@ -52,6 +52,9 @@ void Capture::configure(libcamera::Span<const libcamera::StreamRole> roles)
>   		FAIL() << "Configuration not valid";
>   	}
>   
> +	for (auto &cfg : *config_)
> +		EXPECT_TRUE(cfg.colorSpace) << cfg << " - colorspace not set.";
> +
>   	if (camera_->configure(config_.get())) {
>   		config_.reset();
>   		FAIL() << "Failed to configure camera";

Patch
diff mbox series

diff --git a/src/apps/lc-compliance/helpers/capture.cpp b/src/apps/lc-compliance/helpers/capture.cpp
index 2a3fa3b6..e767e45e 100644
--- a/src/apps/lc-compliance/helpers/capture.cpp
+++ b/src/apps/lc-compliance/helpers/capture.cpp
@@ -52,6 +52,9 @@  void Capture::configure(libcamera::Span<const libcamera::StreamRole> roles)
 		FAIL() << "Configuration not valid";
 	}
 
+	for (auto &cfg : *config_)
+		EXPECT_TRUE(cfg.colorSpace) << cfg << " - colorspace not set.";
+
 	if (camera_->configure(config_.get())) {
 		config_.reset();
 		FAIL() << "Failed to configure camera";