[libcamera-devel,v3,08/22] libcamera: pipeline: rkisp1: Set the crop rectangle

Message ID 20200925014207.1455796-9-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. 25, 2020, 1:41 a.m. UTC
Changing resolutions back and forth can provoke the crop rectangle to go
out of sync, set it as part of format configuration.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
* Changes since v2
- Fix s/port/part/ in commit message.
---
 src/libcamera/pipeline/rkisp1/rkisp1.cpp | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Jacopo Mondi Sept. 25, 2020, 2:28 p.m. UTC | #1
Hi Niklas,

On Fri, Sep 25, 2020 at 03:41:53AM +0200, Niklas Söderlund wrote:
> Changing resolutions back and forth can provoke the crop rectangle to go
> out of sync, set it as part of format configuration.

Is there any dependency on the kernel version ?

Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
   j

>
> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> * Changes since v2
> - Fix s/port/part/ in commit message.
> ---
>  src/libcamera/pipeline/rkisp1/rkisp1.cpp | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> index 27191b18c989aa5e..2f70bf2220fa5c84 100644
> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> @@ -629,6 +629,11 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)
>  	if (ret < 0)
>  		return ret;
>
> +	Rectangle rect(0, 0, format.size);
> +	ret = isp_->setSelection(0, V4L2_SEL_TGT_CROP, &rect);
> +	if (ret < 0)
> +		return ret;
> +
>  	LOG(RkISP1, Debug) << "ISP input pad configured with " << format.toString();
>
>  	/* YUYV8_2X8 is required on the ISP source path pad for YUV output. */
> --
> 2.28.0
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Niklas Söderlund Sept. 25, 2020, 4:25 p.m. UTC | #2
Hi Jacopo,

On 2020-09-25 16:28:14 +0200, Jacopo Mondi wrote:
> Hi Niklas,
> 
> On Fri, Sep 25, 2020 at 03:41:53AM +0200, Niklas Söderlund wrote:
> > Changing resolutions back and forth can provoke the crop rectangle to go
> > out of sync, set it as part of format configuration.
> 
> Is there any dependency on the kernel version ?

Not more then is mentioned in the cover-letter. But without those 
patches capture is not possible at all.

> 
> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
> 
> Thanks
>    j
> 
> >
> > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> > * Changes since v2
> > - Fix s/port/part/ in commit message.
> > ---
> >  src/libcamera/pipeline/rkisp1/rkisp1.cpp | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> > index 27191b18c989aa5e..2f70bf2220fa5c84 100644
> > --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> > +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> > @@ -629,6 +629,11 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)
> >  	if (ret < 0)
> >  		return ret;
> >
> > +	Rectangle rect(0, 0, format.size);
> > +	ret = isp_->setSelection(0, V4L2_SEL_TGT_CROP, &rect);
> > +	if (ret < 0)
> > +		return ret;
> > +
> >  	LOG(RkISP1, Debug) << "ISP input pad configured with " << format.toString();
> >
> >  	/* YUYV8_2X8 is required on the ISP source path pad for YUV output. */
> > --
> > 2.28.0
> >
> > _______________________________________________
> > libcamera-devel mailing list
> > libcamera-devel@lists.libcamera.org
> > https://lists.libcamera.org/listinfo/libcamera-devel

Patch

diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 27191b18c989aa5e..2f70bf2220fa5c84 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -629,6 +629,11 @@  int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)
 	if (ret < 0)
 		return ret;
 
+	Rectangle rect(0, 0, format.size);
+	ret = isp_->setSelection(0, V4L2_SEL_TGT_CROP, &rect);
+	if (ret < 0)
+		return ret;
+
 	LOG(RkISP1, Debug) << "ISP input pad configured with " << format.toString();
 
 	/* YUYV8_2X8 is required on the ISP source path pad for YUV output. */