From patchwork Mon Mar 4 23:25:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 702 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9C8AB611A7 for ; Tue, 5 Mar 2019 00:25:37 +0100 (CET) Received: from localhost.localdomain (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 3AE7C334; Tue, 5 Mar 2019 00:25:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1551741937; bh=rhki0TsVozJQYFu9PwCs95SXzCf3WVunlLw3RJyj76U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fOgWR6jN7he2X7yS5aV3PhoRe1F24fZ4vuBvYYN7+Zz+iyLLjZzfkwJK3gTJAY5Wm BtPV1nCANP/VKDLoCIDJDRu7zrTgeCoqiLgmlq0IH8gCMmScZlv5QvAQRLcUHkE11w 7o8mtAYAOpnWscs/Ug8xV8XJZsEznWU+DMuX06hM= From: Kieran Bingham To: LibCamera Devel Date: Mon, 4 Mar 2019 23:25:30 +0000 Message-Id: <20190304232530.4427-3-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190304232530.4427-1-kieran.bingham@ideasonboard.com> References: <20190304232530.4427-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/2] libcamera: camera: Unmap buffers before release X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2019 23:25:38 -0000 Before buffers can be released back to V4L2 all mappings must be unmapped. Ensure that buffers are released correctly by destroying the buffer pool contents before freeing the resources on the stream. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/libcamera/camera.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 8e17085bfb50..875e1e46c89c 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -488,8 +488,13 @@ int Camera::freeBuffers() if (!stream->bufferPool().count()) continue; - pipe_->freeBuffers(this, stream); + /* + * Destroy Buffers will empty the pool, and unmap any existing + * memory mapping. This needs to be done before releasing + * buffers back to the V4L2Device through freeBuffers(). + */ stream->bufferPool().destroyBuffers(); + pipe_->freeBuffers(this, stream); } state_ = CameraConfigured;