{"id":702,"url":"https://patchwork.libcamera.org/api/1.1/patches/702/?format=json","web_url":"https://patchwork.libcamera.org/patch/702/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20190304232530.4427-3-kieran.bingham@ideasonboard.com>","date":"2019-03-04T23:25:30","name":"[libcamera-devel,2/2] libcamera: camera: Unmap buffers before release","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"3824eb1f0c1836f8a395e19479bc1069073ae858","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/702/mbox/","series":[{"id":202,"url":"https://patchwork.libcamera.org/api/1.1/series/202/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=202","date":"2019-03-04T23:25:29","name":"libcamera: Fix unmapping of buffers","version":1,"mbox":"https://patchwork.libcamera.org/series/202/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/702/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/702/checks/","tags":{},"headers":{"Return-Path":"<kieran.bingham@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9C8AB611A7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  5 Mar 2019 00:25:37 +0100 (CET)","from localhost.localdomain\n\t(cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3AE7C334;\n\tTue,  5 Mar 2019 00:25:37 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1551741937;\n\tbh=rhki0TsVozJQYFu9PwCs95SXzCf3WVunlLw3RJyj76U=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=fOgWR6jN7he2X7yS5aV3PhoRe1F24fZ4vuBvYYN7+Zz+iyLLjZzfkwJK3gTJAY5Wm\n\tBtPV1nCANP/VKDLoCIDJDRu7zrTgeCoqiLgmlq0IH8gCMmScZlv5QvAQRLcUHkE11w\n\t7o8mtAYAOpnWscs/Ug8xV8XJZsEznWU+DMuX06hM=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"LibCamera Devel <libcamera-devel@lists.libcamera.org>","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","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 2/2] libcamera: camera: Unmap buffers\n\tbefore release","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Mon, 04 Mar 2019 23:25:38 -0000"},"content":"Before buffers can be released back to V4L2 all mappings must be unmapped.\nEnsure that buffers are released correctly by destroying the buffer pool\ncontents before freeing the resources on the stream.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/libcamera/camera.cpp | 7 ++++++-\n 1 file changed, 6 insertions(+), 1 deletion(-)","diff":"diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex 8e17085bfb50..875e1e46c89c 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -488,8 +488,13 @@ int Camera::freeBuffers()\n \t\tif (!stream->bufferPool().count())\n \t\t\tcontinue;\n \n-\t\tpipe_->freeBuffers(this, stream);\n+\t\t/*\n+\t\t * Destroy Buffers will empty the pool, and unmap any existing\n+\t\t * memory mapping. This needs to be done before releasing\n+\t\t * buffers back to the V4L2Device through freeBuffers().\n+\t\t */\n \t\tstream->bufferPool().destroyBuffers();\n+\t\tpipe_->freeBuffers(this, stream);\n \t}\n \n \tstate_ = CameraConfigured;\n","prefixes":["libcamera-devel","2/2"]}