From patchwork Sat Mar 14 23:57:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 3095 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 09881628BD for ; Sun, 15 Mar 2020 00:57:41 +0100 (CET) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9ED9B10CA for ; Sun, 15 Mar 2020 00:57:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1584230260; bh=1EUUWoiFfph+nt+smLZHt5PXLTsde666XMOEaCwqOEo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=iwbKD7z5aELApCK1GlriyS8PhP5bnPI8+B7r1aGXevoF3igsIKB8yzc9mJZvR0e61 quUO8op0dVfw191SzSkMi6FJBXFJrhC7+MNEG9vB0s4JVDDffaqZUBk1w0SVpQlySB dYtCtnkGxTUfVZuWlKILSYN0MtHm3ukJEK8fSVak= From: Laurent Pinchart 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 Subject: [libcamera-devel] [PATCH 2/9] libcamera: v4l2_videodevice: Rename exportBuffers() to allocateBuffers() X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Mar 2020 23:57:41 -0000 To prepare for the rework of buffer allocation that will differentiate export and allocation, rename exportBuffers() to allocateBuffers(). Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/libcamera/include/v4l2_videodevice.h | 4 ++-- src/libcamera/pipeline/ipu3/ipu3.cpp | 12 ++++++------ src/libcamera/pipeline/rkisp1/rkisp1.cpp | 6 +++--- src/libcamera/pipeline/uvcvideo.cpp | 2 +- src/libcamera/pipeline/vimc.cpp | 2 +- src/libcamera/v4l2_videodevice.cpp | 4 ++-- test/libtest/buffer_source.cpp | 4 ++-- test/v4l2_videodevice/buffer_sharing.cpp | 2 +- test/v4l2_videodevice/capture_async.cpp | 6 ++++-- test/v4l2_videodevice/request_buffers.cpp | 2 +- test/v4l2_videodevice/stream_on_off.cpp | 2 +- test/v4l2_videodevice/v4l2_m2mdevice.cpp | 8 ++++---- 12 files changed, 28 insertions(+), 26 deletions(-) diff --git a/src/libcamera/include/v4l2_videodevice.h b/src/libcamera/include/v4l2_videodevice.h index b2e12608084a..893d28c7db88 100644 --- a/src/libcamera/include/v4l2_videodevice.h +++ b/src/libcamera/include/v4l2_videodevice.h @@ -191,8 +191,8 @@ public: int setCrop(Rectangle *rect); int setCompose(Rectangle *rect); - int exportBuffers(unsigned int count, - std::vector> *buffers); + int allocateBuffers(unsigned int count, + std::vector> *buffers); int importBuffers(unsigned int count); int releaseBuffers(); diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 387bb070b505..10a2698bad09 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -622,7 +622,7 @@ int PipelineHandlerIPU3::exportFrameBuffers(Camera *camera, Stream *stream, V4L2VideoDevice *video = ipu3stream->device_->dev; unsigned int count = stream->configuration().bufferCount; - return video->exportBuffers(count, buffers); + return video->allocateBuffers(count, buffers); } int PipelineHandlerIPU3::importFrameBuffers(Camera *camera, Stream *stream) @@ -678,7 +678,7 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera) * the input pool. * \todo To be revised when we'll actually use the stat node. */ - ret = imgu->stat_.dev->exportBuffers(bufferCount, &imgu->stat_.buffers); + ret = imgu->stat_.dev->allocateBuffers(bufferCount, &imgu->stat_.buffers); if (ret < 0) { LOG(IPU3, Error) << "Failed to allocate ImgU stat buffers"; goto error; @@ -691,7 +691,7 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera) if (!outStream->active_) { ImgUDevice::ImgUOutput *output = outStream->device_; - ret = output->dev->exportBuffers(bufferCount, &output->buffers); + ret = output->dev->allocateBuffers(bufferCount, &output->buffers); if (ret < 0) { LOG(IPU3, Error) << "Failed to allocate ImgU " << output->name << " buffers"; @@ -702,7 +702,7 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera) if (!vfStream->active_) { ImgUDevice::ImgUOutput *output = vfStream->device_; - ret = output->dev->exportBuffers(bufferCount, &output->buffers); + ret = output->dev->allocateBuffers(bufferCount, &output->buffers); if (ret < 0) { LOG(IPU3, Error) << "Failed to allocate ImgU " << output->name << " buffers"; @@ -1423,9 +1423,9 @@ int CIO2Device::configure(const Size &size, */ int CIO2Device::allocateBuffers() { - int ret = output_->exportBuffers(CIO2_BUFFER_COUNT, &buffers_); + int ret = output_->allocateBuffers(CIO2_BUFFER_COUNT, &buffers_); if (ret < 0) - LOG(IPU3, Error) << "Failed to export CIO2 buffers"; + LOG(IPU3, Error) << "Failed to allocate CIO2 buffers"; return ret; } diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 13433b216747..f6934324c5a3 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -665,7 +665,7 @@ int PipelineHandlerRkISP1::exportFrameBuffers(Camera *camera, Stream *stream, std::vector> *buffers) { unsigned int count = stream->configuration().bufferCount; - return video_->exportBuffers(count, buffers); + return video_->allocateBuffers(count, buffers); } int PipelineHandlerRkISP1::importFrameBuffers(Camera *camera, Stream *stream) @@ -689,11 +689,11 @@ int PipelineHandlerRkISP1::allocateBuffers(Camera *camera) for (const Stream *s : camera->streams()) maxBuffers = std::max(maxBuffers, s->configuration().bufferCount); - ret = param_->exportBuffers(maxBuffers, ¶mBuffers_); + ret = param_->allocateBuffers(maxBuffers, ¶mBuffers_); if (ret < 0) goto error; - ret = stat_->exportBuffers(maxBuffers, &statBuffers_); + ret = stat_->allocateBuffers(maxBuffers, &statBuffers_); if (ret < 0) goto error; diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp index 29afb121aa46..d81627c224ea 100644 --- a/src/libcamera/pipeline/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo.cpp @@ -199,7 +199,7 @@ int PipelineHandlerUVC::exportFrameBuffers(Camera *camera, Stream *stream, UVCCameraData *data = cameraData(camera); unsigned int count = stream->configuration().bufferCount; - return data->video_->exportBuffers(count, buffers); + return data->video_->allocateBuffers(count, buffers); } int PipelineHandlerUVC::importFrameBuffers(Camera *camera, Stream *stream) diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp index 5d3d12fef30b..bb94ef7fd38d 100644 --- a/src/libcamera/pipeline/vimc.cpp +++ b/src/libcamera/pipeline/vimc.cpp @@ -265,7 +265,7 @@ int PipelineHandlerVimc::exportFrameBuffers(Camera *camera, Stream *stream, VimcCameraData *data = cameraData(camera); unsigned int count = stream->configuration().bufferCount; - return data->video_->exportBuffers(count, buffers); + return data->video_->allocateBuffers(count, buffers); } int PipelineHandlerVimc::importFrameBuffers(Camera *camera, Stream *stream) diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index f89bf2ff781e..aea7a4ea3a23 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -1049,8 +1049,8 @@ int V4L2VideoDevice::requestBuffers(unsigned int count) * \return The number of allocated buffers on success or a negative error code * otherwise */ -int V4L2VideoDevice::exportBuffers(unsigned int count, - std::vector> *buffers) +int V4L2VideoDevice::allocateBuffers(unsigned int count, + std::vector> *buffers) { if (cache_) { LOG(V4L2, Error) << "Buffers already allocated"; diff --git a/test/libtest/buffer_source.cpp b/test/libtest/buffer_source.cpp index 0c33200b47ad..26d2764d5f8f 100644 --- a/test/libtest/buffer_source.cpp +++ b/test/libtest/buffer_source.cpp @@ -76,8 +76,8 @@ int BufferSource::allocate(const StreamConfiguration &config) return TestFail; } - if (video->exportBuffers(config.bufferCount, &buffers_) < 0) { - std::cout << "Failed to export buffers" << std::endl; + if (video->allocateBuffers(config.bufferCount, &buffers_) < 0) { + std::cout << "Failed to allocate buffers" << std::endl; return TestFail; } diff --git a/test/v4l2_videodevice/buffer_sharing.cpp b/test/v4l2_videodevice/buffer_sharing.cpp index fefa969a5f39..14d3055ad7d1 100644 --- a/test/v4l2_videodevice/buffer_sharing.cpp +++ b/test/v4l2_videodevice/buffer_sharing.cpp @@ -73,7 +73,7 @@ protected: return TestFail; } - ret = capture_->exportBuffers(bufferCount, &buffers_); + ret = capture_->allocateBuffers(bufferCount, &buffers_); if (ret < 0) { std::cout << "Failed to allocate buffers" << std::endl; return TestFail; diff --git a/test/v4l2_videodevice/capture_async.cpp b/test/v4l2_videodevice/capture_async.cpp index 6a103a035f3d..b38aabc6263d 100644 --- a/test/v4l2_videodevice/capture_async.cpp +++ b/test/v4l2_videodevice/capture_async.cpp @@ -38,9 +38,11 @@ protected: Timer timeout; int ret; - ret = capture_->exportBuffers(bufferCount, &buffers_); - if (ret < 0) + ret = capture_->allocateBuffers(bufferCount, &buffers_); + if (ret < 0) { + std::cout << "Failed to allocate buffers" << std::endl; return TestFail; + } capture_->bufferReady.connect(this, &CaptureAsyncTest::receiveBuffer); diff --git a/test/v4l2_videodevice/request_buffers.cpp b/test/v4l2_videodevice/request_buffers.cpp index 1dd65b05da43..2f8dfe1cafb1 100644 --- a/test/v4l2_videodevice/request_buffers.cpp +++ b/test/v4l2_videodevice/request_buffers.cpp @@ -18,7 +18,7 @@ protected: { const unsigned int bufferCount = 8; - int ret = capture_->exportBuffers(bufferCount, &buffers_); + int ret = capture_->allocateBuffers(bufferCount, &buffers_); if (ret != bufferCount) return TestFail; diff --git a/test/v4l2_videodevice/stream_on_off.cpp b/test/v4l2_videodevice/stream_on_off.cpp index 552df0963633..ce48310aa2b7 100644 --- a/test/v4l2_videodevice/stream_on_off.cpp +++ b/test/v4l2_videodevice/stream_on_off.cpp @@ -17,7 +17,7 @@ protected: { const unsigned int bufferCount = 8; - int ret = capture_->exportBuffers(bufferCount, &buffers_); + int ret = capture_->allocateBuffers(bufferCount, &buffers_); if (ret < 0) return TestFail; diff --git a/test/v4l2_videodevice/v4l2_m2mdevice.cpp b/test/v4l2_videodevice/v4l2_m2mdevice.cpp index 203afc4fc033..d20e5dfc3077 100644 --- a/test/v4l2_videodevice/v4l2_m2mdevice.cpp +++ b/test/v4l2_videodevice/v4l2_m2mdevice.cpp @@ -112,15 +112,15 @@ protected: return TestFail; } - ret = capture->exportBuffers(bufferCount, &captureBuffers_); + ret = capture->allocateBuffers(bufferCount, &captureBuffers_); if (ret < 0) { - cerr << "Failed to export Capture Buffers" << endl; + cerr << "Failed to allocate Capture Buffers" << endl; return TestFail; } - ret = output->exportBuffers(bufferCount, &outputBuffers_); + ret = output->allocateBuffers(bufferCount, &outputBuffers_); if (ret < 0) { - cerr << "Failed to export Output Buffers" << endl; + cerr << "Failed to allocate Output Buffers" << endl; return TestFail; }