summaryrefslogtreecommitdiff
path: root/v4l2.c
AgeCommit message (Collapse)Author
2018-05-24v4l2: Query buffer sizes when exporting buffersLaurent Pinchart
In order to properly import buffers, the size of each buffer to be imported must be known. The size is queried when the buffers are mmap()ed, but mapping them isn't mandatory. Query the size when exporting buffers to ensure that we always have a valid size for import. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-05-24v4l2: Fix typo in error messageLaurent Pinchart
Add the missing closing parenthesis. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-05-23v4l2: Document expected fallthroughKieran Bingham
Compilers may now enable warnings for implicit fallthrough of switch case statements, to help catch errors. One such case is highlighted in our v4l2 module: v4l2.c: In function ‘v4l2_enum_frame_sizes’: v4l2.c:179:23: warning: this statement may fall through [-Wimplicit-fallthrough=] frame->step_height = frmenum.stepwise.step_height; ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ v4l2.c:180:3: note: here case V4L2_FRMSIZE_TYPE_CONTINUOUS: ^~~~ This fall through is expected, and the warning can be removed simply by adding a comment to confirm that. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-05-22v4l2: Replace USERPTR support with DMABUF supportLaurent Pinchart
V4L2_MEMORY_USERPTR is deprecated, replace it with V4L2_MEMORY_DMABUF support for buffer sharing. Two new functions are added, v4l2_export_buffers() to export previously allocated buffers as dmabuf objects, and v4l2_import_buffers() to import dmabuf objects as backing store for V4L2 buffers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-05-22v4l2: Split buffer allocation and mappingLaurent Pinchart
Not all use cases of V4L2_MEMORY_MMAP require mapping buffers to userspace. Separate the allocation and mapping to allow usage of unmapped buffers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-05-22v4l2: Fail v4l2_alloc_buffers() when buffers are already allocatedLaurent Pinchart
Allocating buffers allocates resources that must be explicitly freed. Calling v4l2_alloc_buffers() a second time without freeing the buffers in between causes memory leaks and must not be allowed. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-05-22v4l2: Free v4l2_device object when closing itLaurent Pinchart
The v4l2_device object is allocated dynamically by v4l2_open(), free it in v4l2_close() to make the API symmetrical. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-05-22v4l2: Import V4L2 support code from omap3-isp-liveLaurent Pinchart
The omap3-isp-live project [1] includes generic V4L2 support code that implements the V4L2 API. Instead of reinventing the wheel, import the code and use it. The code has been modified to merge the V4L2 buffers pool implementation in the V4L2 support code as the abstraction wasn't right for the uvc-gadget project. Further refactoring will be performed separately. The original license hasn't been modified from the original LGPL-2.1+. The sole copyright owner is Laurent Pinchart. [1] git://git.ideasonboard.org/omap3-isp-live.git Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>