libcamera: buffer: Split memory information to BufferMemory
The Buffer class is a large beast the stores information about the buffer memory, dynamic metadata related to the frame stored in the buffer, and buffer reference data (in the index). In order to implement buffer import we will need to extend this with dmabuf file descriptors, making usage of the class even more complex. Refactor the Buffer class by splitting the buffer memory information to a BufferMemory class, and repurposing the Buffer class to reference a buffer and to store dynamic metadata. The BufferMemory class becomes a long term storage, valid and stable from the time buffer memory is allocated to the time it is freed. The Buffer class, on the other hand, becomes transient, is created on demand when an application requires a buffer, is given to a request, and is deleted when the request completes. Buffer and BufferMemory don't need to be copied, so their copy constructor and assignment operators are deleted. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
parent
9bb36ec274
commit
a2bcf6feee
15 changed files with 311 additions and 158 deletions
|
@ -211,10 +211,8 @@ protected:
|
|||
return TestFail;
|
||||
|
||||
Stream *stream = *camera_->streams().begin();
|
||||
BufferPool &pool = stream->bufferPool();
|
||||
Buffer &buffer = pool.buffers().front();
|
||||
std::map<Stream *, Buffer *> map = { { stream, &buffer } };
|
||||
if (request->setBuffers(map))
|
||||
std::unique_ptr<Buffer> buffer = stream->createBuffer(0);
|
||||
if (request->addBuffer(std::move(buffer)))
|
||||
return TestFail;
|
||||
|
||||
if (camera_->queueRequest(request))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue