mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-13 15:29:45 +03:00
libcamera: v4l2_videodevice: Rename exportBuffers() to allocateBuffers()
To prepare for the rework of buffer allocation that will differentiate export and allocation, rename exportBuffers() to allocateBuffers(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
parent
556e03fea7
commit
46011623bc
12 changed files with 28 additions and 26 deletions
|
@ -189,8 +189,8 @@ public:
|
||||||
int setCrop(Rectangle *rect);
|
int setCrop(Rectangle *rect);
|
||||||
int setCompose(Rectangle *rect);
|
int setCompose(Rectangle *rect);
|
||||||
|
|
||||||
int exportBuffers(unsigned int count,
|
int allocateBuffers(unsigned int count,
|
||||||
std::vector<std::unique_ptr<FrameBuffer>> *buffers);
|
std::vector<std::unique_ptr<FrameBuffer>> *buffers);
|
||||||
int importBuffers(unsigned int count);
|
int importBuffers(unsigned int count);
|
||||||
int releaseBuffers();
|
int releaseBuffers();
|
||||||
|
|
||||||
|
|
|
@ -621,7 +621,7 @@ int PipelineHandlerIPU3::exportFrameBuffers(Camera *camera, Stream *stream,
|
||||||
V4L2VideoDevice *video = ipu3stream->device_->dev;
|
V4L2VideoDevice *video = ipu3stream->device_->dev;
|
||||||
unsigned int count = stream->configuration().bufferCount;
|
unsigned int count = stream->configuration().bufferCount;
|
||||||
|
|
||||||
return video->exportBuffers(count, buffers);
|
return video->allocateBuffers(count, buffers);
|
||||||
}
|
}
|
||||||
|
|
||||||
int PipelineHandlerIPU3::importFrameBuffers(Camera *camera, Stream *stream)
|
int PipelineHandlerIPU3::importFrameBuffers(Camera *camera, Stream *stream)
|
||||||
|
@ -677,7 +677,7 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera)
|
||||||
* the input pool.
|
* the input pool.
|
||||||
* \todo To be revised when we'll actually use the stat node.
|
* \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) {
|
if (ret < 0) {
|
||||||
LOG(IPU3, Error) << "Failed to allocate ImgU stat buffers";
|
LOG(IPU3, Error) << "Failed to allocate ImgU stat buffers";
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -690,7 +690,7 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera)
|
||||||
if (!outStream->active_) {
|
if (!outStream->active_) {
|
||||||
ImgUDevice::ImgUOutput *output = outStream->device_;
|
ImgUDevice::ImgUOutput *output = outStream->device_;
|
||||||
|
|
||||||
ret = output->dev->exportBuffers(bufferCount, &output->buffers);
|
ret = output->dev->allocateBuffers(bufferCount, &output->buffers);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
LOG(IPU3, Error) << "Failed to allocate ImgU "
|
LOG(IPU3, Error) << "Failed to allocate ImgU "
|
||||||
<< output->name << " buffers";
|
<< output->name << " buffers";
|
||||||
|
@ -701,7 +701,7 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera)
|
||||||
if (!vfStream->active_) {
|
if (!vfStream->active_) {
|
||||||
ImgUDevice::ImgUOutput *output = vfStream->device_;
|
ImgUDevice::ImgUOutput *output = vfStream->device_;
|
||||||
|
|
||||||
ret = output->dev->exportBuffers(bufferCount, &output->buffers);
|
ret = output->dev->allocateBuffers(bufferCount, &output->buffers);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
LOG(IPU3, Error) << "Failed to allocate ImgU "
|
LOG(IPU3, Error) << "Failed to allocate ImgU "
|
||||||
<< output->name << " buffers";
|
<< output->name << " buffers";
|
||||||
|
@ -1422,9 +1422,9 @@ int CIO2Device::configure(const Size &size,
|
||||||
*/
|
*/
|
||||||
int CIO2Device::allocateBuffers()
|
int CIO2Device::allocateBuffers()
|
||||||
{
|
{
|
||||||
int ret = output_->exportBuffers(CIO2_BUFFER_COUNT, &buffers_);
|
int ret = output_->allocateBuffers(CIO2_BUFFER_COUNT, &buffers_);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
LOG(IPU3, Error) << "Failed to export CIO2 buffers";
|
LOG(IPU3, Error) << "Failed to allocate CIO2 buffers";
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -664,7 +664,7 @@ int PipelineHandlerRkISP1::exportFrameBuffers(Camera *camera, Stream *stream,
|
||||||
std::vector<std::unique_ptr<FrameBuffer>> *buffers)
|
std::vector<std::unique_ptr<FrameBuffer>> *buffers)
|
||||||
{
|
{
|
||||||
unsigned int count = stream->configuration().bufferCount;
|
unsigned int count = stream->configuration().bufferCount;
|
||||||
return video_->exportBuffers(count, buffers);
|
return video_->allocateBuffers(count, buffers);
|
||||||
}
|
}
|
||||||
|
|
||||||
int PipelineHandlerRkISP1::importFrameBuffers(Camera *camera, Stream *stream)
|
int PipelineHandlerRkISP1::importFrameBuffers(Camera *camera, Stream *stream)
|
||||||
|
@ -688,11 +688,11 @@ int PipelineHandlerRkISP1::allocateBuffers(Camera *camera)
|
||||||
for (const Stream *s : camera->streams())
|
for (const Stream *s : camera->streams())
|
||||||
maxBuffers = std::max(maxBuffers, s->configuration().bufferCount);
|
maxBuffers = std::max(maxBuffers, s->configuration().bufferCount);
|
||||||
|
|
||||||
ret = param_->exportBuffers(maxBuffers, ¶mBuffers_);
|
ret = param_->allocateBuffers(maxBuffers, ¶mBuffers_);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
ret = stat_->exportBuffers(maxBuffers, &statBuffers_);
|
ret = stat_->allocateBuffers(maxBuffers, &statBuffers_);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
|
|
@ -211,7 +211,7 @@ int PipelineHandlerUVC::exportFrameBuffers(Camera *camera, Stream *stream,
|
||||||
UVCCameraData *data = cameraData(camera);
|
UVCCameraData *data = cameraData(camera);
|
||||||
unsigned int count = stream->configuration().bufferCount;
|
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)
|
int PipelineHandlerUVC::importFrameBuffers(Camera *camera, Stream *stream)
|
||||||
|
|
|
@ -264,7 +264,7 @@ int PipelineHandlerVimc::exportFrameBuffers(Camera *camera, Stream *stream,
|
||||||
VimcCameraData *data = cameraData(camera);
|
VimcCameraData *data = cameraData(camera);
|
||||||
unsigned int count = stream->configuration().bufferCount;
|
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)
|
int PipelineHandlerVimc::importFrameBuffers(Camera *camera, Stream *stream)
|
||||||
|
|
|
@ -1033,8 +1033,8 @@ int V4L2VideoDevice::requestBuffers(unsigned int count)
|
||||||
* \return The number of allocated buffers on success or a negative error code
|
* \return The number of allocated buffers on success or a negative error code
|
||||||
* otherwise
|
* otherwise
|
||||||
*/
|
*/
|
||||||
int V4L2VideoDevice::exportBuffers(unsigned int count,
|
int V4L2VideoDevice::allocateBuffers(unsigned int count,
|
||||||
std::vector<std::unique_ptr<FrameBuffer>> *buffers)
|
std::vector<std::unique_ptr<FrameBuffer>> *buffers)
|
||||||
{
|
{
|
||||||
if (cache_) {
|
if (cache_) {
|
||||||
LOG(V4L2, Error) << "Buffers already allocated";
|
LOG(V4L2, Error) << "Buffers already allocated";
|
||||||
|
|
|
@ -76,8 +76,8 @@ int BufferSource::allocate(const StreamConfiguration &config)
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (video->exportBuffers(config.bufferCount, &buffers_) < 0) {
|
if (video->allocateBuffers(config.bufferCount, &buffers_) < 0) {
|
||||||
std::cout << "Failed to export buffers" << std::endl;
|
std::cout << "Failed to allocate buffers" << std::endl;
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ protected:
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = capture_->exportBuffers(bufferCount, &buffers_);
|
ret = capture_->allocateBuffers(bufferCount, &buffers_);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
std::cout << "Failed to allocate buffers" << std::endl;
|
std::cout << "Failed to allocate buffers" << std::endl;
|
||||||
return TestFail;
|
return TestFail;
|
||||||
|
|
|
@ -38,9 +38,11 @@ protected:
|
||||||
Timer timeout;
|
Timer timeout;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = capture_->exportBuffers(bufferCount, &buffers_);
|
ret = capture_->allocateBuffers(bufferCount, &buffers_);
|
||||||
if (ret < 0)
|
if (ret < 0) {
|
||||||
|
std::cout << "Failed to allocate buffers" << std::endl;
|
||||||
return TestFail;
|
return TestFail;
|
||||||
|
}
|
||||||
|
|
||||||
capture_->bufferReady.connect(this, &CaptureAsyncTest::receiveBuffer);
|
capture_->bufferReady.connect(this, &CaptureAsyncTest::receiveBuffer);
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ protected:
|
||||||
{
|
{
|
||||||
const unsigned int bufferCount = 8;
|
const unsigned int bufferCount = 8;
|
||||||
|
|
||||||
int ret = capture_->exportBuffers(bufferCount, &buffers_);
|
int ret = capture_->allocateBuffers(bufferCount, &buffers_);
|
||||||
if (ret != bufferCount)
|
if (ret != bufferCount)
|
||||||
return TestFail;
|
return TestFail;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ protected:
|
||||||
{
|
{
|
||||||
const unsigned int bufferCount = 8;
|
const unsigned int bufferCount = 8;
|
||||||
|
|
||||||
int ret = capture_->exportBuffers(bufferCount, &buffers_);
|
int ret = capture_->allocateBuffers(bufferCount, &buffers_);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return TestFail;
|
return TestFail;
|
||||||
|
|
||||||
|
|
|
@ -112,15 +112,15 @@ protected:
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = capture->exportBuffers(bufferCount, &captureBuffers_);
|
ret = capture->allocateBuffers(bufferCount, &captureBuffers_);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
cerr << "Failed to export Capture Buffers" << endl;
|
cerr << "Failed to allocate Capture Buffers" << endl;
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = output->exportBuffers(bufferCount, &outputBuffers_);
|
ret = output->allocateBuffers(bufferCount, &outputBuffers_);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
cerr << "Failed to export Output Buffers" << endl;
|
cerr << "Failed to allocate Output Buffers" << endl;
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue