[{"id":14979,"web_url":"https://patchwork.libcamera.org/comment/14979/","msgid":"<YBwtY6k8agD+BIP8@pendragon.ideasonboard.com>","date":"2021-02-04T17:22:43","subject":"Re: [libcamera-devel] [PATCH v3 10/11] libcamera: ipu3: Add helper\n\tfor parameter and statistic buffers","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Thu, Feb 04, 2021 at 05:29:42PM +0100, Niklas Söderlund wrote:\n> Add a helper class to aid in associating a parameter and statistic\n> buffer with each request queued to the pipeline. The helper helps with\n> tracking the state of the extra buffers and in completing the request\n> once all extra processing is done.\n> \n> This change only adds the helper more work is needed to integrate it\n> with the pipeline and an IPA.\n> \n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n> * Changes since v1\n> - Move mapping of buffers to IPA to the pipeline handler and a separate\n>   patch.\n> - Move all pipeline interactions out of helper.\n> \n> * Changes since v2\n> - Add todo to remove dynamic memory allocation.\n> - Remove unused find(Request *request).\n> ---\n>  src/libcamera/pipeline/ipu3/frames.cpp  | 129 ++++++++++++++++++++++++\n>  src/libcamera/pipeline/ipu3/frames.h    |  61 +++++++++++\n>  src/libcamera/pipeline/ipu3/meson.build |   1 +\n>  3 files changed, 191 insertions(+)\n>  create mode 100644 src/libcamera/pipeline/ipu3/frames.cpp\n>  create mode 100644 src/libcamera/pipeline/ipu3/frames.h\n> \n> diff --git a/src/libcamera/pipeline/ipu3/frames.cpp b/src/libcamera/pipeline/ipu3/frames.cpp\n> new file mode 100644\n> index 0000000000000000..b7f7f0a6575714d9\n> --- /dev/null\n> +++ b/src/libcamera/pipeline/ipu3/frames.cpp\n> @@ -0,0 +1,129 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2020, Google Inc.\n> + *\n> + * frames.cpp - Intel IPU3 Frames helper\n> + */\n> +\n> +#include \"frames.h\"\n> +\n> +#include <libcamera/buffer.h>\n> +#include <libcamera/request.h>\n> +\n> +#include \"libcamera/internal/pipeline_handler.h\"\n> +#include \"libcamera/internal/v4l2_videodevice.h\"\n> +\n> +namespace libcamera {\n> +\n> +LOG_DECLARE_CATEGORY(IPU3)\n> +\n> +IPU3Frames::IPU3Frames()\n> +\t: nextId_(0)\n> +{\n> +}\n> +\n> +void IPU3Frames::init(const std::vector<std::unique_ptr<FrameBuffer>> &paramBuffers,\n> +\t\t      const std::vector<std::unique_ptr<FrameBuffer>> &statBuffers)\n> +{\n> +\tfor (const std::unique_ptr<FrameBuffer> &buffer : paramBuffers)\n> +\t\tavailableParamBuffers_.push(buffer.get());\n> +\n> +\tfor (const std::unique_ptr<FrameBuffer> &buffer : statBuffers)\n> +\t\tavailableStatBuffers_.push(buffer.get());\n> +\n> +\tnextId_ = 0;\n> +\tframeInfo_.clear();\n> +}\n> +\n> +void IPU3Frames::clear()\n> +{\n> +\tavailableParamBuffers_ = {};\n> +\tavailableStatBuffers_ = {};\n> +}\n> +\n> +IPU3Frames::Info *IPU3Frames::create(Request *request)\n> +{\n> +\tunsigned int id = nextId_++;\n> +\n> +\tif (availableParamBuffers_.empty()) {\n> +\t\tLOG(IPU3, Error) << \"Parameters buffer underrun\";\n> +\t\treturn nullptr;\n> +\t}\n> +\tFrameBuffer *paramBuffer = availableParamBuffers_.front();\n> +\n> +\tif (availableStatBuffers_.empty()) {\n> +\t\tLOG(IPU3, Error) << \"Statisitc buffer underrun\";\n> +\t\treturn nullptr;\n> +\t}\n> +\tFrameBuffer *statBuffer = availableStatBuffers_.front();\n> +\n> +\tavailableParamBuffers_.pop();\n> +\tavailableStatBuffers_.pop();\n> +\n> +\t/* \\todo Remove the dynamic allocation of Info */\n> +\tstd::unique_ptr<Info> info = std::make_unique<Info>();\n> +\n> +\tinfo->id = id;\n> +\tinfo->request = request;\n> +\tinfo->rawBuffer = nullptr;\n> +\tinfo->paramBuffer = paramBuffer;\n> +\tinfo->statBuffer = statBuffer;\n> +\tinfo->paramDequeued = false;\n> +\tinfo->metadataProcessed = false;\n> +\n> +\tframeInfo_[id] = std::move(info);\n> +\n> +\treturn frameInfo_[id].get();\n> +}\n> +\n> +bool IPU3Frames::tryComplete(IPU3Frames::Info *info)\n> +{\n> +\tRequest *request = info->request;\n> +\n> +\tif (request->hasPendingBuffers())\n> +\t\treturn false;\n> +\n> +\tif (!info->metadataProcessed)\n> +\t\treturn false;\n> +\n> +\tif (!info->paramDequeued)\n> +\t\treturn false;\n> +\n> +\t/* Return params and stat buffer for reuse. */\n> +\tavailableParamBuffers_.push(info->paramBuffer);\n> +\tavailableStatBuffers_.push(info->statBuffer);\n> +\n> +\t/* Delete the extended frame information. */\n> +\tframeInfo_.erase(info->id);\n> +\n> +\treturn true;\n> +}\n> +\n> +IPU3Frames::Info *IPU3Frames::find(unsigned int id)\n> +{\n> +\tconst auto &itInfo = frameInfo_.find(id);\n> +\n> +\tif (itInfo != frameInfo_.end())\n> +\t\treturn itInfo->second.get();\n> +\n> +\treturn nullptr;\n> +}\n> +\n> +IPU3Frames::Info *IPU3Frames::find(FrameBuffer *buffer)\n> +{\n> +\tfor (auto const &itInfo : frameInfo_) {\n> +\t\tInfo *info = itInfo.second.get();\n> +\n> +\t\tfor (auto const itBuffers : info->request->buffers())\n> +\t\t\tif (itBuffers.second == buffer)\n> +\t\t\t\treturn info;\n> +\n> +\t\tif (info->rawBuffer == buffer || info->paramBuffer == buffer ||\n> +\t\t    info->statBuffer == buffer)\n> +\t\t\treturn info;\n> +\t}\n> +\n> +\treturn nullptr;\n> +}\n> +\n> +} /* namespace libcamera */\n> diff --git a/src/libcamera/pipeline/ipu3/frames.h b/src/libcamera/pipeline/ipu3/frames.h\n> new file mode 100644\n> index 0000000000000000..93379d20722d65fb\n> --- /dev/null\n> +++ b/src/libcamera/pipeline/ipu3/frames.h\n> @@ -0,0 +1,61 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2020, Google Inc.\n> + *\n> + * frames.h - Intel IPU3 Frames helper\n> + */\n> +#ifndef __LIBCAMERA_PIPELINE_IPU3_FRAMES_H__\n> +#define __LIBCAMERA_PIPELINE_IPU3_FRAMES_H__\n> +\n> +#include <map>\n> +#include <memory>\n> +#include <queue>\n> +#include <vector>\n> +\n> +namespace libcamera {\n> +\n> +class FrameBuffer;\n> +class IPAProxy;\n> +class PipelineHandler;\n> +class Request;\n> +class V4L2VideoDevice;\n> +struct IPABuffer;\n> +\n> +class IPU3Frames\n> +{\n> +public:\n> +\tstruct Info {\n> +\t\tunsigned int id;\n> +\t\tRequest *request;\n> +\n> +\t\tFrameBuffer *rawBuffer;\n> +\t\tFrameBuffer *paramBuffer;\n> +\t\tFrameBuffer *statBuffer;\n> +\n> +\t\tbool paramDequeued;\n> +\t\tbool metadataProcessed;\n> +\t};\n> +\n> +\tIPU3Frames();\n> +\n> +\tvoid init(const std::vector<std::unique_ptr<FrameBuffer>> &paramBuffers,\n> +\t\t  const std::vector<std::unique_ptr<FrameBuffer>> &statBuffers);\n> +\tvoid clear();\n> +\n> +\tInfo *create(Request *request);\n> +\tbool tryComplete(IPU3Frames::Info *info);\n\nYou can write this\n\n\tbool tryComplete(Info *info);\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nOne idea for future improvements, especially if we want to share this\nhelper between pipeline handlers, would be to rework the API in a way\nthat would avoid the possibility of use-after-free if the pipeline\nhandler tries to access the info pointer after a call to tryComplete()\nthat returns true.\n\n> +\n> +\tInfo *find(unsigned int id);\n> +\tInfo *find(FrameBuffer *buffer);\n> +\n> +private:\n> +\tstd::queue<FrameBuffer *> availableParamBuffers_;\n> +\tstd::queue<FrameBuffer *> availableStatBuffers_;\n> +\n> +\tunsigned int nextId_;\n> +\tstd::map<unsigned int, std::unique_ptr<Info>> frameInfo_;\n> +};\n> +\n> +} /* namespace libcamera */\n> +\n> +#endif /* __LIBCAMERA_PIPELINE_IPU3_FRAMES_H__ */\n> diff --git a/src/libcamera/pipeline/ipu3/meson.build b/src/libcamera/pipeline/ipu3/meson.build\n> index d60e07ae6ccac2bc..a1b0b31ac5bcf864 100644\n> --- a/src/libcamera/pipeline/ipu3/meson.build\n> +++ b/src/libcamera/pipeline/ipu3/meson.build\n> @@ -2,6 +2,7 @@\n>  \n>  libcamera_sources += files([\n>      'cio2.cpp',\n> +    'frames.cpp',\n>      'imgu.cpp',\n>      'ipu3.cpp',\n>  ])","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id EA35EBD162\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  4 Feb 2021 17:23:07 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7D62761453;\n\tThu,  4 Feb 2021 18:23:07 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9A28061430\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  4 Feb 2021 18:23:06 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1FBB5510;\n\tThu,  4 Feb 2021 18:23:06 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"nwyawx1v\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1612459386;\n\tbh=hQeAYpKtnsYjUodTPcVQSNV+TIJhcNZ1AWybYYbPUD4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=nwyawx1vGKHxhXr3WVLx38c7jNV146Cc7Q/1RjnAp2yUEJF2io3K9GE3FWJ53HFgq\n\tlwYvcuatIhtkocaorCHfiDyhXqM1466vph1NNbTfgfAIxTUyr+T6D0SIUlMZ7486vh\n\tYGul0QPeJbySkcJbLDEwVWugzxAuP6/vBfdvL/7A=","Date":"Thu, 4 Feb 2021 19:22:43 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Message-ID":"<YBwtY6k8agD+BIP8@pendragon.ideasonboard.com>","References":"<20210204162943.268517-1-niklas.soderlund@ragnatech.se>\n\t<20210204162943.268517-11-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210204162943.268517-11-niklas.soderlund@ragnatech.se>","Subject":"Re: [libcamera-devel] [PATCH v3 10/11] libcamera: ipu3: Add helper\n\tfor parameter and statistic buffers","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":14996,"web_url":"https://patchwork.libcamera.org/comment/14996/","msgid":"<YBxrgaX1RLon5SVA@oden.dyn.berto.se>","date":"2021-02-04T21:47:45","subject":"Re: [libcamera-devel] [PATCH v3 10/11] libcamera: ipu3: Add helper\n\tfor parameter and statistic buffers","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your feedback.\n\nOn 2021-02-04 19:22:43 +0200, Laurent Pinchart wrote:\n> On Thu, Feb 04, 2021 at 05:29:42PM +0100, Niklas Söderlund wrote:\n> > Add a helper class to aid in associating a parameter and statistic\n> > buffer with each request queued to the pipeline. The helper helps with\n> > tracking the state of the extra buffers and in completing the request\n> > once all extra processing is done.\n> > \n> > This change only adds the helper more work is needed to integrate it\n> > with the pipeline and an IPA.\n> > \n> > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> > Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> > * Changes since v1\n> > - Move mapping of buffers to IPA to the pipeline handler and a separate\n> >   patch.\n> > - Move all pipeline interactions out of helper.\n> > \n> > * Changes since v2\n> > - Add todo to remove dynamic memory allocation.\n> > - Remove unused find(Request *request).\n> > ---\n> >  src/libcamera/pipeline/ipu3/frames.cpp  | 129 ++++++++++++++++++++++++\n> >  src/libcamera/pipeline/ipu3/frames.h    |  61 +++++++++++\n> >  src/libcamera/pipeline/ipu3/meson.build |   1 +\n> >  3 files changed, 191 insertions(+)\n> >  create mode 100644 src/libcamera/pipeline/ipu3/frames.cpp\n> >  create mode 100644 src/libcamera/pipeline/ipu3/frames.h\n> > \n> > diff --git a/src/libcamera/pipeline/ipu3/frames.cpp b/src/libcamera/pipeline/ipu3/frames.cpp\n> > new file mode 100644\n> > index 0000000000000000..b7f7f0a6575714d9\n> > --- /dev/null\n> > +++ b/src/libcamera/pipeline/ipu3/frames.cpp\n> > @@ -0,0 +1,129 @@\n> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> > +/*\n> > + * Copyright (C) 2020, Google Inc.\n> > + *\n> > + * frames.cpp - Intel IPU3 Frames helper\n> > + */\n> > +\n> > +#include \"frames.h\"\n> > +\n> > +#include <libcamera/buffer.h>\n> > +#include <libcamera/request.h>\n> > +\n> > +#include \"libcamera/internal/pipeline_handler.h\"\n> > +#include \"libcamera/internal/v4l2_videodevice.h\"\n> > +\n> > +namespace libcamera {\n> > +\n> > +LOG_DECLARE_CATEGORY(IPU3)\n> > +\n> > +IPU3Frames::IPU3Frames()\n> > +\t: nextId_(0)\n> > +{\n> > +}\n> > +\n> > +void IPU3Frames::init(const std::vector<std::unique_ptr<FrameBuffer>> &paramBuffers,\n> > +\t\t      const std::vector<std::unique_ptr<FrameBuffer>> &statBuffers)\n> > +{\n> > +\tfor (const std::unique_ptr<FrameBuffer> &buffer : paramBuffers)\n> > +\t\tavailableParamBuffers_.push(buffer.get());\n> > +\n> > +\tfor (const std::unique_ptr<FrameBuffer> &buffer : statBuffers)\n> > +\t\tavailableStatBuffers_.push(buffer.get());\n> > +\n> > +\tnextId_ = 0;\n> > +\tframeInfo_.clear();\n> > +}\n> > +\n> > +void IPU3Frames::clear()\n> > +{\n> > +\tavailableParamBuffers_ = {};\n> > +\tavailableStatBuffers_ = {};\n> > +}\n> > +\n> > +IPU3Frames::Info *IPU3Frames::create(Request *request)\n> > +{\n> > +\tunsigned int id = nextId_++;\n> > +\n> > +\tif (availableParamBuffers_.empty()) {\n> > +\t\tLOG(IPU3, Error) << \"Parameters buffer underrun\";\n> > +\t\treturn nullptr;\n> > +\t}\n> > +\tFrameBuffer *paramBuffer = availableParamBuffers_.front();\n> > +\n> > +\tif (availableStatBuffers_.empty()) {\n> > +\t\tLOG(IPU3, Error) << \"Statisitc buffer underrun\";\n> > +\t\treturn nullptr;\n> > +\t}\n> > +\tFrameBuffer *statBuffer = availableStatBuffers_.front();\n> > +\n> > +\tavailableParamBuffers_.pop();\n> > +\tavailableStatBuffers_.pop();\n> > +\n> > +\t/* \\todo Remove the dynamic allocation of Info */\n> > +\tstd::unique_ptr<Info> info = std::make_unique<Info>();\n> > +\n> > +\tinfo->id = id;\n> > +\tinfo->request = request;\n> > +\tinfo->rawBuffer = nullptr;\n> > +\tinfo->paramBuffer = paramBuffer;\n> > +\tinfo->statBuffer = statBuffer;\n> > +\tinfo->paramDequeued = false;\n> > +\tinfo->metadataProcessed = false;\n> > +\n> > +\tframeInfo_[id] = std::move(info);\n> > +\n> > +\treturn frameInfo_[id].get();\n> > +}\n> > +\n> > +bool IPU3Frames::tryComplete(IPU3Frames::Info *info)\n> > +{\n> > +\tRequest *request = info->request;\n> > +\n> > +\tif (request->hasPendingBuffers())\n> > +\t\treturn false;\n> > +\n> > +\tif (!info->metadataProcessed)\n> > +\t\treturn false;\n> > +\n> > +\tif (!info->paramDequeued)\n> > +\t\treturn false;\n> > +\n> > +\t/* Return params and stat buffer for reuse. */\n> > +\tavailableParamBuffers_.push(info->paramBuffer);\n> > +\tavailableStatBuffers_.push(info->statBuffer);\n> > +\n> > +\t/* Delete the extended frame information. */\n> > +\tframeInfo_.erase(info->id);\n> > +\n> > +\treturn true;\n> > +}\n> > +\n> > +IPU3Frames::Info *IPU3Frames::find(unsigned int id)\n> > +{\n> > +\tconst auto &itInfo = frameInfo_.find(id);\n> > +\n> > +\tif (itInfo != frameInfo_.end())\n> > +\t\treturn itInfo->second.get();\n> > +\n> > +\treturn nullptr;\n> > +}\n> > +\n> > +IPU3Frames::Info *IPU3Frames::find(FrameBuffer *buffer)\n> > +{\n> > +\tfor (auto const &itInfo : frameInfo_) {\n> > +\t\tInfo *info = itInfo.second.get();\n> > +\n> > +\t\tfor (auto const itBuffers : info->request->buffers())\n> > +\t\t\tif (itBuffers.second == buffer)\n> > +\t\t\t\treturn info;\n> > +\n> > +\t\tif (info->rawBuffer == buffer || info->paramBuffer == buffer ||\n> > +\t\t    info->statBuffer == buffer)\n> > +\t\t\treturn info;\n> > +\t}\n> > +\n> > +\treturn nullptr;\n> > +}\n> > +\n> > +} /* namespace libcamera */\n> > diff --git a/src/libcamera/pipeline/ipu3/frames.h b/src/libcamera/pipeline/ipu3/frames.h\n> > new file mode 100644\n> > index 0000000000000000..93379d20722d65fb\n> > --- /dev/null\n> > +++ b/src/libcamera/pipeline/ipu3/frames.h\n> > @@ -0,0 +1,61 @@\n> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> > +/*\n> > + * Copyright (C) 2020, Google Inc.\n> > + *\n> > + * frames.h - Intel IPU3 Frames helper\n> > + */\n> > +#ifndef __LIBCAMERA_PIPELINE_IPU3_FRAMES_H__\n> > +#define __LIBCAMERA_PIPELINE_IPU3_FRAMES_H__\n> > +\n> > +#include <map>\n> > +#include <memory>\n> > +#include <queue>\n> > +#include <vector>\n> > +\n> > +namespace libcamera {\n> > +\n> > +class FrameBuffer;\n> > +class IPAProxy;\n> > +class PipelineHandler;\n> > +class Request;\n> > +class V4L2VideoDevice;\n> > +struct IPABuffer;\n> > +\n> > +class IPU3Frames\n> > +{\n> > +public:\n> > +\tstruct Info {\n> > +\t\tunsigned int id;\n> > +\t\tRequest *request;\n> > +\n> > +\t\tFrameBuffer *rawBuffer;\n> > +\t\tFrameBuffer *paramBuffer;\n> > +\t\tFrameBuffer *statBuffer;\n> > +\n> > +\t\tbool paramDequeued;\n> > +\t\tbool metadataProcessed;\n> > +\t};\n> > +\n> > +\tIPU3Frames();\n> > +\n> > +\tvoid init(const std::vector<std::unique_ptr<FrameBuffer>> &paramBuffers,\n> > +\t\t  const std::vector<std::unique_ptr<FrameBuffer>> &statBuffers);\n> > +\tvoid clear();\n> > +\n> > +\tInfo *create(Request *request);\n> > +\tbool tryComplete(IPU3Frames::Info *info);\n> \n> You can write this\n> \n> \tbool tryComplete(Info *info);\n> \n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nThanks.\n\n> \n> One idea for future improvements, especially if we want to share this\n> helper between pipeline handlers, would be to rework the API in a way\n> that would avoid the possibility of use-after-free if the pipeline\n> handler tries to access the info pointer after a call to tryComplete()\n> that returns true.\n\nYes, that is a good idea.\n\n> \n> > +\n> > +\tInfo *find(unsigned int id);\n> > +\tInfo *find(FrameBuffer *buffer);\n> > +\n> > +private:\n> > +\tstd::queue<FrameBuffer *> availableParamBuffers_;\n> > +\tstd::queue<FrameBuffer *> availableStatBuffers_;\n> > +\n> > +\tunsigned int nextId_;\n> > +\tstd::map<unsigned int, std::unique_ptr<Info>> frameInfo_;\n> > +};\n> > +\n> > +} /* namespace libcamera */\n> > +\n> > +#endif /* __LIBCAMERA_PIPELINE_IPU3_FRAMES_H__ */\n> > diff --git a/src/libcamera/pipeline/ipu3/meson.build b/src/libcamera/pipeline/ipu3/meson.build\n> > index d60e07ae6ccac2bc..a1b0b31ac5bcf864 100644\n> > --- a/src/libcamera/pipeline/ipu3/meson.build\n> > +++ b/src/libcamera/pipeline/ipu3/meson.build\n> > @@ -2,6 +2,7 @@\n> >  \n> >  libcamera_sources += files([\n> >      'cio2.cpp',\n> > +    'frames.cpp',\n> >      'imgu.cpp',\n> >      'ipu3.cpp',\n> >  ])\n> \n> -- \n> Regards,\n> \n> Laurent Pinchart","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 4815DBD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  4 Feb 2021 21:47:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 14F3E61472;\n\tThu,  4 Feb 2021 22:47:49 +0100 (CET)","from mail-lf1-x133.google.com (mail-lf1-x133.google.com\n\t[IPv6:2a00:1450:4864:20::133])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 84BFB61430\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  4 Feb 2021 22:47:47 +0100 (CET)","by mail-lf1-x133.google.com with SMTP id h12so6812143lfp.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 04 Feb 2021 13:47:47 -0800 (PST)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\t189sm750420lfh.73.2021.02.04.13.47.45\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 04 Feb 2021 13:47:46 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com\n\theader.b=\"fYKhy4il\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to;\n\tbh=0IK9EtOE9h7At/8aeek5J7dMocV77UX0CvKUWVXNqVg=;\n\tb=fYKhy4ilmrY01P+BU/umWHYVkmDq9xxLKPFUELhBxwHo/rjchbiN/qjqEWmDx5z3tC\n\twOmKsrxNDOs4SAevIK8KO59yXzl2RyqwZPmpZA/kDHzpMuIsGyRksfWUsgBnW2I2924v\n\tpRFiEe2YVISZRHXYg6hTQeIzm8+lTYTgsgrACI7qAm3NWOlLFlrhCgEo/3P8vbUk1oH5\n\tARNNjtJVuf93feM+HqQQlbvbaYey5s7+zQsmqBrnsTNgrpRU0dGas1AIyP8hKbYzfPE2\n\tjKSusp52qLQ+yYpthqBsjpaF3sKbKx3wKCt+/uJ8+Vs/Peg+LZiIPd1/FN/smWXVqHqY\n\t0JMg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to;\n\tbh=0IK9EtOE9h7At/8aeek5J7dMocV77UX0CvKUWVXNqVg=;\n\tb=NAizjMjC8Gzfzs+hvezeJubnvcxr3SMll6h+uY/+t2Wnhef9CMT/uE4dSb5mRTQDy1\n\t3Ibpn06t5EFEWlw32P4gCe3pPkmFjygwWoUB6E609WUuTF65TW/HbjJcXevE8N3v1WRL\n\tNOEzYG6q+9uwAXNEhRlkY6Z/K6EZIK28krO4tAAif7Kypidioq5aCfIr95EuTRp1H8VK\n\t16mwMi2JxPkGpjuDrTQlv+DvCREMaTvru49VvPOEibxJMn2DhBeDcsxFNNUGVaSfxwBe\n\tJYsBgr2w4cz+4fNzLlay2FhiIcSSCT4SSp382Rau0LJKZco0a20BLLTDG7u4kuQBTM8v\n\tn9ng==","X-Gm-Message-State":"AOAM533BvhvV8ioW1GlYwzE8U3dcbQlg5a9TICZqenEmhNopCp9n1hmi\n\tCb0JZFxn6peoUyphh1fCgZxdEyfDMEaJKkxo","X-Google-Smtp-Source":"ABdhPJyYlq6VU0gcWFC7B4puGLwlbwrUwUVRzNwtW8n5GlFVt5wP+/vf7ky+0uauF5Pgxc1dBF1oKA==","X-Received":"by 2002:a19:f00b:: with SMTP id p11mr725144lfc.379.1612475266730;\n\tThu, 04 Feb 2021 13:47:46 -0800 (PST)","Date":"Thu, 4 Feb 2021 22:47:45 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<YBxrgaX1RLon5SVA@oden.dyn.berto.se>","References":"<20210204162943.268517-1-niklas.soderlund@ragnatech.se>\n\t<20210204162943.268517-11-niklas.soderlund@ragnatech.se>\n\t<YBwtY6k8agD+BIP8@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<YBwtY6k8agD+BIP8@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 10/11] libcamera: ipu3: Add helper\n\tfor parameter and statistic buffers","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"iso-8859-1\"","Content-Transfer-Encoding":"quoted-printable","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]