[libcamera-devel,3/3] libcamera: pipeline: ipu3: Use parameterized StreamConfiguration

Message ID 20200323232901.29169-4-kgupta@es.iitr.ac.in
State Superseded
Headers show
Series
  • Use StreamFormats in pipelines
Related show

Commit Message

Kaaira Gupta March 23, 2020, 11:29 p.m. UTC
Replace default constructor StreamConfiguration() by it's parameterized
counterpart  by using StreamFormats in generateConfiguration() in
ipu3.

Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
---
 src/libcamera/pipeline/ipu3/ipu3.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Jacopo Mondi March 24, 2020, 8:16 a.m. UTC | #1
Hi Kaaira

On Tue, Mar 24, 2020 at 04:59:01AM +0530, Kaaira Gupta wrote:
> Replace default constructor StreamConfiguration() by it's parameterized
> counterpart  by using StreamFormats in generateConfiguration() in
             ^ nit: double space

> ipu3.
>
> Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
> ---
>  src/libcamera/pipeline/ipu3/ipu3.cpp | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
> index 7feb44c..fe25cab 100644
> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> @@ -400,9 +400,17 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,
>  	};
>
>  	config = new IPU3CameraConfiguration(camera, data);
> +	std::map<PixelFormat, std::vector<SizeRange>> pixelformats;
> +
> +	/*
> +	 * The driver supports only one pixel format.
> +	 * Size range is kept maximum.

Seems like you are constructing a SizeRange with a single size, not a
range :(

And the IPU3 supports a larger resolution than this, I'm sure :)

> +	 */
> +	pixelformats[PixelFormat(DRM_FORMAT_NV12)] = {SizeRange{{ 2560, 1920 }}};
>
>  	for (const StreamRole role : roles) {
> -		StreamConfiguration cfg = {};
> +		StreamFormats format(pixelformats);
> +		StreamConfiguration cfg(format);
>  		IPU3Stream *stream = nullptr;
>
>  		cfg.pixelFormat = PixelFormat(DRM_FORMAT_NV12);
> --
> 2.17.1
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Kaaira Gupta March 24, 2020, 1:22 p.m. UTC | #2
On Tue, Mar 24, 2020 at 04:59:01AM +0530, Kaaira Gupta wrote:
> Replace default constructor StreamConfiguration() by it's parameterized
> counterpart  by using StreamFormats in generateConfiguration() in
> ipu3.
> 
> Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
> ---
>  src/libcamera/pipeline/ipu3/ipu3.cpp | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
> index 7feb44c..fe25cab 100644
> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> @@ -400,9 +400,17 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,
>  	};
>  
>  	config = new IPU3CameraConfiguration(camera, data);
> +	std::map<PixelFormat, std::vector<SizeRange>> pixelformats;
> +
> +	/*
> +	 * The driver supports only one pixel format.
> +	 * Size range is kept maximum.

I did not get the reply in my mailbox, hence I'll ask the question in
reply to this :D
jmondi: I passed a single size because the validate() uses a single size
as well..which is the maximum height and width..as ipu3 can only
downscale.

Also, if this isn't the maximum, how do I find out what is?

> +	 */
> +	pixelformats[PixelFormat(DRM_FORMAT_NV12)] = {SizeRange{{ 2560, 1920 }}};
>  
>  	for (const StreamRole role : roles) {
> -		StreamConfiguration cfg = {};
> +		StreamFormats format(pixelformats);
> +		StreamConfiguration cfg(format);
>  		IPU3Stream *stream = nullptr;
>  
>  		cfg.pixelFormat = PixelFormat(DRM_FORMAT_NV12);
> -- 
> 2.17.1
>

Patch

diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 7feb44c..fe25cab 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -400,9 +400,17 @@  CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,
 	};
 
 	config = new IPU3CameraConfiguration(camera, data);
+	std::map<PixelFormat, std::vector<SizeRange>> pixelformats;
+
+	/*
+	 * The driver supports only one pixel format.
+	 * Size range is kept maximum.
+	 */
+	pixelformats[PixelFormat(DRM_FORMAT_NV12)] = {SizeRange{{ 2560, 1920 }}};
 
 	for (const StreamRole role : roles) {
-		StreamConfiguration cfg = {};
+		StreamFormats format(pixelformats);
+		StreamConfiguration cfg(format);
 		IPU3Stream *stream = nullptr;
 
 		cfg.pixelFormat = PixelFormat(DRM_FORMAT_NV12);