[{"id":1452,"web_url":"https://patchwork.libcamera.org/comment/1452/","msgid":"<20190418142819.GR4806@pendragon.ideasonboard.com>","date":"2019-04-18T14:28:19","subject":"Re: [libcamera-devel] [PATCH v5 12/14] libcamera: ipu3: Connect\n\tviewfinder's BufferReady signal","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 Thu, Apr 18, 2019 at 12:47:13PM +0200, Jacopo Mondi wrote:\n> The viewfinder and main output require identical logic for buffer and\n> request completion. Rename the IPU3CameraData::imguOutputBufferReady()\n> slot to IPU3CameraData::imguCaptureBufferReady() to reflect this, and\n> connect the viewfinder bufferReady signal to the slot.\n\nYou don't rename the method anymore in v5, have you forgotten to update\nthe commit message ?\n\n> \n> Update the slot logic to ignore internal buffers that are not part of\n> the request, and to complete the request only when the last buffer\n> completes.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 32 +++++++++++++++++++++++++---\n>  1 file changed, 29 insertions(+), 3 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index ee490a488cf7..71b36ecf6cd9 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -705,6 +705,8 @@ int PipelineHandlerIPU3::registerCameras()\n>  \t\t\t\t\t&IPU3CameraData::imguInputBufferReady);\n>  \t\tdata->imgu_->output_.dev->bufferReady.connect(data.get(),\n>  \t\t\t\t\t&IPU3CameraData::imguOutputBufferReady);\n> +\t\tdata->imgu_->viewfinder_.dev->bufferReady.connect(data.get(),\n> +\t\t\t\t\t&IPU3CameraData::imguOutputBufferReady);\n>  \n>  \t\t/* Initialize and register the Camera and its streams. */\n>  \t\tstd::string cameraName = cio2->sensor_->entityName() + \" \"\n> @@ -750,10 +752,34 @@ void PipelineHandlerIPU3::IPU3CameraData::imguInputBufferReady(Buffer *buffer)\n>   */\n>  void PipelineHandlerIPU3::IPU3CameraData::imguOutputBufferReady(Buffer *buffer)\n>  {\n> -\tRequest *request = queuedRequests_.front();\n> +\tRequest *request = buffer->request();\n> +\tif (!request)\n> +\t\t/* Completed buffers not part of a request are ignored. */\n> +\t\treturn;\n\nUnless I'm mistaken you were able to get the main output working without\nneeding to queue dummy buffers, is this check still needed ?\n\n> +\n> +\tif (!pipe_->completeBuffer(camera_, request, buffer))\n> +\t\t/* Request not completed yet, return here. */\n> +\t\treturn;\n> +\n> +\t/*\n> +\t * Complete requests in queuing order: if some other request is\n> +\t * pending, post-pone completion.\n\ns/post-pone/postpone/\n\n> +\t */\n> +\tRequest *front = queuedRequests_.front();\n> +\tif (front != request)\n> +\t\treturn;\n>  \n> -\tpipe_->completeBuffer(camera_, request, buffer);\n> -\tpipe_->completeRequest(camera_, request);\n> +\t/*\n> +\t * Complete the current request, and all the other pending ones,\n> +\t * in queuing order.\n> +\t */\n> +\twhile (1) {\n> +\t\tif (front->hasPendingBuffers())\n> +\t\t\tbreak;\n> +\n> +\t\tpipe_->completeRequest(camera_, front);\n> +\t\tfront = queuedRequests_.front();\n> +\t}\n\nWould the following be simpler ?\n\n\t/* Complete the pending requests in queuing order. */\n\twhile (1) {\n\t\trequest = queuedRequests_.front();\n\t\tif (request->hasPendingBuffers())\n\t\t\tbreak;\n\n\t\tpipe_->completeRequest(camera_, request);\n\t}\n\n>  }\n>  \n>  /**","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 9D2AE60DC6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Apr 2019 16:28:28 +0200 (CEST)","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 0F1C0333;\n\tThu, 18 Apr 2019 16:28:27 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1555597708;\n\tbh=5oW1xN3vbguYxUCDngvvpFdE1Mw5gXAoVfDi+YgSEnE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=j/y2AGFINQJ8T4c4lsvm4sJUqFH2X4Ymffy4jxIulKMe8izpbakFsEqX9/cNMkDlo\n\tFGo8peMapnP7TnlNePFQRm7Jt5jzreDXqrfoyNTivlBSflrv1rxSuSR71L8a63pAv4\n\tEF2iH759hSWc2pWM/zG8R0s6cJ9gOqx9vBQ+7fgI=","Date":"Thu, 18 Apr 2019 17:28:19 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190418142819.GR4806@pendragon.ideasonboard.com>","References":"<20190418104715.22622-1-jacopo@jmondi.org>\n\t<20190418104715.22622-13-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190418104715.22622-13-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v5 12/14] libcamera: ipu3: Connect\n\tviewfinder's BufferReady signal","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, 18 Apr 2019 14:28:28 -0000"}}]