mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-25 09:35:06 +03:00
libcamera: software_isp: Refactor SoftwareIsp to use DmaBufAllocator::exportBuffers
As the helper function DmaBufAllocator::exportBuffers is added, we can avoid some code duplication in SoftwareIsp as well. Signed-off-by: Harvey Yang <chenghaoyang@chromium.org> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
2716a95852
commit
9a5f91c78a
1 changed files with 1 additions and 19 deletions
|
@ -256,25 +256,7 @@ int SoftwareIsp::exportBuffers(const Stream *stream, unsigned int count,
|
|||
if (stream == nullptr)
|
||||
return -EINVAL;
|
||||
|
||||
for (unsigned int i = 0; i < count; i++) {
|
||||
const std::string name = "frame-" + std::to_string(i);
|
||||
const size_t frameSize = debayer_->frameSize();
|
||||
|
||||
FrameBuffer::Plane outPlane;
|
||||
outPlane.fd = SharedFD(dmaHeap_.alloc(name.c_str(), frameSize));
|
||||
if (!outPlane.fd.isValid()) {
|
||||
LOG(SoftwareIsp, Error)
|
||||
<< "failed to allocate a dma_buf";
|
||||
return -ENOMEM;
|
||||
}
|
||||
outPlane.offset = 0;
|
||||
outPlane.length = frameSize;
|
||||
|
||||
std::vector<FrameBuffer::Plane> planes{ outPlane };
|
||||
buffers->emplace_back(std::make_unique<FrameBuffer>(std::move(planes)));
|
||||
}
|
||||
|
||||
return count;
|
||||
return dmaHeap_.exportBuffers(count, { debayer_->frameSize() }, buffers);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue