[{"id":3418,"web_url":"https://patchwork.libcamera.org/comment/3418/","msgid":"<20200111022821.GU4859@pendragon.ideasonboard.com>","date":"2020-01-11T02:28:21","subject":"Re: [libcamera-devel] [PATCH] libcamera: ipa_interface: Document\n\tthe ownership of dmabufs passed to mapBuffers()","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nThank you for the patch.\n\nOn Fri, Jan 10, 2020 at 12:26:47AM +0100, Niklas Söderlund wrote:\n> The ownership of the dmabuf file handles passed to mapBuffers() is not\n> clear. Explicitly document that they are borrowed from the callee and\n> only guaranteed to be valid for the duration of the mapBuffers() call.\n> \n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> ---\n>  src/libcamera/ipa_interface.cpp | 3 +++\n>  1 file changed, 3 insertions(+)\n> \n> diff --git a/src/libcamera/ipa_interface.cpp b/src/libcamera/ipa_interface.cpp\n> index ee3e3622f39ae85f..25b075fef5a50db7 100644\n> --- a/src/libcamera/ipa_interface.cpp\n> +++ b/src/libcamera/ipa_interface.cpp\n> @@ -429,6 +429,9 @@ namespace libcamera {\n>   * handler that the IPA needs to access. It provides dmabuf file handles for\n>   * each buffer, and associates the buffers with unique numerical IDs.\n>   *\n> + * The dmabuf file handles provided in \\a buffers are borrowed from the callee\n\ns/handles/descriptors/\n\ns/callee/caller/ ?\n\n> + * and are only guaranteed to be valid during the mapBuffers() call.\n\nBut I think this isn't needed anymore, now that IPABuffer stores\nFileDescriptor instances and FileDescriptor has become cheap to copy.\n\nWe should however document ownerhip of the dmabuf fds in the C API, as\nwe have no C++ object to make it explicit there. You can simply move\nthis paragraph to the documentation of ipa_context_ops::map_buffers,\nwith s/mapBuffers()/map_buffers()/ and maybe the following sentence\nadded.\n\n * Should the callee need to store a copy of the file descriptors, it\n * shall duplicate them first with ::dup().\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> + *\n>   * IPAs shall map the dmabuf file handles to their address space and keep a\n>   * cache of the mappings, indexed by the buffer numerical IDs. The IDs are used\n>   * in all other IPA interface methods to refer to buffers, including the","headers":{"Return-Path":"<laurent.pinchart@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 0104D6045A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 11 Jan 2020 03:28:34 +0100 (CET)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 694059B1;\n\tSat, 11 Jan 2020 03:28:34 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1578709714;\n\tbh=Uy+kzEKJtEe9mNar0wfAURtrjEW3Wo+empcWaQVTwDM=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=jRFGRtpCKDUMb9C7p6iIHE3uSpcH3so89Mf4Nk62knlhALNGU6oZ7NpL26vw/yNym\n\tb//0Uf/ntLQ7j/uE/LPcQ7E9xon/8yWomgBNKXbJMUebNCAlFZty9KbwKfgaWFv/iJ\n\t8/j9YhdQz8Pk0nETEVf2aQVrTZJD7BCRLUPRLIOI=","Date":"Sat, 11 Jan 2020 04:28:21 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200111022821.GU4859@pendragon.ideasonboard.com>","References":"<20200109232647.2068851-1-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20200109232647.2068851-1-niklas.soderlund@ragnatech.se>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH] libcamera: ipa_interface: Document\n\tthe ownership of dmabufs passed to mapBuffers()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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":"Sat, 11 Jan 2020 02:28:35 -0000"}}]