{"id":537,"url":"https://patchwork.libcamera.org/api/1.1/patches/537/?format=json","web_url":"https://patchwork.libcamera.org/patch/537/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20190206060818.13907-23-laurent.pinchart@ideasonboard.com>","date":"2019-02-06T06:08:13","name":"[libcamera-devel,22/27] libcamera: pipeline: vimc: Implement capture support","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"3c15e809fb996591d439a4f3aba781aa4d2847cb","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/537/mbox/","series":[{"id":170,"url":"https://patchwork.libcamera.org/api/1.1/series/170/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=170","date":"2019-02-06T06:07:51","name":"Capture frames throught requests","version":1,"mbox":"https://patchwork.libcamera.org/series/170/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/537/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/537/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CFBB76104A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  6 Feb 2019 07:08:28 +0100 (CET)","from pendragon.ideasonboard.com (d51A4137F.access.telenet.be\n\t[81.164.19.127])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7C8A62D9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  6 Feb 2019 07:08:28 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1549433308;\n\tbh=5JOE8bvH20QvrILDhnKB9gtX6Y5bWWTSaiqR7FsSGVE=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=igynAZmpVdjz5PtGfIxKtxhZyA+k7T7KoyubjPVJOQtj0uqq3nxInNEYl59QYaX58\n\tuTwo+zQKXie0L3WSl5XwUBFVWcKvqSt9GvKGDIeRaEParAAuRETasYFnZMGiUxfbJO\n\tEcQ+qGwtxcMXpilVivJbFBy8OPwHWzhoynFutUFU=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  6 Feb 2019 08:08:13 +0200","Message-Id":"<20190206060818.13907-23-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.19.2","In-Reply-To":"<20190206060818.13907-1-laurent.pinchart@ideasonboard.com>","References":"<20190206060818.13907-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 22/27] libcamera: pipeline: vimc:\n\tImplement capture support","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, 06 Feb 2019 06:08:30 -0000"},"content":"From: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\nReplace the buffer allocation, capture start/stop and request queue\nstubs with real implementations.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/vimc.cpp | 35 +++++++++++++++++++++++++--------\n 1 file changed, 27 insertions(+), 8 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp\nindex 9c0406bef9dc..0e9ad7b59ee5 100644\n--- a/src/libcamera/pipeline/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc.cpp\n@@ -6,6 +6,7 @@\n  */\n \n #include <libcamera/camera.h>\n+#include <libcamera/request.h>\n #include <libcamera/stream.h>\n \n #include \"device_enumerator.h\"\n@@ -83,35 +84,53 @@ int PipeHandlerVimc::configureStreams(Camera *camera,\n {\n \tStreamConfiguration *cfg = &config[&stream_];\n \n-\tLOG(VIMC, Info) << \"TODO: Configure the camera for resolution \"\n-\t\t\t<< cfg->width << \"x\" << cfg->height;\n+\tLOG(VIMC, Debug) << \"Configure the camera for resolution \"\n+\t\t\t << cfg->width << \"x\" << cfg->height;\n \n-\treturn 0;\n+\tV4L2DeviceFormat format = {};\n+\tformat.width = cfg->width;\n+\tformat.height = cfg->height;\n+\tformat.fourcc = cfg->pixelFormat;\n+\n+\treturn video_->setFormat(&format);\n }\n \n int PipeHandlerVimc::allocateBuffers(Camera *camera, Stream *stream)\n {\n-\treturn -ENOTRECOVERABLE;\n+\tconst StreamConfiguration &cfg = stream->configuration();\n+\n+\tLOG(VIMC, Debug) << \"Requesting \" << cfg.bufferCount << \" buffers\";\n+\n+\treturn video_->exportBuffers(cfg.bufferCount, &stream->bufferPool());\n }\n \n int PipeHandlerVimc::freeBuffers(Camera *camera, Stream *stream)\n {\n-\treturn 0;\n+\treturn video_->releaseBuffers();\n }\n \n int PipeHandlerVimc::start(const Camera *camera)\n {\n-\tLOG(VIMC, Error) << \"TODO: start camera\";\n-\treturn 0;\n+\treturn video_->streamOn();\n }\n \n void PipeHandlerVimc::stop(const Camera *camera)\n {\n-\tLOG(VIMC, Error) << \"TODO: stop camera\";\n+\tvideo_->streamOff();\n }\n \n int PipeHandlerVimc::queueRequest(const Camera *camera, Request *request)\n {\n+\tBuffer *buffer = request->findBuffer(&stream_);\n+\tif (!buffer) {\n+\t\tLOG(VIMC, Error)\n+\t\t\t<< \"Attempt to queue request with invalid stream\";\n+\n+\t\treturn -ENOENT;\n+\t}\n+\n+\tvideo_->queueBuffer(buffer);\n+\n \treturn 0;\n }\n \n","prefixes":["libcamera-devel","22/27"]}