[libcamera-devel,05/20] mojom: pipeline: ipa: rpi: Add fields for PiSP objects
diff mbox series

Message ID 20231006132000.23504-6-naush@raspberrypi.com
State Superseded
Headers show
Series
  • Raspberry Pi: Preliminary PiSP support
Related show

Commit Message

Naushir Patuck Oct. 6, 2023, 1:19 p.m. UTC
Add the PiSP Frontend and Backend SharedMemObject file descriptors to
the ipa::init() call. This will allow the pipeline handler to pass these
objects to the IPA after construction.

Add a flag to indicate if buffer swaps are needed when starting the
ISP for the stitch block.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
---
 include/libcamera/ipa/raspberrypi.mojom | 6 +++++-
 src/ipa/rpi/common/ipa_base.cpp         | 2 +-
 src/libcamera/pipeline/rpi/vc4/vc4.cpp  | 5 +++--
 3 files changed, 9 insertions(+), 4 deletions(-)

Comments

Jacopo Mondi Oct. 12, 2023, 8:21 a.m. UTC | #1
Hi Naush

On Fri, Oct 06, 2023 at 02:19:45PM +0100, Naushir Patuck via libcamera-devel wrote:
> Add the PiSP Frontend and Backend SharedMemObject file descriptors to
> the ipa::init() call. This will allow the pipeline handler to pass these
> objects to the IPA after construction.
>
> Add a flag to indicate if buffer swaps are needed when starting the
> ISP for the stitch block.
>
> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

> ---
>  include/libcamera/ipa/raspberrypi.mojom | 6 +++++-
>  src/ipa/rpi/common/ipa_base.cpp         | 2 +-
>  src/libcamera/pipeline/rpi/vc4/vc4.cpp  | 5 +++--
>  3 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom
> index ab4c4e2edca3..5986c4366c15 100644
> --- a/include/libcamera/ipa/raspberrypi.mojom
> +++ b/include/libcamera/ipa/raspberrypi.mojom
> @@ -22,6 +22,9 @@ struct SensorConfig {
>  struct InitParams {
>  	bool lensPresent;
>  	libcamera.IPACameraSensorInfo sensorInfo;
> +	/* PISP specific */
> +	libcamera.SharedFD fe;
> +	libcamera.SharedFD be;
>  };
>
>  struct InitResult {
> @@ -219,13 +222,14 @@ interface IPARPiEventInterface {
>  	 * \fn prepareIspComplete()
>  	 * \brief Signal completion of \a prepareIsp
>  	 * \param[in] buffers Bayer and embedded buffers actioned.
> +	 * \param[in] stitchSwapBuffers Whether the stitch block buffers need to be swapped.
>  	 *
>  	 * This asynchronous event is signalled to the pipeline handler once
>  	 * the \a prepareIsp signal has completed, and the ISP is ready to start
>  	 * processing the frame. The embedded data buffer may be recycled after
>  	 * this event.
>  	 */
> -	prepareIspComplete(BufferIds buffers);
> +	prepareIspComplete(BufferIds buffers, bool stitchSwapBuffers);
>
>  	/**
>  	 * \fn processStatsComplete()
> diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp
> index 5939fe57f040..97f647a9e53e 100644
> --- a/src/ipa/rpi/common/ipa_base.cpp
> +++ b/src/ipa/rpi/common/ipa_base.cpp
> @@ -446,7 +446,7 @@ void IpaBase::prepareIsp(const PrepareParams &params)
>  	frameCount_++;
>
>  	/* Ready to push the input buffer into the ISP. */
> -	prepareIspComplete.emit(params.buffers);
> +	prepareIspComplete.emit(params.buffers, false);
>  }
>
>  void IpaBase::processStats(const ProcessParams &params)
> diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp
> index bc90d6324777..233473e2fe2b 100644
> --- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp
> +++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp
> @@ -78,7 +78,7 @@ public:
>  	void ispOutputDequeue(FrameBuffer *buffer);
>
>  	void processStatsComplete(const ipa::RPi::BufferIds &buffers);
> -	void prepareIspComplete(const ipa::RPi::BufferIds &buffers);
> +	void prepareIspComplete(const ipa::RPi::BufferIds &buffers, bool stitchSwapBuffers);
>  	void setIspControls(const ControlList &controls);
>  	void setCameraTimeout(uint32_t maxFrameLengthMs);
>
> @@ -833,7 +833,8 @@ void Vc4CameraData::processStatsComplete(const ipa::RPi::BufferIds &buffers)
>  	handleState();
>  }
>
> -void Vc4CameraData::prepareIspComplete(const ipa::RPi::BufferIds &buffers)
> +void Vc4CameraData::prepareIspComplete(const ipa::RPi::BufferIds &buffers,
> +				       [[maybe_unused]] bool stitchSwapBuffers)
>  {
>  	unsigned int embeddedId = buffers.embedded & RPi::MaskID;
>  	unsigned int bayer = buffers.bayer & RPi::MaskID;
> --
> 2.34.1
>

Patch
diff mbox series

diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom
index ab4c4e2edca3..5986c4366c15 100644
--- a/include/libcamera/ipa/raspberrypi.mojom
+++ b/include/libcamera/ipa/raspberrypi.mojom
@@ -22,6 +22,9 @@  struct SensorConfig {
 struct InitParams {
 	bool lensPresent;
 	libcamera.IPACameraSensorInfo sensorInfo;
+	/* PISP specific */
+	libcamera.SharedFD fe;
+	libcamera.SharedFD be;
 };
 
 struct InitResult {
@@ -219,13 +222,14 @@  interface IPARPiEventInterface {
 	 * \fn prepareIspComplete()
 	 * \brief Signal completion of \a prepareIsp
 	 * \param[in] buffers Bayer and embedded buffers actioned.
+	 * \param[in] stitchSwapBuffers Whether the stitch block buffers need to be swapped.
 	 *
 	 * This asynchronous event is signalled to the pipeline handler once
 	 * the \a prepareIsp signal has completed, and the ISP is ready to start
 	 * processing the frame. The embedded data buffer may be recycled after
 	 * this event.
 	 */
-	prepareIspComplete(BufferIds buffers);
+	prepareIspComplete(BufferIds buffers, bool stitchSwapBuffers);
 
 	/**
 	 * \fn processStatsComplete()
diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp
index 5939fe57f040..97f647a9e53e 100644
--- a/src/ipa/rpi/common/ipa_base.cpp
+++ b/src/ipa/rpi/common/ipa_base.cpp
@@ -446,7 +446,7 @@  void IpaBase::prepareIsp(const PrepareParams &params)
 	frameCount_++;
 
 	/* Ready to push the input buffer into the ISP. */
-	prepareIspComplete.emit(params.buffers);
+	prepareIspComplete.emit(params.buffers, false);
 }
 
 void IpaBase::processStats(const ProcessParams &params)
diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp
index bc90d6324777..233473e2fe2b 100644
--- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp
+++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp
@@ -78,7 +78,7 @@  public:
 	void ispOutputDequeue(FrameBuffer *buffer);
 
 	void processStatsComplete(const ipa::RPi::BufferIds &buffers);
-	void prepareIspComplete(const ipa::RPi::BufferIds &buffers);
+	void prepareIspComplete(const ipa::RPi::BufferIds &buffers, bool stitchSwapBuffers);
 	void setIspControls(const ControlList &controls);
 	void setCameraTimeout(uint32_t maxFrameLengthMs);
 
@@ -833,7 +833,8 @@  void Vc4CameraData::processStatsComplete(const ipa::RPi::BufferIds &buffers)
 	handleState();
 }
 
-void Vc4CameraData::prepareIspComplete(const ipa::RPi::BufferIds &buffers)
+void Vc4CameraData::prepareIspComplete(const ipa::RPi::BufferIds &buffers,
+				       [[maybe_unused]] bool stitchSwapBuffers)
 {
 	unsigned int embeddedId = buffers.embedded & RPi::MaskID;
 	unsigned int bayer = buffers.bayer & RPi::MaskID;