[libcamera-devel,1/3] pipeline: raspberrypi: Split out device enumeration and camera registration
diff mbox series

Message ID 20211119110955.3137585-1-naush@raspberrypi.com
State Superseded
Headers show
Series
  • [libcamera-devel,1/3] pipeline: raspberrypi: Split out device enumeration and camera registration
Related show

Commit Message

Naushir Patuck Nov. 19, 2021, 11:09 a.m. UTC
Split out PipelineHandlerRPi::match() so that media device enumeration and
acquisition is separated from camera registration. The former logic remains
in PipelineHandlerRPi::match(), whereas the latter logic is moved into a new
PipelineHandlerRPi::registerCameras() member function.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
---
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Laurent Pinchart Nov. 19, 2021, 12:51 p.m. UTC | #1
Hi Naush,

Thank you for the patch.

On Fri, Nov 19, 2021 at 11:09:53AM +0000, Naushir Patuck wrote:
> Split out PipelineHandlerRPi::match() so that media device enumeration and
> acquisition is separated from camera registration. The former logic remains
> in PipelineHandlerRPi::match(), whereas the latter logic is moved into a new
> PipelineHandlerRPi::registerCameras() member function.
> 
> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>

Looks simple enough. Assuming that it helps the rest of the series,

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

> ---
>  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> index 4f6c699a4379..9aa7e9eef5e7 100644
> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> @@ -311,6 +311,7 @@ private:
>  		return static_cast<RPiCameraData *>(camera->_d());
>  	}
>  
> +	bool registerCameras();
>  	int queueAllBuffers(Camera *camera);
>  	int prepareBuffers(Camera *camera);
>  	void freeBuffers(Camera *camera);
> @@ -1010,6 +1011,11 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator)
>  	if (!isp_)
>  		return false;
>  
> +	return registerCameras();
> +}
> +
> +bool PipelineHandlerRPi::registerCameras()
> +{
>  	std::unique_ptr<RPiCameraData> data = std::make_unique<RPiCameraData>(this);
>  	if (!data->dmaHeap_.isValid())
>  		return false;

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 4f6c699a4379..9aa7e9eef5e7 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -311,6 +311,7 @@  private:
 		return static_cast<RPiCameraData *>(camera->_d());
 	}
 
+	bool registerCameras();
 	int queueAllBuffers(Camera *camera);
 	int prepareBuffers(Camera *camera);
 	void freeBuffers(Camera *camera);
@@ -1010,6 +1011,11 @@  bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator)
 	if (!isp_)
 		return false;
 
+	return registerCameras();
+}
+
+bool PipelineHandlerRPi::registerCameras()
+{
 	std::unique_ptr<RPiCameraData> data = std::make_unique<RPiCameraData>(this);
 	if (!data->dmaHeap_.isValid())
 		return false;