[{"id":1221,"web_url":"https://patchwork.libcamera.org/comment/1221/","msgid":"<20190402173923.GQ4805@pendragon.ideasonboard.com>","date":"2019-04-02T17:39:23","subject":"Re: [libcamera-devel] [PATCH v7 07/13] libcamera: ipu3: Implement\n\tmemory handling","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Tue, Apr 02, 2019 at 07:13:03PM +0200, Jacopo Mondi wrote:\n> Implement buffer allocation and relase in IPU3 pipeline handlers.\n\ns/relase/release/\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> As the pipeline handler currently supports a single stream, provide two\n> internal buffer pools for 'viewfinder' and 'stat' video devices, and\n> export the 'output' video device buffers to the stream's pool. This\n> works around the fact that the ImgU requires buffers to be queued on all\n> its outputs, even when they are not in use.\n> \n> Share buffers between the CIO2 output and the ImgU input video devices,\n> as the output of the former should immediately be provided to the\n> latter for further processing.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 154 ++++++++++++++++++++++++---\n>  1 file changed, 140 insertions(+), 14 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index 57e4bb89eaa7..7eac36f0c561 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -56,6 +56,7 @@ public:\n>  \t\tV4L2Device *dev;\n>  \t\tunsigned int pad;\n>  \t\tstd::string name;\n> +\t\tBufferPool *pool;\n>  \t};\n>  \n>  \tImgUDevice()\n> @@ -81,6 +82,10 @@ public:\n>  \tint configureOutput(const ImgUOutput *output,\n>  \t\t\t    const StreamConfiguration &config);\n>  \n> +\tint importBuffers(BufferPool *pool);\n> +\tint exportBuffers(ImgUOutput *output, BufferPool *pool);\n> +\tvoid freeBuffers();\n> +\n>  \tunsigned int index_;\n>  \tstd::string name_;\n>  \tMediaDevice *media_;\n> @@ -91,11 +96,16 @@ public:\n>  \tImgUOutput viewfinder_;\n>  \tImgUOutput stat_;\n>  \t/* \\todo Add param video device for 3A tuning */\n> +\n> +\tBufferPool vfPool_;\n> +\tBufferPool statPool_;\n>  };\n>  \n>  class CIO2Device\n>  {\n>  public:\n> +\tstatic constexpr unsigned int CIO2_BUFFER_COUNT = 4;\n> +\n>  \tCIO2Device()\n>  \t\t: output_(nullptr), csi2_(nullptr), sensor_(nullptr)\n>  \t{\n> @@ -112,6 +122,9 @@ public:\n>  \tint configure(const StreamConfiguration &config,\n>  \t\t      V4L2DeviceFormat *format);\n>  \n> +\tBufferPool *exportBuffers();\n> +\tvoid freeBuffers();\n> +\n>  \tV4L2Device *output_;\n>  \tV4L2Subdevice *csi2_;\n>  \tV4L2Subdevice *sensor_;\n> @@ -119,6 +132,8 @@ public:\n>  \t/* Maximum sizes and the mbus code used to produce them. */\n>  \tunsigned int mbusCode_;\n>  \tSize maxSize_;\n> +\n> +\tBufferPool pool_;\n>  };\n>  \n>  class PipelineHandlerIPU3 : public PipelineHandler\n> @@ -282,18 +297,41 @@ int PipelineHandlerIPU3::configureStreams(Camera *camera,\n>  \n>  int PipelineHandlerIPU3::allocateBuffers(Camera *camera, Stream *stream)\n>  {\n> -\tconst StreamConfiguration &cfg = stream->configuration();\n>  \tIPU3CameraData *data = cameraData(camera);\n> -\tV4L2Device *cio2 = data->cio2_.output_;\n> +\tCIO2Device *cio2 = &data->cio2_;\n> +\tImgUDevice *imgu = data->imgu_;\n> +\tint ret;\n>  \n> -\tif (!cfg.bufferCount)\n> -\t\treturn -EINVAL;\n> +\t/* Share buffers between CIO2 output and ImgU input. */\n> +\tBufferPool *pool = cio2->exportBuffers();\n> +\tif (!pool)\n> +\t\treturn -ENOMEM;\n>  \n> -\tint ret = cio2->exportBuffers(&stream->bufferPool());\n> -\tif (ret) {\n> -\t\tLOG(IPU3, Error) << \"Failed to request memory\";\n> +\tret = imgu->importBuffers(pool);\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n> +\t/* Export ImgU output buffers to the stream's pool. */\n> +\tret = imgu->exportBuffers(&imgu->output_, &stream->bufferPool());\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n> +\t/*\n> +\t * Reserve memory in viewfinder and stat output devices. Use the\n> +\t * same number of buffers as the ones requested for the output\n> +\t * stream.\n> +\t */\n> +\tunsigned int bufferCount = stream->bufferPool().count();\n> +\n> +\timgu->viewfinder_.pool->createBuffers(bufferCount);\n> +\tret = imgu->exportBuffers(&imgu->viewfinder_, imgu->viewfinder_.pool);\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n> +\timgu->stat_.pool->createBuffers(bufferCount);\n> +\tret = imgu->exportBuffers(&imgu->stat_, imgu->stat_.pool);\n> +\tif (ret)\n>  \t\treturn ret;\n> -\t}\n>  \n>  \treturn 0;\n>  }\n> @@ -301,13 +339,9 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera, Stream *stream)\n>  int PipelineHandlerIPU3::freeBuffers(Camera *camera, Stream *stream)\n>  {\n>  \tIPU3CameraData *data = cameraData(camera);\n> -\tV4L2Device *cio2 = data->cio2_.output_;\n>  \n> -\tint ret = cio2->releaseBuffers();\n> -\tif (ret) {\n> -\t\tLOG(IPU3, Error) << \"Failed to release memory\";\n> -\t\treturn ret;\n> -\t}\n> +\tdata->cio2_.freeBuffers();\n> +\tdata->imgu_->freeBuffers();\n>  \n>  \treturn 0;\n>  }\n> @@ -567,6 +601,7 @@ int ImgUDevice::init(MediaDevice *media, unsigned int index)\n>  \n>  \tviewfinder_.pad = PAD_VF;\n>  \tviewfinder_.name = \"viewfinder\";\n> +\tviewfinder_.pool = &vfPool_;\n>  \n>  \tstat_.dev = V4L2Device::fromEntityName(media, name_ + \" 3a stat\");\n>  \tret = stat_.dev->open();\n> @@ -575,6 +610,7 @@ int ImgUDevice::init(MediaDevice *media, unsigned int index)\n>  \n>  \tstat_.pad = PAD_STAT;\n>  \tstat_.name = \"stat\";\n> +\tstat_.pool = &statPool_;\n>  \n>  \treturn 0;\n>  }\n> @@ -679,6 +715,69 @@ int ImgUDevice::configureOutput(const ImgUOutput *output,\n>  \treturn 0;\n>  }\n>  \n> +/**\n> + * \\brief Import buffers from CIO2 device into the ImgU\n> + * \\param[in] pool The buffer pool to import\n> + *\n> + * \\return 0 on success or a negative error code otherwise\n> + */\n> +int ImgUDevice::importBuffers(BufferPool *pool)\n> +{\n> +\tint ret = input_->importBuffers(pool);\n> +\tif (ret) {\n> +\t\tLOG(IPU3, Error) << \"Failed to import ImgU input buffers\";\n> +\t\treturn ret;\n> +\t}\n> +\n> +\treturn 0;\n> +}\n> +\n> +/**\n> + * \\brief Export buffers from \\a output to the provided \\a pool\n> + * \\param[in] output The ImgU output device\n> + * \\param[in] pool The buffer pool where to export buffers\n> + *\n> + * Export memory buffers reserved in the video device memory associated with\n> + * \\a output id to the buffer pool provided as argument.\n> + *\n> + * \\return 0 on success or a negative error code otherwise\n> + */\n> +int ImgUDevice::exportBuffers(ImgUOutput *output, BufferPool *pool)\n> +{\n> +\tint ret = output->dev->exportBuffers(pool);\n> +\tif (ret) {\n> +\t\tLOG(IPU3, Error) << \"Failed to export ImgU \"\n> +\t\t\t\t << output->name << \" buffers\";\n> +\t\treturn ret;\n> +\t}\n> +\n> +\treturn 0;\n> +}\n> +\n> +/**\n> + * \\brief Release buffers for all the ImgU video devices\n> + */\n> +void ImgUDevice::freeBuffers()\n> +{\n> +\tint ret;\n> +\n> +\tret = output_.dev->releaseBuffers();\n> +\tif (ret)\n> +\t\tLOG(IPU3, Error) << \"Failed to release ImgU output buffers\";\n> +\n> +\tret = stat_.dev->releaseBuffers();\n> +\tif (ret)\n> +\t\tLOG(IPU3, Error) << \"Failed to release ImgU stat buffers\";\n> +\n> +\tret = viewfinder_.dev->releaseBuffers();\n> +\tif (ret)\n> +\t\tLOG(IPU3, Error) << \"Failed to release ImgU viewfinder buffers\";\n> +\n> +\tret = input_->releaseBuffers();\n> +\tif (ret)\n> +\t\tLOG(IPU3, Error) << \"Failed to release ImgU input buffers\";\n> +}\n> +\n>  /*------------------------------------------------------------------------------\n>   * CIO2 Device\n>   */\n> @@ -845,6 +944,33 @@ int CIO2Device::configure(const StreamConfiguration &config,\n>  \treturn 0;\n>  }\n>  \n> +/**\n> + * \\brief Allocate CIO2 memory buffers and export them in a BufferPool\n> + *\n> + * Allocate memory buffers in the CIO2 video device and export them to\n> + * a buffer pool that can be imported by another device.\n> + *\n> + * \\return The buffer pool with export buffers on success or nullptr otherwise\n> + */\n> +BufferPool *CIO2Device::exportBuffers()\n> +{\n> +\tpool_.createBuffers(CIO2_BUFFER_COUNT);\n> +\n> +\tint ret = output_->exportBuffers(&pool_);\n> +\tif (ret) {\n> +\t\tLOG(IPU3, Error) << \"Failed to export CIO2 buffers\";\n> +\t\treturn nullptr;\n> +\t}\n> +\n> +\treturn &pool_;\n> +}\n> +\n> +void CIO2Device::freeBuffers()\n> +{\n> +\tif (output_->releaseBuffers())\n> +\t\tLOG(IPU3, Error) << \"Failed to release CIO2 buffers\";\n> +}\n> +\n>  REGISTER_PIPELINE_HANDLER(PipelineHandlerIPU3);\n>  \n>  } /* namespace libcamera */","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 322F9610B6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Apr 2019 19:39:35 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8AB162DA;\n\tTue,  2 Apr 2019 19:39:34 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1554226774;\n\tbh=8sghLb1Im44OsgPZIinVIbvnlpOd92jQ/nfyiP3y5aQ=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=jX2Glk4ilSuHPVl7fJEPOx9OEdAIqKfqQS7rLGbGPXT4e3+HBEyJSJQadxjapQz08\n\tr3KGk5ShD1yZ+nwXYYNdFDgTxoIKAzVmHygZ020/c9Fz7KLUdw3hOWH1brrt8U+1rI\n\t4juBbtoFWPBkWGat0BtMxlFM2d+PWof0i9ez3ctk=","Date":"Tue, 2 Apr 2019 20:39:23 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190402173923.GQ4805@pendragon.ideasonboard.com>","References":"<20190402171309.6447-1-jacopo@jmondi.org>\n\t<20190402171309.6447-8-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190402171309.6447-8-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v7 07/13] libcamera: ipu3: Implement\n\tmemory handling","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":"Tue, 02 Apr 2019 17:39:35 -0000"}},{"id":1229,"web_url":"https://patchwork.libcamera.org/comment/1229/","msgid":"<20190402182538.GD23466@bigcity.dyn.berto.se>","date":"2019-04-02T18:25:39","subject":"Re: [libcamera-devel] [PATCH v7 07/13] libcamera: ipu3: Implement\n\tmemory handling","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your patch.\n\nOn 2019-04-02 19:13:03 +0200, Jacopo Mondi wrote:\n> Implement buffer allocation and relase in IPU3 pipeline handlers.\n> \n> As the pipeline handler currently supports a single stream, provide two\n> internal buffer pools for 'viewfinder' and 'stat' video devices, and\n> export the 'output' video device buffers to the stream's pool. This\n> works around the fact that the ImgU requires buffers to be queued on all\n> its outputs, even when they are not in use.\n\nSeems like a fun device :-)\n\n> \n> Share buffers between the CIO2 output and the ImgU input video devices,\n> as the output of the former should immediately be provided to the\n> latter for further processing.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 154 ++++++++++++++++++++++++---\n>  1 file changed, 140 insertions(+), 14 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index 57e4bb89eaa7..7eac36f0c561 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -56,6 +56,7 @@ public:\n>  \t\tV4L2Device *dev;\n>  \t\tunsigned int pad;\n>  \t\tstd::string name;\n> +\t\tBufferPool *pool;\n>  \t};\n>  \n>  \tImgUDevice()\n> @@ -81,6 +82,10 @@ public:\n>  \tint configureOutput(const ImgUOutput *output,\n>  \t\t\t    const StreamConfiguration &config);\n>  \n> +\tint importBuffers(BufferPool *pool);\n> +\tint exportBuffers(ImgUOutput *output, BufferPool *pool);\n> +\tvoid freeBuffers();\n> +\n>  \tunsigned int index_;\n>  \tstd::string name_;\n>  \tMediaDevice *media_;\n> @@ -91,11 +96,16 @@ public:\n>  \tImgUOutput viewfinder_;\n>  \tImgUOutput stat_;\n>  \t/* \\todo Add param video device for 3A tuning */\n> +\n> +\tBufferPool vfPool_;\n> +\tBufferPool statPool_;\n>  };\n>  \n>  class CIO2Device\n>  {\n>  public:\n> +\tstatic constexpr unsigned int CIO2_BUFFER_COUNT = 4;\n> +\n>  \tCIO2Device()\n>  \t\t: output_(nullptr), csi2_(nullptr), sensor_(nullptr)\n>  \t{\n> @@ -112,6 +122,9 @@ public:\n>  \tint configure(const StreamConfiguration &config,\n>  \t\t      V4L2DeviceFormat *format);\n>  \n> +\tBufferPool *exportBuffers();\n> +\tvoid freeBuffers();\n> +\n>  \tV4L2Device *output_;\n>  \tV4L2Subdevice *csi2_;\n>  \tV4L2Subdevice *sensor_;\n> @@ -119,6 +132,8 @@ public:\n>  \t/* Maximum sizes and the mbus code used to produce them. */\n>  \tunsigned int mbusCode_;\n>  \tSize maxSize_;\n> +\n> +\tBufferPool pool_;\n>  };\n>  \n>  class PipelineHandlerIPU3 : public PipelineHandler\n> @@ -282,18 +297,41 @@ int PipelineHandlerIPU3::configureStreams(Camera *camera,\n>  \n>  int PipelineHandlerIPU3::allocateBuffers(Camera *camera, Stream *stream)\n>  {\n> -\tconst StreamConfiguration &cfg = stream->configuration();\n>  \tIPU3CameraData *data = cameraData(camera);\n> -\tV4L2Device *cio2 = data->cio2_.output_;\n> +\tCIO2Device *cio2 = &data->cio2_;\n> +\tImgUDevice *imgu = data->imgu_;\n> +\tint ret;\n>  \n> -\tif (!cfg.bufferCount)\n> -\t\treturn -EINVAL;\n> +\t/* Share buffers between CIO2 output and ImgU input. */\n> +\tBufferPool *pool = cio2->exportBuffers();\n> +\tif (!pool)\n> +\t\treturn -ENOMEM;\n>  \n> -\tint ret = cio2->exportBuffers(&stream->bufferPool());\n> -\tif (ret) {\n> -\t\tLOG(IPU3, Error) << \"Failed to request memory\";\n> +\tret = imgu->importBuffers(pool);\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n> +\t/* Export ImgU output buffers to the stream's pool. */\n> +\tret = imgu->exportBuffers(&imgu->output_, &stream->bufferPool());\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n> +\t/*\n> +\t * Reserve memory in viewfinder and stat output devices. Use the\n> +\t * same number of buffers as the ones requested for the output\n> +\t * stream.\n> +\t */\n> +\tunsigned int bufferCount = stream->bufferPool().count();\n> +\n> +\timgu->viewfinder_.pool->createBuffers(bufferCount);\n> +\tret = imgu->exportBuffers(&imgu->viewfinder_, imgu->viewfinder_.pool);\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n> +\timgu->stat_.pool->createBuffers(bufferCount);\n> +\tret = imgu->exportBuffers(&imgu->stat_, imgu->stat_.pool);\n> +\tif (ret)\n>  \t\treturn ret;\n> -\t}\n>  \n>  \treturn 0;\n>  }\n> @@ -301,13 +339,9 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera, Stream *stream)\n>  int PipelineHandlerIPU3::freeBuffers(Camera *camera, Stream *stream)\n>  {\n>  \tIPU3CameraData *data = cameraData(camera);\n> -\tV4L2Device *cio2 = data->cio2_.output_;\n>  \n> -\tint ret = cio2->releaseBuffers();\n> -\tif (ret) {\n> -\t\tLOG(IPU3, Error) << \"Failed to release memory\";\n> -\t\treturn ret;\n> -\t}\n> +\tdata->cio2_.freeBuffers();\n> +\tdata->imgu_->freeBuffers();\n>  \n>  \treturn 0;\n>  }\n> @@ -567,6 +601,7 @@ int ImgUDevice::init(MediaDevice *media, unsigned int index)\n>  \n>  \tviewfinder_.pad = PAD_VF;\n>  \tviewfinder_.name = \"viewfinder\";\n> +\tviewfinder_.pool = &vfPool_;\n>  \n>  \tstat_.dev = V4L2Device::fromEntityName(media, name_ + \" 3a stat\");\n>  \tret = stat_.dev->open();\n> @@ -575,6 +610,7 @@ int ImgUDevice::init(MediaDevice *media, unsigned int index)\n>  \n>  \tstat_.pad = PAD_STAT;\n>  \tstat_.name = \"stat\";\n> +\tstat_.pool = &statPool_;\n>  \n>  \treturn 0;\n>  }\n> @@ -679,6 +715,69 @@ int ImgUDevice::configureOutput(const ImgUOutput *output,\n>  \treturn 0;\n>  }\n>  \n> +/**\n> + * \\brief Import buffers from CIO2 device into the ImgU\n> + * \\param[in] pool The buffer pool to import\n> + *\n> + * \\return 0 on success or a negative error code otherwise\n> + */\n> +int ImgUDevice::importBuffers(BufferPool *pool)\n> +{\n> +\tint ret = input_->importBuffers(pool);\n> +\tif (ret) {\n> +\t\tLOG(IPU3, Error) << \"Failed to import ImgU input buffers\";\n> +\t\treturn ret;\n> +\t}\n> +\n> +\treturn 0;\n> +}\n> +\n> +/**\n> + * \\brief Export buffers from \\a output to the provided \\a pool\n> + * \\param[in] output The ImgU output device\n> + * \\param[in] pool The buffer pool where to export buffers\n> + *\n> + * Export memory buffers reserved in the video device memory associated with\n> + * \\a output id to the buffer pool provided as argument.\n> + *\n> + * \\return 0 on success or a negative error code otherwise\n> + */\n> +int ImgUDevice::exportBuffers(ImgUOutput *output, BufferPool *pool)\n> +{\n> +\tint ret = output->dev->exportBuffers(pool);\n> +\tif (ret) {\n> +\t\tLOG(IPU3, Error) << \"Failed to export ImgU \"\n> +\t\t\t\t << output->name << \" buffers\";\n> +\t\treturn ret;\n> +\t}\n> +\n> +\treturn 0;\n> +}\n> +\n> +/**\n> + * \\brief Release buffers for all the ImgU video devices\n> + */\n> +void ImgUDevice::freeBuffers()\n> +{\n> +\tint ret;\n> +\n> +\tret = output_.dev->releaseBuffers();\n> +\tif (ret)\n> +\t\tLOG(IPU3, Error) << \"Failed to release ImgU output buffers\";\n> +\n> +\tret = stat_.dev->releaseBuffers();\n> +\tif (ret)\n> +\t\tLOG(IPU3, Error) << \"Failed to release ImgU stat buffers\";\n> +\n> +\tret = viewfinder_.dev->releaseBuffers();\n> +\tif (ret)\n> +\t\tLOG(IPU3, Error) << \"Failed to release ImgU viewfinder buffers\";\n> +\n> +\tret = input_->releaseBuffers();\n> +\tif (ret)\n> +\t\tLOG(IPU3, Error) << \"Failed to release ImgU input buffers\";\n> +}\n> +\n>  /*------------------------------------------------------------------------------\n>   * CIO2 Device\n>   */\n> @@ -845,6 +944,33 @@ int CIO2Device::configure(const StreamConfiguration &config,\n>  \treturn 0;\n>  }\n>  \n> +/**\n> + * \\brief Allocate CIO2 memory buffers and export them in a BufferPool\n> + *\n> + * Allocate memory buffers in the CIO2 video device and export them to\n> + * a buffer pool that can be imported by another device.\n> + *\n> + * \\return The buffer pool with export buffers on success or nullptr otherwise\n> + */\n> +BufferPool *CIO2Device::exportBuffers()\n> +{\n> +\tpool_.createBuffers(CIO2_BUFFER_COUNT);\n> +\n> +\tint ret = output_->exportBuffers(&pool_);\n> +\tif (ret) {\n> +\t\tLOG(IPU3, Error) << \"Failed to export CIO2 buffers\";\n> +\t\treturn nullptr;\n> +\t}\n> +\n> +\treturn &pool_;\n> +}\n> +\n> +void CIO2Device::freeBuffers()\n> +{\n> +\tif (output_->releaseBuffers())\n> +\t\tLOG(IPU3, Error) << \"Failed to release CIO2 buffers\";\n> +}\n> +\n>  REGISTER_PIPELINE_HANDLER(PipelineHandlerIPU3);\n>  \n>  } /* namespace libcamera */\n> -- \n> 2.21.0\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com\n\t[IPv6:2a00:1450:4864:20::22c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8C62F610BF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Apr 2019 20:25:40 +0200 (CEST)","by mail-lj1-x22c.google.com with SMTP id h21so12451476ljk.13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 02 Apr 2019 11:25:40 -0700 (PDT)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\tn2sm2569966lfe.71.2019.04.02.11.25.39\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tTue, 02 Apr 2019 11:25:39 -0700 (PDT)"],"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\t:user-agent; bh=BtSooiO4q0xQZ88rhG5otlhbBsLDyPLB9wwsLakO2gI=;\n\tb=wdlRYfJGATE7o5D5yed/yo6+GAfwjlVYG8lpmEXWLsMa7/0XB2ReIHnS3Vkj+ykqjy\n\tksDxvNk/qGdCpDpwRsMa4hKSxUAidjd0JQlvHiGVC18THCPDfEanqmXJ3it5XLt3AFLp\n\t1eUa7WbmyyOhE86v/h12BjPg1xASmeLK3XIf0SzFjCNvfOeV34yl+V5WfCgGn7ahPDEH\n\t50B9GDJVcthXK/jN5xi5YmJB32IoLvh34qkooTInWIYHQS5Gdxz9OXPu3zONlHaw9G7L\n\ts+iV/yyErsab9Xlx1a/iMwkD52iBPXUbGg46uYJ7nSm7Eii05WfWIWx85TcuOdEEIG5F\n\tccwQ==","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:user-agent;\n\tbh=BtSooiO4q0xQZ88rhG5otlhbBsLDyPLB9wwsLakO2gI=;\n\tb=QytL7YVmQ8/0F9ei2Qg72LMkt1mHlkoSvtbShXgPVMTIZWGJKVFAGnqnQDXIJ2/Ihh\n\tdj+7fGwfn614Xb1xbp33oanlzbiMUczM5Vz+SQ0NQbPoq7ktFFIQFPA7N5vgmmWbenCf\n\tGBk10YyF5mZs9tnn1Rb4iU2Ab3brK2kPfCaMSBZqGPuDXAr6cgR5W+3A2NX+kz9kJZRL\n\tLHctP7sGt/QrCBG4roCcFmGFa5pnYpBfcJobEjj9reAx8TTxxc1g/5Yy4J29HINTFIj0\n\t63A9nyqPlC7DD/9VfTRR940ppfaKNckOZ6gfKCUHk3gxOBNjFY11hL5ieaqqrjCdAdif\n\tk9oA==","X-Gm-Message-State":"APjAAAW1Sl6opXI5GTL+tmsy8Jp8rr8Vhnlu/CBs61bTmTE61oFJjoyw\n\tYFenVzImtwB4GvDiYxsAXJsh/Q==","X-Google-Smtp-Source":"APXvYqxDzc/v6hCAfSUf8QroMu7vpSQiMaObw2qkQDjAbUnAUSUNhlFg5jBGU1p0pbmqfZVEr7Prnw==","X-Received":"by 2002:a2e:8ece:: with SMTP id\n\te14mr25448136ljl.66.1554229539998; \n\tTue, 02 Apr 2019 11:25:39 -0700 (PDT)","Date":"Tue, 2 Apr 2019 20:25:39 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190402182538.GD23466@bigcity.dyn.berto.se>","References":"<20190402171309.6447-1-jacopo@jmondi.org>\n\t<20190402171309.6447-8-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190402171309.6447-8-jacopo@jmondi.org>","User-Agent":"Mutt/1.11.3 (2019-02-01)","Subject":"Re: [libcamera-devel] [PATCH v7 07/13] libcamera: ipu3: Implement\n\tmemory handling","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":"Tue, 02 Apr 2019 18:25:40 -0000"}}]