diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libcamera/include/v4l2_videodevice.h | 2 | ||||
-rw-r--r-- | src/libcamera/v4l2_videodevice.cpp | 15 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/libcamera/include/v4l2_videodevice.h b/src/libcamera/include/v4l2_videodevice.h index 0ff0c4c4..298a1a1c 100644 --- a/src/libcamera/include/v4l2_videodevice.h +++ b/src/libcamera/include/v4l2_videodevice.h @@ -226,7 +226,7 @@ private: int setSelection(unsigned int target, Rectangle *rect); - int requestBuffers(unsigned int count); + int requestBuffers(unsigned int count, enum v4l2_memory memoryType); std::unique_ptr<FrameBuffer> createBuffer(const struct v4l2_buffer &buf); FileDescriptor exportDmabufFd(unsigned int index, unsigned int plane); diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index a8c6d6be..100a92b5 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -997,14 +997,15 @@ int V4L2VideoDevice::setSelection(unsigned int target, Rectangle *rect) return 0; } -int V4L2VideoDevice::requestBuffers(unsigned int count) +int V4L2VideoDevice::requestBuffers(unsigned int count, + enum v4l2_memory memoryType) { struct v4l2_requestbuffers rb = {}; int ret; rb.count = count; rb.type = bufferType_; - rb.memory = memoryType_; + rb.memory = memoryType; ret = ioctl(VIDIOC_REQBUFS, &rb); if (ret < 0) { @@ -1017,7 +1018,7 @@ int V4L2VideoDevice::requestBuffers(unsigned int count) if (rb.count < count) { LOG(V4L2, Error) << "Not enough buffers provided by V4L2VideoDevice"; - requestBuffers(0); + requestBuffers(0, memoryType); return -ENOMEM; } @@ -1043,7 +1044,7 @@ int V4L2VideoDevice::allocateBuffers(unsigned int count, memoryType_ = V4L2_MEMORY_MMAP; - int ret = requestBuffers(count); + int ret = requestBuffers(count, V4L2_MEMORY_MMAP); if (ret < 0) return ret; @@ -1080,7 +1081,7 @@ int V4L2VideoDevice::allocateBuffers(unsigned int count, return count; err_buf: - requestBuffers(0); + requestBuffers(0, V4L2_MEMORY_MMAP); buffers->clear(); @@ -1150,7 +1151,7 @@ int V4L2VideoDevice::importBuffers(unsigned int count) memoryType_ = V4L2_MEMORY_DMABUF; - int ret = requestBuffers(count); + int ret = requestBuffers(count, V4L2_MEMORY_DMABUF); if (ret) return ret; @@ -1171,7 +1172,7 @@ int V4L2VideoDevice::releaseBuffers() delete cache_; cache_ = nullptr; - return requestBuffers(0); + return requestBuffers(0, memoryType_); } /** |