[libcamera-devel] [PATCH 2/2] libcamera: pipeline: raspberrypi: Free buffers when a camera is released
Naushir Patuck
naush at raspberrypi.com
Fri Nov 11 15:19:27 CET 2022
Hi David,
Thank you for fixing this!
On Fri, 11 Nov 2022 at 13:30, David Plowman via libcamera-devel <
libcamera-devel at lists.libcamera.org> wrote:
> Implement the PipelineHandlerRPi::releaseDevice method which allows
> us to free any allocated buffers when a camera is released.
>
> Signed-off-by: David Plowman <david.plowman at raspberrypi.com>
> ---
> src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> index f15fa28b..785eddf9 100644
> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> @@ -337,6 +337,8 @@ public:
>
> bool match(DeviceEnumerator *enumerator) override;
>
> + void releaseDevice(Camera *camera) override;
> +
> private:
> RPiCameraData *cameraData(Camera *camera)
> {
> @@ -1193,6 +1195,12 @@ bool PipelineHandlerRPi::match(DeviceEnumerator
> *enumerator)
> return !!numCameras;
> }
>
> +void PipelineHandlerRPi::releaseDevice(Camera *camera)
> +{
> + RPiCameraData *data = cameraData(camera);
> + data->freeBuffers();
> +}
>
My head's spinning with all these related changes now :-)
Presumably for this to work correctly, RPiCameraData::freeBuffers() must
not do the
if (!buffersAllocated_) test, correct? So this change relies on [1] to
behave correctly?
Reviewed-by: Naushir Patuck <naush at raspberrypi.com>
[1] https://patchwork.libcamera.org/patch/17759/
+
> int PipelineHandlerRPi::registerCamera(MediaDevice *unicam, MediaDevice
> *isp, MediaEntity *sensorEntity)
> {
> std::unique_ptr<RPiCameraData> data =
> std::make_unique<RPiCameraData>(this);
> --
> 2.30.2
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20221111/cf430587/attachment.htm>
More information about the libcamera-devel
mailing list