summaryrefslogtreecommitdiff
path: root/src/libcamera/v4l2_device.cpp
AgeCommit message (Collapse)Author
2019-02-06libcamera: v4l2_device: Implement queue/dequeue operationsKieran Bingham
Provide queueBuffer() and dequeueBuffer() methods to interact with the V4L2Device. Buffers will be directly referenced from the bufferPool of the V4L2Device based on the index in the pool. The V4L2Device is now opened in non-blocking mode in order to avoid blocking the dequeueBuffer() method. A signal is emitted when a buffer is ready and has been dequeued. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-02-06libcamera: v4l2_device: Request buffers from the deviceKieran Bingham
Provide an exportBuffers() function which allocates buffers with the MMAP method, exports them using the dmabuf API and populates the given BufferPool. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-02-05libcamera: v4l2_device: Improve documentationJacopo Mondi
Improve the V4L2DeviceFormat documentation as suggested during patches review. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-02-05libcamera: v4l2_device: s_format: Return the device formatJacopo Mondi
Return the device format actually applied to the device on setFormat(). Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-02-05libcamera: v4l2_device: Construct from MediaEntity*Jacopo Mondi
The V4L2Device constructor wants a "const MediaEntity &", while entities are usually retrieved by pointer before being used to construct a V4L2Device. Change the constructor argument to "const MediaEntity *". Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-02-03libcamera: v4l2_device: Set bytesperline in single plane S_FMTJacopo Mondi
The 'bytesperline' field of 'struct v4l2_pix_format' has to be set for the single planar set format use case. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-02-03libcamera: v4l2_device: Zero-initialize V4L2 formatJacopo Mondi
Zero initialize v4l2_format structures used to set and get format on the V4L2 device. Fixes: ba8da0f2fcd0 ("libcamera: v4l2_device: Add methods to get/set format") Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-02-03libcamera: v4l2_device: Rename plane format fieldsJacopo Mondi
Rename the number of valid plane formats to 'planesCount' and the actual per-plane size information array to 'planes'. Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-02-03libcamera: v4l2_device: Rename parameters to s/g_fmtJacopo Mondi
Rename parameters to get and set format functions to expand 'fmt' to 'format'. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-02-03libcamera: v4l2_device: Fix getFormatSingleplane ioctlJacopo Mondi
The single plane getFormat() function wrongly used the VIDIOC_S_FMT ioctl. Fix that by using the more opportune VIDIOC_G_FMT one. Fixes: ba8da0f2fcd0 ("libcamera: v4l2_device: Add methods to get/set format") Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-02-03libcamera: v4l2_device: Rename format() method to getFormat()Jacopo Mondi
Rename format() to getFormat() to reflect the v4l2 API names more closely. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-29libcamera: v4l2_device: Add methods to get/set formatJacopo Mondi
Add methods to set and get the image format programmed on a V4L2Device for both the single and multi planar use case. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-29libcamera: v4l2-format: Add V4L2DeviceFormatJacopo Mondi
Add a V4L2DeviceFormat class aimed to be used to provide format configuration requests to a V4L2Device. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-26libcamera: v4l2_device: Fix wording in documentationLaurent Pinchart
Fix one wording issue in documentation. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-25libcamera: v4l2_device: Identify multiplanar formatsJacopo Mondi
Add functions to V4L2Capability to identify if a V4L2 device supports multiplanar V4L2 APIs. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-23libcamera: v4l2device: Obtain device capabilitiesKieran Bingham
The capabilities structure from the kernel can return capabilities of the driver, or potentially more specific device capabilities. Handle this with an inline function 'device_caps()' to return the device specific capabilities when available, or fall back to the driver capabilities otherwise. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-22libcamera: Global s/devnode/deviceNode renameJacopo Mondi
Do not use the abreviated version for members, variables and getter methods. Library-wise rename, no intended functional changes. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-22libcamera: v4l2_device: Add MediaEntity contructorJacopo Mondi
Construct a V4L2Device from a MediaEntity device node path. While at there mark constructor as explicit to avoid copy-construction. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-21libcamera: Use log categoriesLaurent Pinchart
Use log categories in the whole existing code base. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-17libcamera: Add V4L2 Device objectKieran Bingham
Provide a helper V4L2 device object capable of interacting with the V4L2 Linux Kernel APIs. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>