[{"id":1381,"web_url":"https://patchwork.libcamera.org/comment/1381/","msgid":"<20190416110329.GC4832@pendragon.ideasonboard.com>","date":"2019-04-16T11:03:29","subject":"Re: [libcamera-devel] [PATCH v5 6/7] libcamera: request: Expose the\n\tStream to Buffers map","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 16, 2019 at 01:18:58AM +0200, Jacopo Mondi wrote:\n> Add to the Request class a method to access the map to Stream to Buffer.\n\ns/to Stream/of Stream/\n\n> \n> Prepare the IPU3 pipeline handler to support multiple streams by\n> retrieving the buffers to queue from the map exposed by this change, to\n> better show the purpose of the patch.\n> \n> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  include/libcamera/request.h          |  1 +\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 19 ++++++++-----------\n>  src/libcamera/request.cpp            | 10 ++++++++++\n>  3 files changed, 19 insertions(+), 11 deletions(-)\n> \n> diff --git a/include/libcamera/request.h b/include/libcamera/request.h\n> index 6f97aa177ae0..e9687f7e14d3 100644\n> --- a/include/libcamera/request.h\n> +++ b/include/libcamera/request.h\n> @@ -32,6 +32,7 @@ public:\n>  \tRequest(const Request &) = delete;\n>  \tRequest &operator=(const Request &) = delete;\n>  \n> +\tconst std::map<Stream *, Buffer *> &buffers() const { return bufferMap_; }\n>  \tint setBuffers(const std::map<Stream *, Buffer *> &streamMap);\n>  \tBuffer *findBuffer(Stream *stream) const;\n>  \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index f96e8763bce9..7d865fa329ea 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -409,19 +409,16 @@ int PipelineHandlerIPU3::queueRequest(Camera *camera, Request *request)\n>  {\n>  \tIPU3CameraData *data = cameraData(camera);\n>  \tV4L2Device *output = data->imgu_->output_.dev;\n> -\tStream *stream = &data->stream_;\n>  \n> -\t/* Queue a buffer to the ImgU output for capture. */\n> -\tBuffer *buffer = request->findBuffer(stream);\n> -\tif (!buffer) {\n> -\t\tLOG(IPU3, Error)\n> -\t\t\t<< \"Attempt to queue request with invalid stream\";\n> -\t\treturn -ENOENT;\n> -\t}\n> +\t/* Queue buffers to the ImgU output for capture. */\n\ns/output/outputs/\n\nThis change makes no sense though, as there's a single buffer per output\n:-) I would squash it with an appropriate patch from the IPU3 rework.\nThe changes to request.h and request.cpp can stay in this patch.\n\n> +\tfor (auto &it : request->buffers()) {\n> +\t\tBuffer *buffer = it.second;\n>  \n> -\tint ret = output->queueBuffer(buffer);\n> -\tif (ret < 0)\n> -\t\treturn ret;\n> +\t\tint ret = output->queueBuffer(buffer);\n> +\t\tif (ret < 0)\n> +\t\t\treturn ret;\n> +\n\nExtra blank line.\n\n> +\t}\n>  \n>  \tPipelineHandler::queueRequest(camera, request);\n>  \n> diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\n> index 33055c5ac533..7fa034e6c747 100644\n> --- a/src/libcamera/request.cpp\n> +++ b/src/libcamera/request.cpp\n> @@ -51,6 +51,16 @@ Request::Request(Camera *camera)\n>  {\n>  }\n>  \n> +/**\n> + * \\fn Request::buffers()\n> + * \\brief Retrieve the request's streams to buffer map\n\ns/buffer/buffers/\n\n> + *\n> + * Return a reference to the map that associates each Stream part of the\n> + * request to the Buffer the Stream output should be directed to.\n> + *\n> + * \\return The map of Stream to Buffer\n> + */\n> +\n>  /**\n>   * \\brief Set the streams to capture with associated buffers\n>   * \\param[in] streamMap The map of streams to buffers","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 D9BC060DB4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 16 Apr 2019 13:03:38 +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 4C730E2;\n\tTue, 16 Apr 2019 13:03:38 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1555412618;\n\tbh=zoWnYuKdPmU9WlDAOCU7r7yU0xqGk+4A7IyOteC+BrU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=kUY5IkjVk07ZWlOf3PEqd76SuahPrEsLUl9tBrdjKz1uBKshNpKZagLc/47KH1TSF\n\tO87+5zOMZ0/6/9ooArt9qtWFF6AGGHw37wKaarwOOkrp9JdT5w+UdhcsPXx4p6drzG\n\tGsaX0UkbhY26+jHoJ1Q16LPt6dUjwbbWLDFSZuLU=","Date":"Tue, 16 Apr 2019 14:03:29 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org, Niklas =?utf-8?q?S=C3=B6derlund?=\n\t<niklas.soderlund@ragnatech.se>","Message-ID":"<20190416110329.GC4832@pendragon.ideasonboard.com>","References":"<20190415231859.9747-1-jacopo@jmondi.org>\n\t<20190415231859.9747-7-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190415231859.9747-7-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v5 6/7] libcamera: request: Expose the\n\tStream to Buffers map","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, 16 Apr 2019 11:03:39 -0000"}}]