From 7401f5002e54dbb2f0c405d00082c4461150aea8 Mon Sep 17 00:00:00 2001 From: Kieran Bingham Date: Mon, 4 Mar 2019 21:51:50 +0000 Subject: libcamera: camera: Unmap buffers before release Buffers must have all mappings destroyed before buffers can be freed by the V4L2 device that has allocated them. Swap the ordering of freeBuffers() and destroyBuffers() to correct this. Fixes: bd38112b7795 ("libcamera: camera: Extend the interface to support capture") Reviewed-by: Laurent Pinchart Signed-off-by: Kieran Bingham --- src/libcamera/camera.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 8e17085b..b4197f95 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -488,8 +488,12 @@ int Camera::freeBuffers() if (!stream->bufferPool().count()) continue; - pipe_->freeBuffers(this, stream); + /* + * All mappings must be destroyed before buffers can be freed + * by the V4L2 device that has allocated them. + */ stream->bufferPool().destroyBuffers(); + pipe_->freeBuffers(this, stream); } state_ = CameraConfigured; -- cgit v1.2.1