{"id":1044,"url":"https://patchwork.libcamera.org/api/patches/1044/?format=json","web_url":"https://patchwork.libcamera.org/patch/1044/","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":"<20190418104715.22622-13-jacopo@jmondi.org>","date":"2019-04-18T10:47:13","name":"[libcamera-devel,v5,12/14] libcamera: ipu3: Connect viewfinder's BufferReady signal","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"1740594e7880831b24377b05823b83a2825dee2f","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/1044/mbox/","series":[{"id":255,"url":"https://patchwork.libcamera.org/api/series/255/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=255","date":"2019-04-18T10:47:01","name":"libcamera: ipu3: Multiple streams support","version":5,"mbox":"https://patchwork.libcamera.org/series/255/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/1044/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/1044/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net\n\t[217.70.183.197])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B971F60DD8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Apr 2019 12:46:38 +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 relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 45DC51C0002;\n\tThu, 18 Apr 2019 10:46:38 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 18 Apr 2019 12:47:13 +0200","Message-Id":"<20190418104715.22622-13-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.21.0","In-Reply-To":"<20190418104715.22622-1-jacopo@jmondi.org>","References":"<20190418104715.22622-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[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 10:46:39 -0000"},"content":"The viewfinder and main output require identical logic for buffer and\nrequest completion. Rename the IPU3CameraData::imguOutputBufferReady()\nslot to IPU3CameraData::imguCaptureBufferReady() to reflect this, and\nconnect the viewfinder bufferReady signal to the slot.\n\nUpdate the slot logic to ignore internal buffers that are not part of\nthe request, and to complete the request only when the last buffer\ncompletes.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 32 +++++++++++++++++++++++++---\n 1 file changed, 29 insertions(+), 3 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 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+\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->hasPendingBuffers())\n+\t\t\tbreak;\n+\n+\t\tpipe_->completeRequest(camera_, front);\n+\t\tfront = queuedRequests_.front();\n+\t}\n }\n \n /**\n","prefixes":["libcamera-devel","v5","12/14"]}