summaryrefslogtreecommitdiff
path: root/src/libcamera/v4l2_videodevice.cpp
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-11-26 00:04:53 +0100
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-01-12 16:10:37 +0100
commitae9a05847cead7ddedba0ae150e538562afbb13f (patch)
tree0a73fab59990c825235e31075676717dfede16d5 /src/libcamera/v4l2_videodevice.cpp
parent007517618c8440d09cfd39db5dbf451e87ef703a (diff)
libcamera: buffer: Switch from Plane to FrameBuffer::Plane
It is not libcamera's responsibility to handle memory mappings. Switch from the soon to be removed Plane class which deals with memory mappings to FrameBuffer::Plane which just describes it. This makes the transition to the full FrameBuffer easier. As the full FrameBuffer interface has not yet spread to all parts of libcamera core it is hard to create efficient caching of memory mappings in the qcam application. This will be fixed in a later patch, for now the dmabuf is mapped and unmapped each time it is seen by the application. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/libcamera/v4l2_videodevice.cpp')
-rw-r--r--src/libcamera/v4l2_videodevice.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
index 033f7cc0..1dc9e193 100644
--- a/src/libcamera/v4l2_videodevice.cpp
+++ b/src/libcamera/v4l2_videodevice.cpp
@@ -922,9 +922,10 @@ int V4L2VideoDevice::createPlane(BufferMemory *buffer, unsigned int index,
return ret;
}
- buffer->planes().emplace_back();
- Plane &plane = buffer->planes().back();
- plane.setDmabuf(expbuf.fd, length);
+ FrameBuffer::Plane plane;
+ plane.fd = FileDescriptor(expbuf.fd);
+ plane.length = length;
+ buffer->planes().push_back(plane);
::close(expbuf.fd);
return 0;
@@ -987,14 +988,14 @@ int V4L2VideoDevice::queueBuffer(Buffer *buffer)
bool multiPlanar = V4L2_TYPE_IS_MULTIPLANAR(buf.type);
BufferMemory *mem = &bufferPool_->buffers()[buf.index];
- const std::vector<Plane> &planes = mem->planes();
+ const std::vector<FrameBuffer::Plane> &planes = mem->planes();
if (buf.memory == V4L2_MEMORY_DMABUF) {
if (multiPlanar) {
for (unsigned int p = 0; p < planes.size(); ++p)
- v4l2Planes[p].m.fd = planes[p].dmabuf();
+ v4l2Planes[p].m.fd = planes[p].fd.fd();
} else {
- buf.m.fd = planes[0].dmabuf();
+ buf.m.fd = planes[0].fd.fd();
}
}