{"id":965,"url":"https://patchwork.libcamera.org/api/patches/965/?format=json","web_url":"https://patchwork.libcamera.org/patch/965/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20190409192548.20325-11-jacopo@jmondi.org>","date":"2019-04-09T19:25:46","name":"[libcamera-devel,v4,10/12] libcamera: ipu3: Connect viewfinder's BufferReady signal","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"10826ad0b711d112e847879fe1ad6e8d8d560d62","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/965/mbox/","series":[{"id":247,"url":"https://patchwork.libcamera.org/api/series/247/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=247","date":"2019-04-09T19:25:36","name":"libcamera: ipu3: Multiple streams support","version":4,"mbox":"https://patchwork.libcamera.org/series/247/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/965/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/965/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay12.mail.gandi.net (relay12.mail.gandi.net\n\t[217.70.178.232])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 63B0F60DB8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  9 Apr 2019 21:25:11 +0200 (CEST)","from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay12.mail.gandi.net (Postfix) with ESMTPSA id 00D1C200008;\n\tTue,  9 Apr 2019 19:25:10 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue,  9 Apr 2019 21:25:46 +0200","Message-Id":"<20190409192548.20325-11-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.21.0","In-Reply-To":"<20190409192548.20325-1-jacopo@jmondi.org>","References":"<20190409192548.20325-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 10/12] 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":"Tue, 09 Apr 2019 19:25:12 -0000"},"content":"Connect the viewfinder buffer ready signal to the IPU3CameraData slot\nthat complets the buffer first, and if not waiting for other buffers\ncompletes the request as well.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 43 ++++++++++++++++++++++++----\n 1 file changed, 37 insertions(+), 6 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex bb8d4ce644ca..75ffdc56d157 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -182,7 +182,7 @@ private:\n \t\t{\n \t\t}\n \n-\t\tvoid imguOutputBufferReady(Buffer *buffer);\n+\t\tvoid imguCaptureBufferReady(Buffer *buffer);\n \t\tvoid imguInputBufferReady(Buffer *buffer);\n \t\tvoid cio2BufferReady(Buffer *buffer);\n \n@@ -722,7 +722,9 @@ int PipelineHandlerIPU3::registerCameras()\n \t\tdata->imgu_->input_->bufferReady.connect(data.get(),\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\t\t\t\t&IPU3CameraData::imguCaptureBufferReady);\n+\t\tdata->imgu_->viewfinder_.dev->bufferReady.connect(data.get(),\n+\t\t\t\t\t&IPU3CameraData::imguCaptureBufferReady);\n \n \n \t\t/* Initialize and register the Camera and its streams. */\n@@ -769,12 +771,41 @@ void PipelineHandlerIPU3::IPU3CameraData::imguInputBufferReady(Buffer *buffer)\n  *\n  * Buffers completed from the ImgU output are directed to the application.\n  */\n-void PipelineHandlerIPU3::IPU3CameraData::imguOutputBufferReady(Buffer *buffer)\n+void PipelineHandlerIPU3::IPU3CameraData::imguCaptureBufferReady(Buffer *buffer)\n {\n-\tRequest *request = queuedRequests_.front();\n+\tRequest *request = buffer->request();\n+\tif (!request)\n+\t\t/*\n+\t\t * Completed buffers not part of a request are ignored\n+\t\t * (they most probably come from the output stream\n+\t\t * internal pool)\n+\t\t */\n+\t\treturn;\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+\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->empty())\n+\t\t\tpipe_->completeRequest(camera_, front);\n+\t\telse\n+\t\t\tbreak;\n+\n+\t\tfront = queuedRequests_.front();\n+\t}\n }\n \n /**\n","prefixes":["libcamera-devel","v4","10/12"]}