[libcamera-devel,v2,06/13] libcamera: pipeline: rkisp1: Export stream formats to applications

Message ID 20200914142149.63857-7-niklas.soderlund@ragnatech.se
State Accepted
Headers show
Series
  • libcamera: pipeline: rkisp1: Extend to support two streams
Related show

Commit Message

Niklas Söderlund Sept. 14, 2020, 2:21 p.m. UTC
The information about stream format is available but not exported to
applications, fix this.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
---
* Changes since v1
- Fix s/applicaitons/applications/ in subject
- Cap the max resolution reported to the sensor resolution.
---
 src/libcamera/pipeline/rkisp1/rkisp1.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Laurent Pinchart Sept. 15, 2020, 12:43 a.m. UTC | #1
Hi Niklas,

Thank you for the patch.

On Mon, Sep 14, 2020 at 04:21:42PM +0200, Niklas Söderlund wrote:
> The information about stream format is available but not exported to
> applications, fix this.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> ---
> * Changes since v1
> - Fix s/applicaitons/applications/ in subject
> - Cap the max resolution reported to the sensor resolution.

I really like how you provide per-patch changelogs, it clearly helps
during review. Thank you.

> ---
>  src/libcamera/pipeline/rkisp1/rkisp1.cpp | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> index e3802c76003268f6..a6cb16c0638f8d85 100644
> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> @@ -587,7 +587,13 @@ CameraConfiguration *PipelineHandlerRkISP1::generateConfiguration(Camera *camera
>  	if (roles.empty())
>  		return config;
>  
> -	StreamConfiguration cfg{};
> +	std::map<PixelFormat, std::vector<SizeRange>> streamFormats;
> +	for (const PixelFormat &format : RKISP1_RSZ_MP_FORMATS)
> +		streamFormats[format] =
> +			{ { RKISP1_RSZ_MP_SRC_MIN, data->sensor_->resolution() } };

This assumes that the sensor resolution is larger than 32x16, but I
think that's fine :-)

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> +
> +	StreamFormats formats(streamFormats);
> +	StreamConfiguration cfg(formats);
>  	cfg.pixelFormat = formats::NV12;
>  	cfg.size = data->sensor_->resolution();
>

Patch

diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index e3802c76003268f6..a6cb16c0638f8d85 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -587,7 +587,13 @@  CameraConfiguration *PipelineHandlerRkISP1::generateConfiguration(Camera *camera
 	if (roles.empty())
 		return config;
 
-	StreamConfiguration cfg{};
+	std::map<PixelFormat, std::vector<SizeRange>> streamFormats;
+	for (const PixelFormat &format : RKISP1_RSZ_MP_FORMATS)
+		streamFormats[format] =
+			{ { RKISP1_RSZ_MP_SRC_MIN, data->sensor_->resolution() } };
+
+	StreamFormats formats(streamFormats);
+	StreamConfiguration cfg(formats);
 	cfg.pixelFormat = formats::NV12;
 	cfg.size = data->sensor_->resolution();