{"id":770,"url":"https://patchwork.libcamera.org/api/patches/770/?format=json","web_url":"https://patchwork.libcamera.org/patch/770/","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":"<20190320163055.22056-25-jacopo@jmondi.org>","date":"2019-03-20T16:30:48","name":"[libcamera-devel,v4,24/31] libcamera: ipu3: Queue request for multiple streams","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"261d0416d0984d66a190ae56d87b082237abbfc2","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/770/mbox/","series":[{"id":214,"url":"https://patchwork.libcamera.org/api/series/214/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=214","date":"2019-03-20T16:30:24","name":"libcamera: ipu3: Add ImgU support + multiple streams","version":4,"mbox":"https://patchwork.libcamera.org/series/214/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/770/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/770/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 D9826611B4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Mar 2019 17:30:42 +0100 (CET)","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 7109E200010;\n\tWed, 20 Mar 2019 16:30:42 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 20 Mar 2019 17:30:48 +0100","Message-Id":"<20190320163055.22056-25-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.21.0","In-Reply-To":"<20190320163055.22056-1-jacopo@jmondi.org>","References":"<20190320163055.22056-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 24/31] libcamera: ipu3: Queue request\n\tfor multiple streams","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":"Wed, 20 Mar 2019 16:30:43 -0000"},"content":"Add support for queue request on the main and secondary outputs of the\nImgU.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 46 ++++++++++++++++------------\n 1 file changed, 27 insertions(+), 19 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex ff1e5329c83d..b2df9a4ac922 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -689,38 +689,46 @@ void PipelineHandlerIPU3::stop(Camera *camera)\n \n int PipelineHandlerIPU3::queueRequest(Camera *camera, Request *request)\n {\n+\tstd::set<Stream *> streams = request->streams();\n \tIPU3CameraData *data = cameraData(camera);\n \tV4L2Device *viewfinder = data->imgu->viewfinder;\n \tV4L2Device *output = data->imgu->output;\n \tV4L2Device *stat = data->imgu->stat;\n-\tStream *stream = &data->streams_[0];\n+\tImgUDevice *imgu = data->imgu;\n \tBuffer *tmpBuffer;\n \n-\t/*\n-\t * Queue buffer on VF and stat.\n-\t * FIXME: this is an hack!\n-\t */\n-\ttmpBuffer = &data->imgu->vfPool.buffers()[tmpBufferCount];\n-\tviewfinder->queueBuffer(tmpBuffer);\n+\tfor (Stream *stream : streams) {\n+\t\tBuffer *buffer = request->findBuffer(stream);\n+\t\tif (!buffer) {\n+\t\t\tLOG(IPU3, Error) << \"Attempt to queue invalid request\";\n+\t\t\treturn -ENOENT;\n+\t\t}\n+\n+\t\tV4L2Device *videoDevice = isOutput(data, stream)\n+\t\t\t\t\t? output : viewfinder;\n+\n+\t\tint ret = videoDevice->queueBuffer(buffer);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\n+\t\tif (isOutput(data, stream) && !isViewfinderActive(data)) {\n+\t\t\ttmpBuffer = &imgu->vfPool.buffers()[tmpBufferCount];\n+\t\t\tviewfinder->queueBuffer(tmpBuffer);\n+\t\t}\n \n+\t\tif (isViewfinder(data, stream) && !isOutputActive(data)) {\n+\t\t\ttmpBuffer = &imgu->outputPool.buffers()[tmpBufferCount];\n+\t\t\toutput->queueBuffer(tmpBuffer);\n+\t\t}\n+\t}\n+\n+\t/* Queue buffer on stat unconditionally. */\n \ttmpBuffer = &data->imgu->statPool.buffers()[tmpBufferCount];\n \tstat->queueBuffer(tmpBuffer);\n \n \ttmpBufferCount++;\n \ttmpBufferCount %= IPU3_IMGU_BUFFER_COUNT;\n \n-\t/* Queue a buffer to the ImgU output for capture. */\n-\tBuffer *buffer = request->findBuffer(stream);\n-\tif (!buffer) {\n-\t\tLOG(IPU3, Error)\n-\t\t\t<< \"Attempt to queue request with invalid stream\";\n-\t\treturn -ENOENT;\n-\t}\n-\n-\tint ret = output->queueBuffer(buffer);\n-\tif (ret < 0)\n-\t\treturn ret;\n-\n \tPipelineHandler::queueRequest(camera, request);\n \n \treturn 0;\n","prefixes":["libcamera-devel","v4","24/31"]}