[v1,1/2] pipeline: rpi: Rename Stream::prepareBuffers to Stream::allocateBuffers
diff mbox series

Message ID 20251210131302.81887-2-naush@raspberrypi.com
State Superseded
Headers show
Series
  • RPi: Internal buffer alloaction rework
Related show

Commit Message

Naushir Patuck Dec. 10, 2025, 1:09 p.m. UTC
This rename is in preparation for a subsequent change where only
buffer allocations happen in this function.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
---
 src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 2 +-
 src/libcamera/pipeline/rpi/common/pipeline_base.h   | 2 +-
 src/libcamera/pipeline/rpi/common/rpi_stream.cpp    | 2 +-
 src/libcamera/pipeline/rpi/common/rpi_stream.h      | 2 +-
 src/libcamera/pipeline/rpi/pisp/pisp.cpp            | 6 +++---
 src/libcamera/pipeline/rpi/vc4/vc4.cpp              | 6 +++---
 6 files changed, 10 insertions(+), 10 deletions(-)

Comments

Barnabás Pőcze Dec. 15, 2025, 10:38 a.m. UTC | #1
Hi

2025. 12. 10. 14:09 keltezéssel, Naushir Patuck írta:
> This rename is in preparation for a subsequent change where only
> buffer allocations happen in this function.
> 
> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
> ---
>   src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 2 +-
>   src/libcamera/pipeline/rpi/common/pipeline_base.h   | 2 +-
>   src/libcamera/pipeline/rpi/common/rpi_stream.cpp    | 2 +-
>   src/libcamera/pipeline/rpi/common/rpi_stream.h      | 2 +-
>   src/libcamera/pipeline/rpi/pisp/pisp.cpp            | 6 +++---
>   src/libcamera/pipeline/rpi/vc4/vc4.cpp              | 6 +++---
>   6 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
> index 9d65dc83573b..2b61b5d241c5 100644
> --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
> +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
> @@ -668,7 +668,7 @@ int PipelineHandlerBase::start(Camera *camera, const ControlList *controls)
>   
>   	if (!data->buffersAllocated_) {
>   		/* Allocate buffers for internal pipeline usage. */
> -		ret = prepareBuffers(camera);
> +		ret = allocateBuffers(camera);
>   		if (ret) {
>   			LOG(RPI, Error) << "Failed to allocate buffers";
>   			data->freeBuffers();
> diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.h b/src/libcamera/pipeline/rpi/common/pipeline_base.h
> index 15628259afc6..0c6354493548 100644
> --- a/src/libcamera/pipeline/rpi/common/pipeline_base.h
> +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.h
> @@ -242,7 +242,7 @@ private:
>   	}
>   
>   	int queueAllBuffers(Camera *camera);
> -	virtual int prepareBuffers(Camera *camera) = 0;
> +	virtual int allocateBuffers(Camera *camera) = 0;

These also "map" the buffers not just allocate as far as I can see.
In any case,  I think the name is fine. And the change looks OK to me.


Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>


>   };
>   
>   class RPiCameraConfiguration final : public CameraConfiguration
> diff --git a/src/libcamera/pipeline/rpi/common/rpi_stream.cpp b/src/libcamera/pipeline/rpi/common/rpi_stream.cpp
> index accf59eb424e..e73f4b7d31af 100644
> --- a/src/libcamera/pipeline/rpi/common/rpi_stream.cpp
> +++ b/src/libcamera/pipeline/rpi/common/rpi_stream.cpp
> @@ -106,7 +106,7 @@ void Stream::setExportedBuffer(FrameBuffer *buffer)
>   	bufferEmplace(++id_, buffer);
>   }
>   
> -int Stream::prepareBuffers(unsigned int count)
> +int Stream::allocateBuffers(unsigned int count)
>   {
>   	int ret;
>   
> diff --git a/src/libcamera/pipeline/rpi/common/rpi_stream.h b/src/libcamera/pipeline/rpi/common/rpi_stream.h
> index 0dba12961743..c267447e5ab5 100644
> --- a/src/libcamera/pipeline/rpi/common/rpi_stream.h
> +++ b/src/libcamera/pipeline/rpi/common/rpi_stream.h
> @@ -125,7 +125,7 @@ public:
>   
>   	void setExportedBuffer(FrameBuffer *buffer);
>   
> -	int prepareBuffers(unsigned int count);
> +	int allocateBuffers(unsigned int count);
>   	int queueBuffer(FrameBuffer *buffer);
>   	void returnBuffer(FrameBuffer *buffer);
>   
> diff --git a/src/libcamera/pipeline/rpi/pisp/pisp.cpp b/src/libcamera/pipeline/rpi/pisp/pisp.cpp
> index 77acd2f64092..7bcba32b9b58 100644
> --- a/src/libcamera/pipeline/rpi/pisp/pisp.cpp
> +++ b/src/libcamera/pipeline/rpi/pisp/pisp.cpp
> @@ -864,7 +864,7 @@ private:
>   		return static_cast<PiSPCameraData *>(camera->_d());
>   	}
>   
> -	int prepareBuffers(Camera *camera) override;
> +	int allocateBuffers(Camera *camera) override;
>   	int platformRegister(std::unique_ptr<RPi::CameraData> &cameraData,
>   			     std::shared_ptr<MediaDevice> cfe,
>   			     std::shared_ptr<MediaDevice> isp) override;
> @@ -958,7 +958,7 @@ bool PipelineHandlerPiSP::match(DeviceEnumerator *enumerator)
>   	return false;
>   }
>   
> -int PipelineHandlerPiSP::prepareBuffers(Camera *camera)
> +int PipelineHandlerPiSP::allocateBuffers(Camera *camera)
>   {
>   	PiSPCameraData *data = cameraData(camera);
>   	unsigned int numRawBuffers = 0;
> @@ -1021,7 +1021,7 @@ int PipelineHandlerPiSP::prepareBuffers(Camera *camera)
>   		LOG(RPI, Debug) << "Preparing " << numBuffers
>   				<< " buffers for stream " << stream->name();
>   
> -		ret = stream->prepareBuffers(numBuffers);
> +		ret = stream->allocateBuffers(numBuffers);
>   		if (ret < 0)
>   			return ret;
>   	}
> diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp
> index f0cb99d59e74..8a80439e9082 100644
> --- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp
> +++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp
> @@ -158,7 +158,7 @@ private:
>   		return static_cast<Vc4CameraData *>(camera->_d());
>   	}
>   
> -	int prepareBuffers(Camera *camera) override;
> +	int allocateBuffers(Camera *camera) override;
>   	int platformRegister(std::unique_ptr<RPi::CameraData> &cameraData,
>   			     std::shared_ptr<MediaDevice> unicam,
>   			     std::shared_ptr<MediaDevice> isp) override;
> @@ -219,7 +219,7 @@ bool PipelineHandlerVc4::match(DeviceEnumerator *enumerator)
>   	return false;
>   }
>   
> -int PipelineHandlerVc4::prepareBuffers(Camera *camera)
> +int PipelineHandlerVc4::allocateBuffers(Camera *camera)
>   {
>   	Vc4CameraData *data = cameraData(camera);
>   	unsigned int numRawBuffers = 0;
> @@ -289,7 +289,7 @@ int PipelineHandlerVc4::prepareBuffers(Camera *camera)
>   		LOG(RPI, Debug) << "Preparing " << numBuffers
>   				<< " buffers for stream " << stream->name();
>   
> -		ret = stream->prepareBuffers(numBuffers);
> +		ret = stream->allocateBuffers(numBuffers);
>   		if (ret < 0)
>   			return ret;
>   	}

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
index 9d65dc83573b..2b61b5d241c5 100644
--- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
@@ -668,7 +668,7 @@  int PipelineHandlerBase::start(Camera *camera, const ControlList *controls)
 
 	if (!data->buffersAllocated_) {
 		/* Allocate buffers for internal pipeline usage. */
-		ret = prepareBuffers(camera);
+		ret = allocateBuffers(camera);
 		if (ret) {
 			LOG(RPI, Error) << "Failed to allocate buffers";
 			data->freeBuffers();
diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.h b/src/libcamera/pipeline/rpi/common/pipeline_base.h
index 15628259afc6..0c6354493548 100644
--- a/src/libcamera/pipeline/rpi/common/pipeline_base.h
+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.h
@@ -242,7 +242,7 @@  private:
 	}
 
 	int queueAllBuffers(Camera *camera);
-	virtual int prepareBuffers(Camera *camera) = 0;
+	virtual int allocateBuffers(Camera *camera) = 0;
 };
 
 class RPiCameraConfiguration final : public CameraConfiguration
diff --git a/src/libcamera/pipeline/rpi/common/rpi_stream.cpp b/src/libcamera/pipeline/rpi/common/rpi_stream.cpp
index accf59eb424e..e73f4b7d31af 100644
--- a/src/libcamera/pipeline/rpi/common/rpi_stream.cpp
+++ b/src/libcamera/pipeline/rpi/common/rpi_stream.cpp
@@ -106,7 +106,7 @@  void Stream::setExportedBuffer(FrameBuffer *buffer)
 	bufferEmplace(++id_, buffer);
 }
 
-int Stream::prepareBuffers(unsigned int count)
+int Stream::allocateBuffers(unsigned int count)
 {
 	int ret;
 
diff --git a/src/libcamera/pipeline/rpi/common/rpi_stream.h b/src/libcamera/pipeline/rpi/common/rpi_stream.h
index 0dba12961743..c267447e5ab5 100644
--- a/src/libcamera/pipeline/rpi/common/rpi_stream.h
+++ b/src/libcamera/pipeline/rpi/common/rpi_stream.h
@@ -125,7 +125,7 @@  public:
 
 	void setExportedBuffer(FrameBuffer *buffer);
 
-	int prepareBuffers(unsigned int count);
+	int allocateBuffers(unsigned int count);
 	int queueBuffer(FrameBuffer *buffer);
 	void returnBuffer(FrameBuffer *buffer);
 
diff --git a/src/libcamera/pipeline/rpi/pisp/pisp.cpp b/src/libcamera/pipeline/rpi/pisp/pisp.cpp
index 77acd2f64092..7bcba32b9b58 100644
--- a/src/libcamera/pipeline/rpi/pisp/pisp.cpp
+++ b/src/libcamera/pipeline/rpi/pisp/pisp.cpp
@@ -864,7 +864,7 @@  private:
 		return static_cast<PiSPCameraData *>(camera->_d());
 	}
 
-	int prepareBuffers(Camera *camera) override;
+	int allocateBuffers(Camera *camera) override;
 	int platformRegister(std::unique_ptr<RPi::CameraData> &cameraData,
 			     std::shared_ptr<MediaDevice> cfe,
 			     std::shared_ptr<MediaDevice> isp) override;
@@ -958,7 +958,7 @@  bool PipelineHandlerPiSP::match(DeviceEnumerator *enumerator)
 	return false;
 }
 
-int PipelineHandlerPiSP::prepareBuffers(Camera *camera)
+int PipelineHandlerPiSP::allocateBuffers(Camera *camera)
 {
 	PiSPCameraData *data = cameraData(camera);
 	unsigned int numRawBuffers = 0;
@@ -1021,7 +1021,7 @@  int PipelineHandlerPiSP::prepareBuffers(Camera *camera)
 		LOG(RPI, Debug) << "Preparing " << numBuffers
 				<< " buffers for stream " << stream->name();
 
-		ret = stream->prepareBuffers(numBuffers);
+		ret = stream->allocateBuffers(numBuffers);
 		if (ret < 0)
 			return ret;
 	}
diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp
index f0cb99d59e74..8a80439e9082 100644
--- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp
+++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp
@@ -158,7 +158,7 @@  private:
 		return static_cast<Vc4CameraData *>(camera->_d());
 	}
 
-	int prepareBuffers(Camera *camera) override;
+	int allocateBuffers(Camera *camera) override;
 	int platformRegister(std::unique_ptr<RPi::CameraData> &cameraData,
 			     std::shared_ptr<MediaDevice> unicam,
 			     std::shared_ptr<MediaDevice> isp) override;
@@ -219,7 +219,7 @@  bool PipelineHandlerVc4::match(DeviceEnumerator *enumerator)
 	return false;
 }
 
-int PipelineHandlerVc4::prepareBuffers(Camera *camera)
+int PipelineHandlerVc4::allocateBuffers(Camera *camera)
 {
 	Vc4CameraData *data = cameraData(camera);
 	unsigned int numRawBuffers = 0;
@@ -289,7 +289,7 @@  int PipelineHandlerVc4::prepareBuffers(Camera *camera)
 		LOG(RPI, Debug) << "Preparing " << numBuffers
 				<< " buffers for stream " << stream->name();
 
-		ret = stream->prepareBuffers(numBuffers);
+		ret = stream->allocateBuffers(numBuffers);
 		if (ret < 0)
 			return ret;
 	}