[v1,25/33] libcamera: internal: camera_sensor: Add accessor for mountingOrientation_
diff mbox series

Message ID 20250930122726.1837524-26-stefan.klug@ideasonboard.com
State New
Headers show
Series
  • Full dewarper support on imx8mp
Related show

Commit Message

Stefan Klug Sept. 30, 2025, 12:26 p.m. UTC
To properly handle the orientation in the dewarper, the mounting
orientation of the sensor needs to be queryable. Add that.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
---
 include/libcamera/internal/camera_sensor.h    | 1 +
 src/libcamera/sensor/camera_sensor_legacy.cpp | 1 +
 src/libcamera/sensor/camera_sensor_raw.cpp    | 1 +
 3 files changed, 3 insertions(+)

Comments

Kieran Bingham Sept. 30, 2025, 1:41 p.m. UTC | #1
Quoting Stefan Klug (2025-09-30 13:26:46)
> To properly handle the orientation in the dewarper, the mounting
> orientation of the sensor needs to be queryable. Add that.
> 
> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> ---
>  include/libcamera/internal/camera_sensor.h    | 1 +
>  src/libcamera/sensor/camera_sensor_legacy.cpp | 1 +
>  src/libcamera/sensor/camera_sensor_raw.cpp    | 1 +
>  3 files changed, 3 insertions(+)
> 
> diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h
> index f6ef4df170d4..e6b72d22ac21 100644
> --- a/include/libcamera/internal/camera_sensor.h
> +++ b/include/libcamera/internal/camera_sensor.h
> @@ -73,6 +73,7 @@ public:
>         virtual int sensorInfo(IPACameraSensorInfo *info) const = 0;
>         virtual Transform computeTransform(Orientation *orientation) const = 0;
>         virtual BayerFormat::Order bayerOrder(Transform t) const = 0;
> +       virtual Orientation mountingOrientation() const = 0;
>  
>         virtual const ControlInfoMap &controls() const = 0;
>         virtual ControlList getControls(Span<const uint32_t> ids) = 0;
> diff --git a/src/libcamera/sensor/camera_sensor_legacy.cpp b/src/libcamera/sensor/camera_sensor_legacy.cpp
> index f9e685a9acc4..39c34200b0ff 100644
> --- a/src/libcamera/sensor/camera_sensor_legacy.cpp
> +++ b/src/libcamera/sensor/camera_sensor_legacy.cpp
> @@ -88,6 +88,7 @@ public:
>         int sensorInfo(IPACameraSensorInfo *info) const override;
>         Transform computeTransform(Orientation *orientation) const override;
>         BayerFormat::Order bayerOrder(Transform t) const override;
> +       Orientation mountingOrientation() const override { return mountingOrientation_; }

I guess we don't have enough in the base class to return this commonly
to both classes ?


>  
>         const ControlInfoMap &controls() const override;
>         ControlList getControls(Span<const uint32_t> ids) override;
> diff --git a/src/libcamera/sensor/camera_sensor_raw.cpp b/src/libcamera/sensor/camera_sensor_raw.cpp
> index 8ea4423698cd..759cccafe4a9 100644
> --- a/src/libcamera/sensor/camera_sensor_raw.cpp
> +++ b/src/libcamera/sensor/camera_sensor_raw.cpp
> @@ -94,6 +94,7 @@ public:
>         int sensorInfo(IPACameraSensorInfo *info) const override;
>         Transform computeTransform(Orientation *orientation) const override;
>         BayerFormat::Order bayerOrder(Transform t) const override;
> +       Orientation mountingOrientation() const override { return mountingOrientation_; }
>  
>         const ControlInfoMap &controls() const override;
>         ControlList getControls(Span<const uint32_t> ids) override;
> -- 
> 2.48.1
>
Stefan Klug Oct. 6, 2025, 9:07 a.m. UTC | #2
Hi Kieran,

Thank you for the review. 

Quoting Kieran Bingham (2025-09-30 15:41:54)
> Quoting Stefan Klug (2025-09-30 13:26:46)
> > To properly handle the orientation in the dewarper, the mounting
> > orientation of the sensor needs to be queryable. Add that.
> > 
> > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> > ---
> >  include/libcamera/internal/camera_sensor.h    | 1 +
> >  src/libcamera/sensor/camera_sensor_legacy.cpp | 1 +
> >  src/libcamera/sensor/camera_sensor_raw.cpp    | 1 +
> >  3 files changed, 3 insertions(+)
> > 
> > diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h
> > index f6ef4df170d4..e6b72d22ac21 100644
> > --- a/include/libcamera/internal/camera_sensor.h
> > +++ b/include/libcamera/internal/camera_sensor.h
> > @@ -73,6 +73,7 @@ public:
> >         virtual int sensorInfo(IPACameraSensorInfo *info) const = 0;
> >         virtual Transform computeTransform(Orientation *orientation) const = 0;
> >         virtual BayerFormat::Order bayerOrder(Transform t) const = 0;
> > +       virtual Orientation mountingOrientation() const = 0;
> >  
> >         virtual const ControlInfoMap &controls() const = 0;
> >         virtual ControlList getControls(Span<const uint32_t> ids) = 0;
> > diff --git a/src/libcamera/sensor/camera_sensor_legacy.cpp b/src/libcamera/sensor/camera_sensor_legacy.cpp
> > index f9e685a9acc4..39c34200b0ff 100644
> > --- a/src/libcamera/sensor/camera_sensor_legacy.cpp
> > +++ b/src/libcamera/sensor/camera_sensor_legacy.cpp
> > @@ -88,6 +88,7 @@ public:
> >         int sensorInfo(IPACameraSensorInfo *info) const override;
> >         Transform computeTransform(Orientation *orientation) const override;
> >         BayerFormat::Order bayerOrder(Transform t) const override;
> > +       Orientation mountingOrientation() const override { return mountingOrientation_; }
> 
> I guess we don't have enough in the base class to return this commonly
> to both classes ?

No, not really. The base class is mostly pure virtual.

Best regards,
Stefan

> 
> 
> >  
> >         const ControlInfoMap &controls() const override;
> >         ControlList getControls(Span<const uint32_t> ids) override;
> > diff --git a/src/libcamera/sensor/camera_sensor_raw.cpp b/src/libcamera/sensor/camera_sensor_raw.cpp
> > index 8ea4423698cd..759cccafe4a9 100644
> > --- a/src/libcamera/sensor/camera_sensor_raw.cpp
> > +++ b/src/libcamera/sensor/camera_sensor_raw.cpp
> > @@ -94,6 +94,7 @@ public:
> >         int sensorInfo(IPACameraSensorInfo *info) const override;
> >         Transform computeTransform(Orientation *orientation) const override;
> >         BayerFormat::Order bayerOrder(Transform t) const override;
> > +       Orientation mountingOrientation() const override { return mountingOrientation_; }
> >  
> >         const ControlInfoMap &controls() const override;
> >         ControlList getControls(Span<const uint32_t> ids) override;
> > -- 
> > 2.48.1
> >
Kieran Bingham Oct. 6, 2025, 10:58 a.m. UTC | #3
Quoting Stefan Klug (2025-10-06 10:07:56)
> Hi Kieran,
> 
> Thank you for the review. 
> 
> Quoting Kieran Bingham (2025-09-30 15:41:54)
> > Quoting Stefan Klug (2025-09-30 13:26:46)
> > > To properly handle the orientation in the dewarper, the mounting
> > > orientation of the sensor needs to be queryable. Add that.
> > > 
> > > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> > > ---
> > >  include/libcamera/internal/camera_sensor.h    | 1 +
> > >  src/libcamera/sensor/camera_sensor_legacy.cpp | 1 +
> > >  src/libcamera/sensor/camera_sensor_raw.cpp    | 1 +
> > >  3 files changed, 3 insertions(+)
> > > 
> > > diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h
> > > index f6ef4df170d4..e6b72d22ac21 100644
> > > --- a/include/libcamera/internal/camera_sensor.h
> > > +++ b/include/libcamera/internal/camera_sensor.h
> > > @@ -73,6 +73,7 @@ public:
> > >         virtual int sensorInfo(IPACameraSensorInfo *info) const = 0;
> > >         virtual Transform computeTransform(Orientation *orientation) const = 0;
> > >         virtual BayerFormat::Order bayerOrder(Transform t) const = 0;
> > > +       virtual Orientation mountingOrientation() const = 0;
> > >  
> > >         virtual const ControlInfoMap &controls() const = 0;
> > >         virtual ControlList getControls(Span<const uint32_t> ids) = 0;
> > > diff --git a/src/libcamera/sensor/camera_sensor_legacy.cpp b/src/libcamera/sensor/camera_sensor_legacy.cpp
> > > index f9e685a9acc4..39c34200b0ff 100644
> > > --- a/src/libcamera/sensor/camera_sensor_legacy.cpp
> > > +++ b/src/libcamera/sensor/camera_sensor_legacy.cpp
> > > @@ -88,6 +88,7 @@ public:
> > >         int sensorInfo(IPACameraSensorInfo *info) const override;
> > >         Transform computeTransform(Orientation *orientation) const override;
> > >         BayerFormat::Order bayerOrder(Transform t) const override;
> > > +       Orientation mountingOrientation() const override { return mountingOrientation_; }
> > 
> > I guess we don't have enough in the base class to return this commonly
> > to both classes ?
> 
> No, not really. The base class is mostly pure virtual.

Well if it should stay pure virtual then we have to duplicate the
helpers I guess so:

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

> 
> Best regards,
> Stefan
> 
> > 
> > 
> > >  
> > >         const ControlInfoMap &controls() const override;
> > >         ControlList getControls(Span<const uint32_t> ids) override;
> > > diff --git a/src/libcamera/sensor/camera_sensor_raw.cpp b/src/libcamera/sensor/camera_sensor_raw.cpp
> > > index 8ea4423698cd..759cccafe4a9 100644
> > > --- a/src/libcamera/sensor/camera_sensor_raw.cpp
> > > +++ b/src/libcamera/sensor/camera_sensor_raw.cpp
> > > @@ -94,6 +94,7 @@ public:
> > >         int sensorInfo(IPACameraSensorInfo *info) const override;
> > >         Transform computeTransform(Orientation *orientation) const override;
> > >         BayerFormat::Order bayerOrder(Transform t) const override;
> > > +       Orientation mountingOrientation() const override { return mountingOrientation_; }
> > >  
> > >         const ControlInfoMap &controls() const override;
> > >         ControlList getControls(Span<const uint32_t> ids) override;
> > > -- 
> > > 2.48.1
> > >

Patch
diff mbox series

diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h
index f6ef4df170d4..e6b72d22ac21 100644
--- a/include/libcamera/internal/camera_sensor.h
+++ b/include/libcamera/internal/camera_sensor.h
@@ -73,6 +73,7 @@  public:
 	virtual int sensorInfo(IPACameraSensorInfo *info) const = 0;
 	virtual Transform computeTransform(Orientation *orientation) const = 0;
 	virtual BayerFormat::Order bayerOrder(Transform t) const = 0;
+	virtual Orientation mountingOrientation() const = 0;
 
 	virtual const ControlInfoMap &controls() const = 0;
 	virtual ControlList getControls(Span<const uint32_t> ids) = 0;
diff --git a/src/libcamera/sensor/camera_sensor_legacy.cpp b/src/libcamera/sensor/camera_sensor_legacy.cpp
index f9e685a9acc4..39c34200b0ff 100644
--- a/src/libcamera/sensor/camera_sensor_legacy.cpp
+++ b/src/libcamera/sensor/camera_sensor_legacy.cpp
@@ -88,6 +88,7 @@  public:
 	int sensorInfo(IPACameraSensorInfo *info) const override;
 	Transform computeTransform(Orientation *orientation) const override;
 	BayerFormat::Order bayerOrder(Transform t) const override;
+	Orientation mountingOrientation() const override { return mountingOrientation_; }
 
 	const ControlInfoMap &controls() const override;
 	ControlList getControls(Span<const uint32_t> ids) override;
diff --git a/src/libcamera/sensor/camera_sensor_raw.cpp b/src/libcamera/sensor/camera_sensor_raw.cpp
index 8ea4423698cd..759cccafe4a9 100644
--- a/src/libcamera/sensor/camera_sensor_raw.cpp
+++ b/src/libcamera/sensor/camera_sensor_raw.cpp
@@ -94,6 +94,7 @@  public:
 	int sensorInfo(IPACameraSensorInfo *info) const override;
 	Transform computeTransform(Orientation *orientation) const override;
 	BayerFormat::Order bayerOrder(Transform t) const override;
+	Orientation mountingOrientation() const override { return mountingOrientation_; }
 
 	const ControlInfoMap &controls() const override;
 	ControlList getControls(Span<const uint32_t> ids) override;