summaryrefslogtreecommitdiff
path: root/src/libcamera/include/v4l2_videodevice.h
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-07-09 18:08:07 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-07-14 16:00:54 +0300
commita2bcf6feee5ae6077225cc787c3d1a25d9ef95e7 (patch)
treeb654f7e4a25852edba8ba1ecaff86779ccddb25e /src/libcamera/include/v4l2_videodevice.h
parent9bb36ec274da530e509fe2f4010b262c43e812f3 (diff)
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>
Diffstat (limited to 'src/libcamera/include/v4l2_videodevice.h')
-rw-r--r--src/libcamera/include/v4l2_videodevice.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libcamera/include/v4l2_videodevice.h b/src/libcamera/include/v4l2_videodevice.h
index 2996a609..f5c8da93 100644
--- a/src/libcamera/include/v4l2_videodevice.h
+++ b/src/libcamera/include/v4l2_videodevice.h
@@ -7,7 +7,6 @@
#ifndef __LIBCAMERA_V4L2_VIDEODEVICE_H__
#define __LIBCAMERA_V4L2_VIDEODEVICE_H__
-#include <atomic>
#include <string>
#include <vector>
@@ -23,6 +22,7 @@
namespace libcamera {
class Buffer;
+class BufferMemory;
class BufferPool;
class EventNotifier;
class MediaDevice;
@@ -165,8 +165,8 @@ private:
std::vector<SizeRange> enumSizes(unsigned int pixelFormat);
int requestBuffers(unsigned int count);
- int createPlane(Buffer *buffer, unsigned int plane,
- unsigned int length);
+ int createPlane(BufferMemory *buffer, unsigned int index,
+ unsigned int plane, unsigned int length);
Buffer *dequeueBuffer();
void bufferAvailable(EventNotifier *notifier);
@@ -177,7 +177,7 @@ private:
enum v4l2_memory memoryType_;
BufferPool *bufferPool_;
- std::atomic<unsigned int> queuedBuffersCount_;
+ std::map<unsigned int, Buffer *> queuedBuffers_;
EventNotifier *fdEvent_;
};