[{"id":1188,"web_url":"https://patchwork.libcamera.org/comment/1188/","msgid":"<20190402105254.GM4805@pendragon.ideasonboard.com>","date":"2019-04-02T10:52:54","subject":"Re: [libcamera-devel] [PATCH v5 16/19] libcamera: ipu3: Connect\n\tCIO2 and ImgU bufferReady signals","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, Mar 26, 2019 at 09:38:59AM +0100, Jacopo Mondi wrote:\n> Connect the CIO2 output bufferRead signal to a slot that simply\n> queue the received buffer to ImgU for processing, and connect the ImgU\n> main output bufferReady signal to the cameraData slot that notifies\n> to applications that a new image buffer is available.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 59 +++++++++++++++++++++++++---\n>  1 file changed, 54 insertions(+), 5 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index 9e8a20849ed0..7a5e715458ae 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -203,7 +203,9 @@ private:\n>  \t\t{\n>  \t\t}\n>  \n> -\t\tvoid bufferReady(Buffer *buffer);\n> +\t\tvoid imguOutputBufferReady(Buffer *buffer);\n> +\t\tvoid imguInputBufferReady(Buffer *buffer);\n> +\t\tvoid cio2BufferReady(Buffer *buffer);\n>  \n>  \t\tCIO2Device cio2_;\n>  \t\tImgUDevice *imgu_;\n> @@ -562,15 +564,28 @@ int PipelineHandlerIPU3::registerCameras()\n>  \t\t */\n>  \t\tdata->imgu_ = numCameras ? &imgu1_ : &imgu0_;\n>  \n> +\t\t/*\n> +\t\t * Connect video devices' 'bufferReady' signals to their\n> +\t\t * slot to implement the image processing pipeline.\n> +\t\t *\n> +\t\t * Frames produced by the CIO2 unit are shared with the\n\ns/shared with/passed to/\n\n> +\t\t * associated ImgU input where they get processed and\n> +\t\t * returned through the ImgU main and secondary outputs.\n> +\t\t */\n> +\t\tdata->cio2_.output_->bufferReady.connect(data.get(),\n> +\t\t\t\t\t&IPU3CameraData::cio2BufferReady);\n> +\t\tdata->imgu_->input_->bufferReady.connect(data.get(),\n> +\t\t\t\t\t&IPU3CameraData::imguInputBufferReady);\n> +\t\tdata->imgu_->output_->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->name() + \" \"\n>  \t\t\t\t       + std::to_string(id);\n>  \t\tstd::shared_ptr<Camera> camera = Camera::create(this,\n>  \t\t\t\t\t\t\t\tcameraName,\n>  \t\t\t\t\t\t\t\tstreams);\n>  \n> -\t\tcio2->output_->bufferReady.connect(data.get(),\n> -\t\t\t\t\t\t   &IPU3CameraData::bufferReady);\n> -\n>  \t\tregisterCamera(std::move(camera), std::move(data));\n>  \n>  \t\tLOG(IPU3, Info)\n> @@ -584,7 +599,29 @@ int PipelineHandlerIPU3::registerCameras()\n>  \treturn numCameras ? 0 : -ENODEV;\n>  }\n>  \n> -void PipelineHandlerIPU3::IPU3CameraData::bufferReady(Buffer *buffer)\n> +/* -----------------------------------------------------------------------------\n> + * Buffer Ready slots\n> + */\n> +\n> +/**\n> + * \\brief Handle buffers completion at the ImgU input\n> + * \\param buffer The completed buffer\n> + *\n> + * Buffers completed from the ImgU input are immediately queued back to the\n> + * CIO2 unit to continue frame capture.\n> + */\n> +void PipelineHandlerIPU3::IPU3CameraData::imguInputBufferReady(Buffer *buffer)\n> +{\n> +\tcio2_.output_->queueBuffer(buffer);\n> +}\n> +\n> +/**\n> + * \\brief Handle buffers completion at the ImgU output\n> + * \\param buffer The completed buffer\n> + *\n> + * Buffers completed from the ImgU output are directed to the application.\n> + */\n> +void PipelineHandlerIPU3::IPU3CameraData::imguOutputBufferReady(Buffer *buffer)\n>  {\n>  \tRequest *request = queuedRequests_.front();\n>  \n> @@ -592,6 +629,18 @@ void PipelineHandlerIPU3::IPU3CameraData::bufferReady(Buffer *buffer)\n>  \tpipe_->completeRequest(camera_, request);\n>  }\n>  \n> +/**\n> + * \\brief Handle buffers completion at the CIO2 output\n> + * \\param buffer The completed buffer\n> + *\n> + * Buffers completed from the CIO2 are immediately queued to the ImgU unit\n> + * for further processing.\n> + */\n> +void PipelineHandlerIPU3::IPU3CameraData::cio2BufferReady(Buffer *buffer)\n> +{\n> +\timgu_->input_->queueBuffer(buffer);\n\nI still think we'll need to keep track of requests and only queue\nbuffers to the ImgU input when buffers are available for its output, but\nthat can be done in a separate patch. With the small issue above fixed,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +}\n> +\n>  /* -----------------------------------------------------------------------------\n>   * ImgU Device\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 14F2F600FB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Apr 2019 12:53:05 +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 956362F9;\n\tTue,  2 Apr 2019 12:53:04 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1554202384;\n\tbh=1pgKgBkdrelqI1ZvUss3o0M7gKqKkb68a8XUUhw9q/A=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Uojo5skxCUUPl9u0Vst14rCck/OhGUyxupX4/nA5WO7Jm8dZvf62eYa5w7tsXlb1S\n\tHPAsdiBGJW8fUeHCTXuynLBmjmI+3aoUHvkeyNU0il0klbp9eNOt7E/1U6GgEktfBq\n\ti7vV6ZFx5UZkIUjc4+6P+9sGSzF0kVePR3HU8VLI=","Date":"Tue, 2 Apr 2019 13:52:54 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190402105254.GM4805@pendragon.ideasonboard.com>","References":"<20190326083902.26121-1-jacopo@jmondi.org>\n\t<20190326083902.26121-17-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190326083902.26121-17-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v5 16/19] libcamera: ipu3: Connect\n\tCIO2 and ImgU bufferReady signals","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 10:53:05 -0000"}},{"id":1197,"web_url":"https://patchwork.libcamera.org/comment/1197/","msgid":"<20190402113949.GQ23466@bigcity.dyn.berto.se>","date":"2019-04-02T11:39:49","subject":"Re: [libcamera-devel] [PATCH v5 16/19] libcamera: ipu3: Connect\n\tCIO2 and ImgU bufferReady signals","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 work.\n\nOn 2019-03-26 09:38:59 +0100, Jacopo Mondi wrote:\n> Connect the CIO2 output bufferRead signal to a slot that simply\n> queue the received buffer to ImgU for processing, and connect the ImgU\n> main output bufferReady signal to the cameraData slot that notifies\n> to applications that a new image buffer is available.\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 | 59 +++++++++++++++++++++++++---\n>  1 file changed, 54 insertions(+), 5 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index 9e8a20849ed0..7a5e715458ae 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -203,7 +203,9 @@ private:\n>  \t\t{\n>  \t\t}\n>  \n> -\t\tvoid bufferReady(Buffer *buffer);\n> +\t\tvoid imguOutputBufferReady(Buffer *buffer);\n> +\t\tvoid imguInputBufferReady(Buffer *buffer);\n> +\t\tvoid cio2BufferReady(Buffer *buffer);\n>  \n>  \t\tCIO2Device cio2_;\n>  \t\tImgUDevice *imgu_;\n> @@ -562,15 +564,28 @@ int PipelineHandlerIPU3::registerCameras()\n>  \t\t */\n>  \t\tdata->imgu_ = numCameras ? &imgu1_ : &imgu0_;\n>  \n> +\t\t/*\n> +\t\t * Connect video devices' 'bufferReady' signals to their\n> +\t\t * slot to implement the image processing pipeline.\n> +\t\t *\n> +\t\t * Frames produced by the CIO2 unit are shared with the\n> +\t\t * associated ImgU input where they get processed and\n> +\t\t * returned through the ImgU main and secondary outputs.\n> +\t\t */\n> +\t\tdata->cio2_.output_->bufferReady.connect(data.get(),\n> +\t\t\t\t\t&IPU3CameraData::cio2BufferReady);\n> +\t\tdata->imgu_->input_->bufferReady.connect(data.get(),\n> +\t\t\t\t\t&IPU3CameraData::imguInputBufferReady);\n> +\t\tdata->imgu_->output_->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->name() + \" \"\n>  \t\t\t\t       + std::to_string(id);\n>  \t\tstd::shared_ptr<Camera> camera = Camera::create(this,\n>  \t\t\t\t\t\t\t\tcameraName,\n>  \t\t\t\t\t\t\t\tstreams);\n>  \n> -\t\tcio2->output_->bufferReady.connect(data.get(),\n> -\t\t\t\t\t\t   &IPU3CameraData::bufferReady);\n> -\n>  \t\tregisterCamera(std::move(camera), std::move(data));\n>  \n>  \t\tLOG(IPU3, Info)\n> @@ -584,7 +599,29 @@ int PipelineHandlerIPU3::registerCameras()\n>  \treturn numCameras ? 0 : -ENODEV;\n>  }\n>  \n> -void PipelineHandlerIPU3::IPU3CameraData::bufferReady(Buffer *buffer)\n> +/* -----------------------------------------------------------------------------\n> + * Buffer Ready slots\n> + */\n> +\n> +/**\n> + * \\brief Handle buffers completion at the ImgU input\n> + * \\param buffer The completed buffer\n> + *\n> + * Buffers completed from the ImgU input are immediately queued back to the\n> + * CIO2 unit to continue frame capture.\n> + */\n> +void PipelineHandlerIPU3::IPU3CameraData::imguInputBufferReady(Buffer *buffer)\n> +{\n> +\tcio2_.output_->queueBuffer(buffer);\n> +}\n> +\n> +/**\n> + * \\brief Handle buffers completion at the ImgU output\n> + * \\param buffer The completed buffer\n> + *\n> + * Buffers completed from the ImgU output are directed to the application.\n> + */\n> +void PipelineHandlerIPU3::IPU3CameraData::imguOutputBufferReady(Buffer *buffer)\n>  {\n>  \tRequest *request = queuedRequests_.front();\n>  \n> @@ -592,6 +629,18 @@ void PipelineHandlerIPU3::IPU3CameraData::bufferReady(Buffer *buffer)\n>  \tpipe_->completeRequest(camera_, request);\n>  }\n>  \n> +/**\n> + * \\brief Handle buffers completion at the CIO2 output\n> + * \\param buffer The completed buffer\n> + *\n> + * Buffers completed from the CIO2 are immediately queued to the ImgU unit\n> + * for further processing.\n> + */\n> +void PipelineHandlerIPU3::IPU3CameraData::cio2BufferReady(Buffer *buffer)\n> +{\n> +\timgu_->input_->queueBuffer(buffer);\n> +}\n> +\n>  /* -----------------------------------------------------------------------------\n>   * ImgU Device\n>   */\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-lf1-x135.google.com (mail-lf1-x135.google.com\n\t[IPv6:2a00:1450:4864:20::135])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3D33360DB3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Apr 2019 13:39:51 +0200 (CEST)","by mail-lf1-x135.google.com with SMTP id r25so8721289lfn.13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 02 Apr 2019 04:39:51 -0700 (PDT)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\tu1sm2444356lfm.4.2019.04.02.04.39.50\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tTue, 02 Apr 2019 04:39:50 -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=VS3OHKAjnpdixnTYQpaFoziUc6YpzV9kKxwtQH+vKog=;\n\tb=jTlwWOcdivZP/x7zmgzU2jGi0coH1Tkb7NRyrZykud5pYgF5u2++K0Gdqu8YAhv7Dg\n\tTb7Jpn/nbEhg7mYO1J9liatMNGUlTfzpnfitx0JK7q8HB9W7BulnSjSz7gMtM5061yO4\n\t2MQZ4d76PJJYxegLQmzEfzQ5ByMXjbMKgW1NgCoIjSIBiWWo5Dj08PdJAPgMWBopxxdR\n\tWFquJ6WGSMA326VzxLH0R3YtZadyfDjuSWx1GeFSSFND0X3I6bO2y1igv6wsAPbHEDMY\n\tyBupTfM5hY5rYXr8E04GdhZIOFlsvWRN7wB8WDAMSd6/GviGujia/CsGmRhWtOdLEcEi\n\ttf9g==","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=VS3OHKAjnpdixnTYQpaFoziUc6YpzV9kKxwtQH+vKog=;\n\tb=HmHGD+ilLJrhTwzSK+SZSffYh7/+nsUIFeMrkdDbQhv05m5YAspVLoMhz6E4mIW6+3\n\twLi6C5PJxJFZc0AA59Vx9SBrV7RKqDt2Sz0pzqWj6m7a5L0Q2VZeG4S/CnlzU4Ex1Yvo\n\tgtAa3zFfPXcH8wnyM8zONGqhA9sq9k51Us23vq2uNkkspZWq0iqYvB/SyotwbjgMdocJ\n\tMPhCqaKGsWX5xmtpx1Tin2fo8SduX2U+W0UP863seDuyOaK01QUz++4EjwE/yIwFXpuA\n\tUkJodSsMEoUCBHjD/k67NnelhMePi62/dTi3mpofEA8otx6dCRcOUhFeB33bIJg4qLR+\n\tol+w==","X-Gm-Message-State":"APjAAAWYSFHCjVrbf2KzVY9vZpBDflHqSI1/aWa5dmJsRvvm/EB0KO2n\n\tsp8+oz5dHNts4k1XtioOXPuxRoEaln4=","X-Google-Smtp-Source":"APXvYqwzUF4vUBeU2/lxuMfG1lhtjsvIXOy7jDz67KW3gumuUl69gTX5RY2UM3cWN9Wn79eB5d1tuw==","X-Received":"by 2002:ac2:4ad1:: with SMTP id\n\tm17mr32562346lfp.129.1554205190694; \n\tTue, 02 Apr 2019 04:39:50 -0700 (PDT)","Date":"Tue, 2 Apr 2019 13:39:49 +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":"<20190402113949.GQ23466@bigcity.dyn.berto.se>","References":"<20190326083902.26121-1-jacopo@jmondi.org>\n\t<20190326083902.26121-17-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":"<20190326083902.26121-17-jacopo@jmondi.org>","User-Agent":"Mutt/1.11.3 (2019-02-01)","Subject":"Re: [libcamera-devel] [PATCH v5 16/19] libcamera: ipu3: Connect\n\tCIO2 and ImgU bufferReady signals","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 11:39:51 -0000"}}]