[{"id":1486,"web_url":"https://patchwork.libcamera.org/comment/1486/","msgid":"<20190419104850.GE7006@pendragon.ideasonboard.com>","date":"2019-04-19T10:48:50","subject":"Re: [libcamera-devel] [PATCH v7 7/8] 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 Fri, Apr 19, 2019 at 12:18:38PM +0200, Jacopo Mondi wrote:\n> The viewfinder and main output require identical logic for buffer and\n> request completion. Connect the viewfinder bufferReady signal to the slot\n> and handle requests for both main output and viewfinder there.\n> \n> Update the slot logic to complete the request only when the last buffer\n> has completed, and make sure to complete requests in the same order they\n> have been queued to the pipeline handler.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 25 ++++++++++++++++++++++---\n>  1 file changed, 22 insertions(+), 3 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index 8fa59157532e..1964603c591f 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -747,6 +747,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/* Create and register the Camera instance. */\n>  \t\tstd::string cameraName = cio2->sensor_->entity()->name() + \" \"\n> @@ -792,10 +794,27 @@ 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> +\n> +\tif (!pipe_->completeBuffer(camera_, request, buffer))\n> +\t\t/* Request not completed yet, return here. */\n> +\t\treturn;\n>  \n> -\tpipe_->completeBuffer(camera_, request, buffer);\n> -\tpipe_->completeRequest(camera_, request);\n> +\t/*\n> +\t * Complete requests in queuing order: if some other request is\n> +\t * pending, postpone completion.\n> +\t */\n> +\tif (request != queuedRequests_.front())\n> +\t\treturn;\n> +\n\nI think you can remove this check, the while loop below completes all\nready requests in queuing order and should be enough. With this fixed,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\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>  /**","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 F229060B2E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 19 Apr 2019 12:49:07 +0200 (CEST)","from pendragon.ideasonboard.com (unknown\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5E07531A;\n\tFri, 19 Apr 2019 12:49:07 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1555670947;\n\tbh=J20x/kc1QxzFh6wgsHPmOugAV71+l8tWOL3R4iKn6XE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=DsQKbdgvWCLD4QacO8vWDevvx+r3GOSzUgt41zoSyietO9fmpEmsrqeFcFr3J5UkV\n\t1z9XmR5at84HSFd490OHn9iIku5wsTQICAELzVl7bNshETDbKUWVhBbdwyTiG+2h4P\n\tkYAd4N0A276U/izUcLLhmQ1TTTKXJpHD1vSEvfrE=","Date":"Fri, 19 Apr 2019 13:48:50 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190419104850.GE7006@pendragon.ideasonboard.com>","References":"<20190419101839.10337-1-jacopo@jmondi.org>\n\t<20190419101839.10337-8-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190419101839.10337-8-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v7 7/8] 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":"Fri, 19 Apr 2019 10:49:08 -0000"}}]