{"id":3095,"url":"https://patchwork.libcamera.org/api/patches/3095/?format=json","web_url":"https://patchwork.libcamera.org/patch/3095/","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":"<20200314235728.15495-3-laurent.pinchart@ideasonboard.com>","date":"2020-03-14T23:57:21","name":"[libcamera-devel,2/9] libcamera: v4l2_videodevice: Rename exportBuffers() to allocateBuffers()","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"aadc5bc2049ed5d4b88f75c5e3ff2d55164f7a39","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/3095/mbox/","series":[{"id":719,"url":"https://patchwork.libcamera.org/api/series/719/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=719","date":"2020-03-14T23:57:19","name":"Simplify buffer management with V4L2 buffer orphaning","version":1,"mbox":"https://patchwork.libcamera.org/series/719/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3095/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3095/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 09881628BD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 15 Mar 2020 00:57:41 +0100 (CET)","from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 9ED9B10CA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 15 Mar 2020 00:57:40 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1584230260;\n\tbh=1EUUWoiFfph+nt+smLZHt5PXLTsde666XMOEaCwqOEo=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=iwbKD7z5aELApCK1GlriyS8PhP5bnPI8+B7r1aGXevoF3igsIKB8yzc9mJZvR0e61\n\tquUO8op0dVfw191SzSkMi6FJBXFJrhC7+MNEG9vB0s4JVDDffaqZUBk1w0SVpQlySB\n\tdYtCtnkGxTUfVZuWlKILSYN0MtHm3ukJEK8fSVak=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Sun, 15 Mar 2020 01:57:21 +0200","Message-Id":"<20200314235728.15495-3-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.24.1","In-Reply-To":"<20200314235728.15495-1-laurent.pinchart@ideasonboard.com>","References":"<20200314235728.15495-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 2/9] libcamera: v4l2_videodevice: Rename\n\texportBuffers() to allocateBuffers()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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":"Sat, 14 Mar 2020 23:57:41 -0000"},"content":"To prepare for the rework of buffer allocation that will differentiate\nexport and allocation, rename exportBuffers() to allocateBuffers().\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/include/v4l2_videodevice.h  |  4 ++--\n src/libcamera/pipeline/ipu3/ipu3.cpp      | 12 ++++++------\n src/libcamera/pipeline/rkisp1/rkisp1.cpp  |  6 +++---\n src/libcamera/pipeline/uvcvideo.cpp       |  2 +-\n src/libcamera/pipeline/vimc.cpp           |  2 +-\n src/libcamera/v4l2_videodevice.cpp        |  4 ++--\n test/libtest/buffer_source.cpp            |  4 ++--\n test/v4l2_videodevice/buffer_sharing.cpp  |  2 +-\n test/v4l2_videodevice/capture_async.cpp   |  6 ++++--\n test/v4l2_videodevice/request_buffers.cpp |  2 +-\n test/v4l2_videodevice/stream_on_off.cpp   |  2 +-\n test/v4l2_videodevice/v4l2_m2mdevice.cpp  |  8 ++++----\n 12 files changed, 28 insertions(+), 26 deletions(-)","diff":"diff --git a/src/libcamera/include/v4l2_videodevice.h b/src/libcamera/include/v4l2_videodevice.h\nindex b2e12608084a..893d28c7db88 100644\n--- a/src/libcamera/include/v4l2_videodevice.h\n+++ b/src/libcamera/include/v4l2_videodevice.h\n@@ -191,8 +191,8 @@ public:\n \tint setCrop(Rectangle *rect);\n \tint setCompose(Rectangle *rect);\n \n-\tint exportBuffers(unsigned int count,\n-\t\t\t  std::vector<std::unique_ptr<FrameBuffer>> *buffers);\n+\tint allocateBuffers(unsigned int count,\n+\t\t\t    std::vector<std::unique_ptr<FrameBuffer>> *buffers);\n \tint importBuffers(unsigned int count);\n \tint releaseBuffers();\n \ndiff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 387bb070b505..10a2698bad09 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -622,7 +622,7 @@ int PipelineHandlerIPU3::exportFrameBuffers(Camera *camera, Stream *stream,\n \tV4L2VideoDevice *video = ipu3stream->device_->dev;\n \tunsigned int count = stream->configuration().bufferCount;\n \n-\treturn video->exportBuffers(count, buffers);\n+\treturn video->allocateBuffers(count, buffers);\n }\n \n int PipelineHandlerIPU3::importFrameBuffers(Camera *camera, Stream *stream)\n@@ -678,7 +678,7 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera)\n \t * the input pool.\n \t * \\todo To be revised when we'll actually use the stat node.\n \t */\n-\tret = imgu->stat_.dev->exportBuffers(bufferCount, &imgu->stat_.buffers);\n+\tret = imgu->stat_.dev->allocateBuffers(bufferCount, &imgu->stat_.buffers);\n \tif (ret < 0) {\n \t\tLOG(IPU3, Error) << \"Failed to allocate ImgU stat buffers\";\n \t\tgoto error;\n@@ -691,7 +691,7 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera)\n \tif (!outStream->active_) {\n \t\tImgUDevice::ImgUOutput *output = outStream->device_;\n \n-\t\tret = output->dev->exportBuffers(bufferCount, &output->buffers);\n+\t\tret = output->dev->allocateBuffers(bufferCount, &output->buffers);\n \t\tif (ret < 0) {\n \t\t\tLOG(IPU3, Error) << \"Failed to allocate ImgU \"\n \t\t\t\t\t << output->name << \" buffers\";\n@@ -702,7 +702,7 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera)\n \tif (!vfStream->active_) {\n \t\tImgUDevice::ImgUOutput *output = vfStream->device_;\n \n-\t\tret = output->dev->exportBuffers(bufferCount, &output->buffers);\n+\t\tret = output->dev->allocateBuffers(bufferCount, &output->buffers);\n \t\tif (ret < 0) {\n \t\t\tLOG(IPU3, Error) << \"Failed to allocate ImgU \"\n \t\t\t\t\t << output->name << \" buffers\";\n@@ -1423,9 +1423,9 @@ int CIO2Device::configure(const Size &size,\n  */\n int CIO2Device::allocateBuffers()\n {\n-\tint ret = output_->exportBuffers(CIO2_BUFFER_COUNT, &buffers_);\n+\tint ret = output_->allocateBuffers(CIO2_BUFFER_COUNT, &buffers_);\n \tif (ret < 0)\n-\t\tLOG(IPU3, Error) << \"Failed to export CIO2 buffers\";\n+\t\tLOG(IPU3, Error) << \"Failed to allocate CIO2 buffers\";\n \n \treturn ret;\n }\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 13433b216747..f6934324c5a3 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -665,7 +665,7 @@ int PipelineHandlerRkISP1::exportFrameBuffers(Camera *camera, Stream *stream,\n \t\t\t\t\t      std::vector<std::unique_ptr<FrameBuffer>> *buffers)\n {\n \tunsigned int count = stream->configuration().bufferCount;\n-\treturn video_->exportBuffers(count, buffers);\n+\treturn video_->allocateBuffers(count, buffers);\n }\n \n int PipelineHandlerRkISP1::importFrameBuffers(Camera *camera, Stream *stream)\n@@ -689,11 +689,11 @@ int PipelineHandlerRkISP1::allocateBuffers(Camera *camera)\n \tfor (const Stream *s : camera->streams())\n \t\tmaxBuffers = std::max(maxBuffers, s->configuration().bufferCount);\n \n-\tret = param_->exportBuffers(maxBuffers, &paramBuffers_);\n+\tret = param_->allocateBuffers(maxBuffers, &paramBuffers_);\n \tif (ret < 0)\n \t\tgoto error;\n \n-\tret = stat_->exportBuffers(maxBuffers, &statBuffers_);\n+\tret = stat_->allocateBuffers(maxBuffers, &statBuffers_);\n \tif (ret < 0)\n \t\tgoto error;\n \ndiff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp\nindex 29afb121aa46..d81627c224ea 100644\n--- a/src/libcamera/pipeline/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo.cpp\n@@ -199,7 +199,7 @@ int PipelineHandlerUVC::exportFrameBuffers(Camera *camera, Stream *stream,\n \tUVCCameraData *data = cameraData(camera);\n \tunsigned int count = stream->configuration().bufferCount;\n \n-\treturn data->video_->exportBuffers(count, buffers);\n+\treturn data->video_->allocateBuffers(count, buffers);\n }\n \n int PipelineHandlerUVC::importFrameBuffers(Camera *camera, Stream *stream)\ndiff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp\nindex 5d3d12fef30b..bb94ef7fd38d 100644\n--- a/src/libcamera/pipeline/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc.cpp\n@@ -265,7 +265,7 @@ int PipelineHandlerVimc::exportFrameBuffers(Camera *camera, Stream *stream,\n \tVimcCameraData *data = cameraData(camera);\n \tunsigned int count = stream->configuration().bufferCount;\n \n-\treturn data->video_->exportBuffers(count, buffers);\n+\treturn data->video_->allocateBuffers(count, buffers);\n }\n \n int PipelineHandlerVimc::importFrameBuffers(Camera *camera, Stream *stream)\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex f89bf2ff781e..aea7a4ea3a23 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -1049,8 +1049,8 @@ int V4L2VideoDevice::requestBuffers(unsigned int count)\n  * \\return The number of allocated buffers on success or a negative error code\n  * otherwise\n  */\n-int V4L2VideoDevice::exportBuffers(unsigned int count,\n-\t\t\t\t   std::vector<std::unique_ptr<FrameBuffer>> *buffers)\n+int V4L2VideoDevice::allocateBuffers(unsigned int count,\n+\t\t\t\t     std::vector<std::unique_ptr<FrameBuffer>> *buffers)\n {\n \tif (cache_) {\n \t\tLOG(V4L2, Error) << \"Buffers already allocated\";\ndiff --git a/test/libtest/buffer_source.cpp b/test/libtest/buffer_source.cpp\nindex 0c33200b47ad..26d2764d5f8f 100644\n--- a/test/libtest/buffer_source.cpp\n+++ b/test/libtest/buffer_source.cpp\n@@ -76,8 +76,8 @@ int BufferSource::allocate(const StreamConfiguration &config)\n \t\treturn TestFail;\n \t}\n \n-\tif (video->exportBuffers(config.bufferCount, &buffers_) < 0) {\n-\t\tstd::cout << \"Failed to export buffers\" << std::endl;\n+\tif (video->allocateBuffers(config.bufferCount, &buffers_) < 0) {\n+\t\tstd::cout << \"Failed to allocate buffers\" << std::endl;\n \t\treturn TestFail;\n \t}\n \ndiff --git a/test/v4l2_videodevice/buffer_sharing.cpp b/test/v4l2_videodevice/buffer_sharing.cpp\nindex fefa969a5f39..14d3055ad7d1 100644\n--- a/test/v4l2_videodevice/buffer_sharing.cpp\n+++ b/test/v4l2_videodevice/buffer_sharing.cpp\n@@ -73,7 +73,7 @@ protected:\n \t\t\treturn TestFail;\n \t\t}\n \n-\t\tret = capture_->exportBuffers(bufferCount, &buffers_);\n+\t\tret = capture_->allocateBuffers(bufferCount, &buffers_);\n \t\tif (ret < 0) {\n \t\t\tstd::cout << \"Failed to allocate buffers\" << std::endl;\n \t\t\treturn TestFail;\ndiff --git a/test/v4l2_videodevice/capture_async.cpp b/test/v4l2_videodevice/capture_async.cpp\nindex 6a103a035f3d..b38aabc6263d 100644\n--- a/test/v4l2_videodevice/capture_async.cpp\n+++ b/test/v4l2_videodevice/capture_async.cpp\n@@ -38,9 +38,11 @@ protected:\n \t\tTimer timeout;\n \t\tint ret;\n \n-\t\tret = capture_->exportBuffers(bufferCount, &buffers_);\n-\t\tif (ret < 0)\n+\t\tret = capture_->allocateBuffers(bufferCount, &buffers_);\n+\t\tif (ret < 0) {\n+\t\t\tstd::cout << \"Failed to allocate buffers\" << std::endl;\n \t\t\treturn TestFail;\n+\t\t}\n \n \t\tcapture_->bufferReady.connect(this, &CaptureAsyncTest::receiveBuffer);\n \ndiff --git a/test/v4l2_videodevice/request_buffers.cpp b/test/v4l2_videodevice/request_buffers.cpp\nindex 1dd65b05da43..2f8dfe1cafb1 100644\n--- a/test/v4l2_videodevice/request_buffers.cpp\n+++ b/test/v4l2_videodevice/request_buffers.cpp\n@@ -18,7 +18,7 @@ protected:\n \t{\n \t\tconst unsigned int bufferCount = 8;\n \n-\t\tint ret = capture_->exportBuffers(bufferCount, &buffers_);\n+\t\tint ret = capture_->allocateBuffers(bufferCount, &buffers_);\n \t\tif (ret != bufferCount)\n \t\t\treturn TestFail;\n \ndiff --git a/test/v4l2_videodevice/stream_on_off.cpp b/test/v4l2_videodevice/stream_on_off.cpp\nindex 552df0963633..ce48310aa2b7 100644\n--- a/test/v4l2_videodevice/stream_on_off.cpp\n+++ b/test/v4l2_videodevice/stream_on_off.cpp\n@@ -17,7 +17,7 @@ protected:\n \t{\n \t\tconst unsigned int bufferCount = 8;\n \n-\t\tint ret = capture_->exportBuffers(bufferCount, &buffers_);\n+\t\tint ret = capture_->allocateBuffers(bufferCount, &buffers_);\n \t\tif (ret < 0)\n \t\t\treturn TestFail;\n \ndiff --git a/test/v4l2_videodevice/v4l2_m2mdevice.cpp b/test/v4l2_videodevice/v4l2_m2mdevice.cpp\nindex 203afc4fc033..d20e5dfc3077 100644\n--- a/test/v4l2_videodevice/v4l2_m2mdevice.cpp\n+++ b/test/v4l2_videodevice/v4l2_m2mdevice.cpp\n@@ -112,15 +112,15 @@ protected:\n \t\t\treturn TestFail;\n \t\t}\n \n-\t\tret = capture->exportBuffers(bufferCount, &captureBuffers_);\n+\t\tret = capture->allocateBuffers(bufferCount, &captureBuffers_);\n \t\tif (ret < 0) {\n-\t\t\tcerr << \"Failed to export Capture Buffers\" << endl;\n+\t\t\tcerr << \"Failed to allocate Capture Buffers\" << endl;\n \t\t\treturn TestFail;\n \t\t}\n \n-\t\tret = output->exportBuffers(bufferCount, &outputBuffers_);\n+\t\tret = output->allocateBuffers(bufferCount, &outputBuffers_);\n \t\tif (ret < 0) {\n-\t\t\tcerr << \"Failed to export Output Buffers\" << endl;\n+\t\t\tcerr << \"Failed to allocate Output Buffers\" << endl;\n \t\t\treturn TestFail;\n \t\t}\n \n","prefixes":["libcamera-devel","2/9"]}