[{"id":1090,"web_url":"https://patchwork.libcamera.org/comment/1090/","msgid":"<20190321100920.GN4615@pendragon.ideasonboard.com>","date":"2019-03-21T10:09:20","subject":"Re: [libcamera-devel] [PATCH v4 11/31] libcamera: ipu3: Queue\n\trequests to the pipeline","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 Wed, Mar 20, 2019 at 05:30:35PM +0100, Jacopo Mondi wrote:\n> Implement queueRequest for the IPU3 pipeline manager. When a request is\n> queued, a new buffer is queued to the ImgU output.\n> \n> Also queue buffers for the viewfinder and stat video nodes, even if\n> they're not used at the moment.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 25 +++++++++++++++++++++++--\n>  1 file changed, 23 insertions(+), 2 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index 965794494a4e..8410e1f4b4a6 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -161,11 +161,15 @@ private:\n>  \n>  \tstd::shared_ptr<MediaDevice> cio2MediaDev_;\n>  \tstd::shared_ptr<MediaDevice> imguMediaDev_;\n> +\n> +\tunsigned int tmpBufferCount;\n>  };\n>  \n>  PipelineHandlerIPU3::PipelineHandlerIPU3(CameraManager *manager)\n>  \t: PipelineHandler(manager), cio2MediaDev_(nullptr), imguMediaDev_(nullptr)\n>  {\n> +\t/* FIXME: this is an hack. */\n> +\ttmpBufferCount = 0;\n>  }\n>  \n>  PipelineHandlerIPU3::~PipelineHandlerIPU3()\n> @@ -460,9 +464,26 @@ void PipelineHandlerIPU3::stop(Camera *camera)\n>  int PipelineHandlerIPU3::queueRequest(Camera *camera, Request *request)\n>  {\n>  \tIPU3CameraData *data = cameraData(camera);\n> -\tV4L2Device *cio2 = data->cio2.output;\n> +\tV4L2Device *viewfinder = data->imgu->viewfinder;\n> +\tV4L2Device *output = data->imgu->output;\n> +\tV4L2Device *stat = data->imgu->stat;\n>  \tStream *stream = &data->stream_;\n> +\tBuffer *tmpBuffer;\n> +\n> +\t/*\n> +\t * Queue buffer on VF and stat.\n> +\t * FIXME: this is an hack!\n> +\t */\n\nA pretty ugly one :-( You could allocate as many stats and viewfinder\nbuffers as you have capture buffers, and queue the buffers with the same\nindex as the output buffer. That would remove the need for a\ntmpBufferCount variable. That won't work as-is when using multiple\nstreams, but it can at least delay the hack.\n\n> +\ttmpBuffer = &data->imgu->vfPool.buffers()[tmpBufferCount];\n> +\tviewfinder->queueBuffer(tmpBuffer);\n> +\n> +\ttmpBuffer = &data->imgu->statPool.buffers()[tmpBufferCount];\n> +\tstat->queueBuffer(tmpBuffer);\n> +\n> +\ttmpBufferCount++;\n> +\ttmpBufferCount %= IPU3_IMGU_BUFFER_COUNT;\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> @@ -470,7 +491,7 @@ int PipelineHandlerIPU3::queueRequest(Camera *camera, Request *request)\n>  \t\treturn -ENOENT;\n>  \t}\n>  \n> -\tint ret = cio2->queueBuffer(buffer);\n> +\tint ret = output->queueBuffer(buffer);\n>  \tif (ret < 0)\n>  \t\treturn ret;\n>","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 CD205600F9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 21 Mar 2019 11:09:31 +0100 (CET)","from pendragon.ideasonboard.com (30.net042126252.t-com.ne.jp\n\t[42.126.252.30])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 609E023A;\n\tThu, 21 Mar 2019 11:09:30 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1553162971;\n\tbh=GQ4jRjxdFxq0yJ7h/fxjIj0b6O5Y1GlI0jr1wp9cCEc=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=kG36ONbnQFhm2DrlVDkfmI4NLQuBmIFiOZdyySBV1WnpyhBUC9maObVGFOPUeMiVc\n\tTJpSv9BeZ2536Q9ieM3asEThBA9hHCIr5t00cmev4RE47E278Z2US7FxOMmt3+wSgT\n\t8X3rfFP94jNK2ZDs4YNvO31P1gQQ0elMV5yg3lTk=","Date":"Thu, 21 Mar 2019 12:09:20 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190321100920.GN4615@pendragon.ideasonboard.com>","References":"<20190320163055.22056-1-jacopo@jmondi.org>\n\t<20190320163055.22056-12-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190320163055.22056-12-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v4 11/31] libcamera: ipu3: Queue\n\trequests to the pipeline","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":"Thu, 21 Mar 2019 10:09:32 -0000"}}]