{"id":1080,"url":"https://patchwork.libcamera.org/api/patches/1080/?format=json","web_url":"https://patchwork.libcamera.org/patch/1080/","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":"<20190419101839.10337-8-jacopo@jmondi.org>","date":"2019-04-19T10:18:38","name":"[libcamera-devel,v7,7/8] libcamera: ipu3: Connect viewfinder's BufferReady signal","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"a787cde037c1acf8e20a04c3b61f658dc01013ef","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/1080/mbox/","series":[{"id":261,"url":"https://patchwork.libcamera.org/api/series/261/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=261","date":"2019-04-19T10:18:31","name":"libcamera: ipu3: Multiple streams support","version":7,"mbox":"https://patchwork.libcamera.org/series/261/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/1080/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/1080/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net\n\t[217.70.183.199])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 397A660DC0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 19 Apr 2019 12:17:56 +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 relay9-d.mail.gandi.net (Postfix) with ESMTPSA id C4B5BFF808;\n\tFri, 19 Apr 2019 10:17:55 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 19 Apr 2019 12:18:38 +0200","Message-Id":"<20190419101839.10337-8-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.21.0","In-Reply-To":"<20190419101839.10337-1-jacopo@jmondi.org>","References":"<20190419101839.10337-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[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:17:56 -0000"},"content":"The viewfinder and main output require identical logic for buffer and\nrequest completion. Connect the viewfinder bufferReady signal to the slot\nand handle requests for both main output and viewfinder there.\n\nUpdate the slot logic to complete the request only when the last buffer\nhas completed, and make sure to complete requests in the same order they\nhave been queued to the pipeline handler.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 25 ++++++++++++++++++++++---\n 1 file changed, 22 insertions(+), 3 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 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+\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","prefixes":["libcamera-devel","v7","7/8"]}