{"id":508,"url":"https://patchwork.libcamera.org/api/patches/508/?format=json","web_url":"https://patchwork.libcamera.org/patch/508/","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":"<20190205000702.15370-6-niklas.soderlund@ragnatech.se>","date":"2019-02-05T00:07:00","name":"[libcamera-devel,RFC,5/7] libcamera: pipeline: uvcvideo: add allocateBuffers and freeBuffers support","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"063f1e09f6a7535ef39bf4f5821537afefc8c357","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/?format=json","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"delegate":{"id":16,"url":"https://patchwork.libcamera.org/api/users/16/?format=json","username":"neg","first_name":"Niklas","last_name":"Söderlund","email":"niklas.soderlund@ragnatech.se"},"mbox":"https://patchwork.libcamera.org/patch/508/mbox/","series":[{"id":168,"url":"https://patchwork.libcamera.org/api/series/168/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=168","date":"2019-02-05T00:06:55","name":"libcamera: extend camera and pipeline to support requests","version":1,"mbox":"https://patchwork.libcamera.org/series/168/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/508/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/508/checks/","tags":{},"headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net\n\t[195.74.38.228])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3E38D60DC9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  5 Feb 2019 01:07:58 +0100 (CET)","from localhost.localdomain (unknown [81.164.19.127])\n\tby bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA\n\tid 168d0373-28da-11e9-b530-005056917a89;\n\tTue, 05 Feb 2019 01:07:56 +0100 (CET)"],"X-Halon-ID":"168d0373-28da-11e9-b530-005056917a89","Authorized-sender":"niklas@soderlund.pp.se","From":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue,  5 Feb 2019 01:07:00 +0100","Message-Id":"<20190205000702.15370-6-niklas.soderlund@ragnatech.se>","X-Mailer":"git-send-email 2.20.1","In-Reply-To":"<20190205000702.15370-1-niklas.soderlund@ragnatech.se>","References":"<20190205000702.15370-1-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [RFC 5/7] libcamera: pipeline: uvcvideo: add\n\tallocateBuffers and freeBuffers 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":"Tue, 05 Feb 2019 00:07:58 -0000"},"content":"Allow the UVC pipeline to allocate and free buffers for the single\nstream attached to the camera. The buffers are allocated and freed\nutilising the V4L2Device requestBuffers() and releaseBuffers()\ninterface.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/libcamera/pipeline/uvcvideo.cpp | 13 +++++++++++--\n 1 file changed, 11 insertions(+), 2 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp\nindex 8b3f0ce7e2112564..3685dbf9d19c3d7d 100644\n--- a/src/libcamera/pipeline/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo.cpp\n@@ -96,12 +96,21 @@ std::map<Stream *, BufferPool *>\n PipelineHandlerUVC::allocateBuffers(Camera *camera,\n \t\t\t\t    std::map<Stream *, StreamConfiguration> &config)\n {\n-\treturn std::map<Stream *, BufferPool *> {};\n+\tStreamConfiguration *cfg = &config[&stream_];\n+\n+\tLOG(UVC, Debug) << \"Requesting \" << cfg->bufferCount << \" buffers\";\n+\n+\tBufferPool *pool = video_->requestBuffers(cfg->bufferCount);\n+\n+\tif (!pool)\n+\t\tLOG(UVC, Error) << \"Failed to acquire a buffer pool\";\n+\n+\treturn std::map<Stream *, BufferPool *> { {&stream_, pool} };\n }\n \n int PipelineHandlerUVC::freeBuffers(Camera *camera)\n {\n-\treturn 0;\n+\treturn video_->releaseBuffers();\n }\n \n int PipelineHandlerUVC::start(const Camera *camera)\n","prefixes":["libcamera-devel","RFC","5/7"]}