[libcamera-devel,v2] libcamera: v4l2_videodevice: Avoid extra construction of Framebuffer
diff mbox series

Message ID 20210719040152.43462-1-umang.jain@ideasonboard.com
State Accepted
Headers show
Series
  • [libcamera-devel,v2] libcamera: v4l2_videodevice: Avoid extra construction of Framebuffer
Related show

Commit Message

Umang Jain July 19, 2021, 4:01 a.m. UTC
While populating the V4L2BufferCache, avoid the extra construction of
FrameBuffer, which is currently done by passing the vector of
FrameBuffer::Planes. It is not wrong per se, but futile to have another
construction of FrameBuffer from a copy of buffer->planes() for the
corresponding Entry.

This commit does not introduce any functional changes.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
- This is v2 of the initial series under the subject:
  - "libcamera: v4l2_videodevice: Correctly populate V4L2BufferCache cache"
- (v1->v2) Revamp commit message entirely.
---
 src/libcamera/v4l2_videodevice.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
index 3d2d99b4..da2af6a1 100644
--- a/src/libcamera/v4l2_videodevice.cpp
+++ b/src/libcamera/v4l2_videodevice.cpp
@@ -183,7 +183,7 @@  V4L2BufferCache::V4L2BufferCache(const std::vector<std::unique_ptr<FrameBuffer>>
 	for (const std::unique_ptr<FrameBuffer> &buffer : buffers)
 		cache_.emplace_back(true,
 				    lastUsedCounter_.fetch_add(1, std::memory_order_acq_rel),
-				    buffer->planes());
+				    *buffer.get());
 }
 
 V4L2BufferCache::~V4L2BufferCache()