summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-04-03libcamera: geometry: Add 0-initialized SizeRange constructorJacopo Mondi
Add constructor to SizeRange which initialize all the size range fields to 0. While at there make the in-line constructor declarations respect the coding style by moving braces to a new line. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-04-03libcamera: utils: Use internal secure_getenv() implementationKieran Bingham
The secure_getenv() call is not provided by all C libraries. Support this feature by implementing our own version. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-04-03libcamera: utils: Use internal basename implementation.Kieran Bingham
Differing implementations of basename() exist, some of which may modify the content of the string passed as an argument. The implementation of basename() is trivial, thus to support different C librariese, provide our own version which accepts and returns a const char *. Update the call sites to use the new implementation. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-04-03meson: options: Document the optionsKieran Bingham
Re-order the project options and add documentation which will be presented by 'meson configure'. This produces the following extra information: Project options: Option Current Value Possible Values Description ------ ------------- --------------- ----------- documentation true [true, false] Generate the project documentation tests true [true, false] Compile and include the tests Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-04-03meson: Re-order the optional componentsKieran Bingham
Re-order the optional components to make them alphabetical, and fix up the indentation to use two spaces as required by meson. A comment is added to highlight that these optional components are enabled by default. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-04-02qcam: Add JPEG format supportLaurent Pinchart
When the camera provides MJPEG, use the QImage JPEG decompression code to convert that to RGB. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-04-02libcamera: stream: Qualify 'Camera' friend directiveJacopo Mondi
Align the Stream class to all other classes in the code base to use the 'class' qualifier in 'friend' declarations. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-04-02libcamera: stream: Remove 2 empty linesJacopo Mondi
Remove two empty lines. Cosmetic change only. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-04-02libcamera: v4l2_subdevice: Create device from entity nameJacopo Mondi
Add a static method to V4L2Subdevice class to create a V4L2Subdevice instance from a media entity name. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-04-02libcamera: v4l2_device: Create device from entity nameJacopo Mondi
Add a static method to V4L2Device class to create a V4L2Device instance from a media entity name. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-04-02libcamera: v4l2_subdevice: Rename deviceName() methodJacopo Mondi
Rename the 'deviceName()' method to 'entityName()' as it actually returns the name of the entity backing the v4l2 subdevice. While at it, make the names getter methods return a const reference instead of returning by copy. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-04-02libcamera: geometry: Add toString to RectangleJacopo Mondi
Add toString() helpers to pretty print out the sizes of a Rectangle. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-04-02libcamera: formats: Define FormatEnum typeJacopo Mondi
Add an internal format.h and format.cpp files to collect libcamera image format related types, helpers and structures. Define and document the FormatEnum type, used to enumerate pixel image formats and associated image resolutions. 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-04-02libcamera: formats: Add toString() methodsJacopo Mondi
Add toString() helpers to pretty print out a V4L2Device or V4L2Subdevice 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-03-29qcam: Add Qt-based GUI applicationLaurent Pinchart
qcam is a sample camera GUI application based on Qt. It demonstrates integration of the Qt event loop with libcamera. The application lets the user select a camera through the GUI, and then captures a single stream from the camera and displays it in a window. Only streams in YUYV formats are supported for now. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-03-29utils: rkisp1: Add test capture scriptLaurent Pinchart
The script captures raw or processed frames from cameras based on the Rockchip ISP1. It takes the sensor name as an argument and isn't meant to depend on a particular platform. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-03-27cam: Separate options valid() and empty()Laurent Pinchart
An empty option list is not necessarily an error. Add a new empty() function to test the option list for emptiness, and modify the valid() function to only notify parsing errors. As a side effect this allows accessing partially parsed options, which may be useful in the future. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-03-27cam: options: Add support for repeatable optionsNiklas Söderlund
Add a flag to indicate if an option can be repeatable. If an option is repeatable it must be accessed thru the array interface, even if it's only specified once by the user. Also update the usage generator to indicate which options are repeatable. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-03-27cam: options: Add an array data type to OptionValueNiklas Söderlund
To allow specifying the same argument option multiple times a new type of OptionValue is needed. As parsing of options is an iterative process there is a need to append options as they are parsed so instead of setting values using the constructor a new addValue() method is used. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-03-25cam: options: Create separate enum for OptionValue typesNiklas Söderlund
In preparation for support of multiple instances of the same option, create a separate enum for the OptionValue types as it will diverge from enum OptionType. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-03-20meson: Provide options to disable test/docsKieran Bingham
It can be desirable to disable the compilation and processing of both the test suite and documentation for use cases such as packaging to an embedded target. Provide a new meson_options.txt file to allow disabling either or both of the tests and documentation components of libcamera. These options can be provided at the initial configuration time, for example: meson build -Dtests=false -Ddocumentation=false or by reconfiguring an existing build tree: cd build meson configure -Ddocumentation=false meson configure -Dtests=false Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-03-20libcamera: v4l2_device: Fix trivial spelling errorsKieran Bingham
succcess -> success categorized -> categorised Acked-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-03-20libcamera: media_device: Initialise local variableKieran Bingham
The local variable ifaceId generates a compiler warning that it is used without initialisation. The loop, and check against the loop iterator, and the topology.num_interfaces actually ensures that this isn't the case, and that ifaceId can only be used when set to a valid ID. The media_v2_interface.id field documents the ID as simply "Unique ID for the interface" but does not specify if zero is a valid ID or not. As such we don't further check the pre-initialised ID for validity and keep the existing check on the iterator count to determine if the ID had been discovered successfully. Fixes: d4af90d72901 ("libcamera: media_device: Create entities with major and minor numbers") Acked-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-03-14test: camera: Add state machine testNiklas Söderlund
Add a test of the different access level enforced by the state machine inside the camera. The state machine aims to limit operations on the camera to the cameras state. The test exercises all states of the camera and verifies that only the intended operations are possible at each stage. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-03-14test: camera: Add capture testNiklas Söderlund
Correctly configure the camera using the default configuration and run a capture session for 100 milliseconds, which is plenty of time, in tests over 600 requests completed using the vimc pipeline. The test passes if at least the number of buffers used in the capture times two number of requests completes to prove we cycle through all buffers. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-03-14test: camera: Add setting of configuration testNiklas Söderlund
Try to set the default configuration, a modified valid configuration and an invalid configuration. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-03-14test: camera: Add read default configuration testNiklas Söderlund
Add a test to verify reading the default configuration from a camera works. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-03-10libcamera: camera: Fix access bug in configureStreams()Niklas Söderlund
It is not permitted to configure streams before a camera is acquired. Fixes: 77100a7578d8a0cc ("libcamera: camera: add state machine to control access from applications") Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-03-05libcamera: camera: ensure streams belong to cameraNiklas Söderlund
Before calling into the pipeline handler make sure the streams provided by the application actually belongs to the camera. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-03-05libcamera: camera: Unmap buffers before releaseKieran Bingham
Buffers must have all mappings destroyed before buffers can be freed by the V4L2 device that has allocated them. Swap the ordering of freeBuffers() and destroyBuffers() to correct this. Fixes: bd38112b7795 ("libcamera: camera: Extend the interface to support capture") Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-03-05libcamera: v4l2_device: Close Plane dmabuf fdKieran Bingham
When constructing a Plane, the exported buffer provides a dmabuf handle which is set to the Plane object. This action duplicates the handle for internal storage, and the original fd is not used and needs to be closed. Close the handle, ensuring that the resources can be correctly managed. Fixes: 771befc6dc0e ("libcamera: v4l2_device: Request buffers from the device") Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-03-02libcamera: v4l2_device: Cosmetic updateJacopo Mondi
Cosmetic update of V4L2Device class: remove the return type from Doxygen documentation of inline functions. Cosmetic update, no functional changes intended. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-03-02libcamera: v4l2_device: Add support for META_CAPTURE devicesJacopo Mondi
Add support for devices that provide video meta-data to v4l2_device.cpp and re-arrange bufferType handling in open() method. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-03-02libcamera: v4l2_subdevice: Cosmetic updateJacopo Mondi
Cosmetic updated of V4L2Subdevice class: re-sort methods and comments to reflect the declaration order in the class definition. Cosmetic update, no functional changes intended. Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-03-02test: v4l2_subdevice: Add ListFormat testJacopo Mondi
Add test to list formats on a v4l2 subdevice. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-03-02libcamera: v4l2_subdevice: Implement ENUM_FRAME_SIZESJacopo Mondi
Implement format and size enumeration methods to list all the available subdevice image resolutions and formats. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-03-01cam: Don't requeue requests when stopping streamLaurent Pinchart
When stopping the stream all pending requests are cancelled, resulting in the request completion signal being emitted with the request status set appropriately. Check the request status in the request completion slot and skip requeuing the request if it has been cancelled. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-03-01libcamera: Handle request completion explicitly in pipeline handlersLaurent Pinchart
Request complete by themselves when all the buffers they contain have completed, connecting the buffer's completed signal to be notified of buffer completion. While this works for now, it prevents pipelines from delaying request completion until all metadata is available, and makes it impossible to ensure that requests complete in the order they are queued. To fix this, make request completion handling explicit in pipeline handlers. The base PipelineHandler class is extended with implementations of the queueRequest() and stop() methods and gets new completeBuffer() and completeRequest() methods to help pipeline handlers tracking requests and buffers. The three existing pipeline handlers connect the bufferReady signal of their capture video node to a slot of their respective camera data instance, where they use the PipelineHandler helpers to notify buffer and request completion. Request completion is handled synchronously with buffer completion as the pipeline handlers don't need to support more advanced use cases, but this paves the road for future work. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-03-01libcamera: request: Add request completion statusLaurent Pinchart
Add a new field to the Request class to report its completion status, and a new complete() method to update the status. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-03-01libcamera: buffer: Add buffer completion statusLaurent Pinchart
Add a new field to the Buffer class to report its completion status, with a new cancel() method to mark the buffer as cancelled. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-03-01libcamera: pipeline_handler: Make pipeline-specific data mandatoryLaurent Pinchart
Mandate creationg of pipeline-specific data by pipeline handlers. This allows simplifying the API by passing the pipeline-specific data to the registerCamera() method and removing the separate setCameraData() method. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-03-01libcamera: pipeline_handler: Store pipe and camera in CameraDataLaurent Pinchart
Extend the CameraData class with two member variables pipe_ and camera_ that store pointers to the pipeline handler and camera that the CameraData instance is related to. This will be used by pipeline handlers to access the camera and the pipeline in member methods of their CameraData derived classes. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-03-01libcamera: pipeline_handler: Pass a non-const Camera to methodsLaurent Pinchart
The start(), stop() and queueRequest() methods receive a const pointer to the related Camera object. The stop() request will need to modify the state of the camera, in order to report completion of pending requests. Un-constify the Camera pointer to that method, and update the start() and queueRequest() methods similarly for coherency. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-03-01libcamera: pipeline: vimc: Create VimcCameraDataLaurent Pinchart
Subclassing CameraData will become mandatory for pipeline handlers. Create a new VimcCameraData class and instantiate it when creating cameras to prepare for that change. The video_ and stream_ fields of the VIMC pipeline handler belong to the camera data, move them there. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-03-01libcamera: pipeline: uvcvideo: Create UVCCameraDataLaurent Pinchart
Subclassing CameraData will become mandatory for pipeline handlers. Create a new UVCCameraData class and instantiate it when creating cameras to prepare for that change. The video_ and stream_ fields of the UVC pipeline handler belong to the camera data, move them there. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-03-01libcamera: pipeline: Fix double release of media devicesLaurent Pinchart
Media devices are acquired in the match() function of pipeline handlers, and explicitly released if no match is found. The pipeline handler is then deleted, which causes a second release of the media device in the destructor. Fix this by removing the explicit release in the match() function. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Acked-by: Jacopo Mondi <jacopo@jmondi.org>
2019-03-01libcamera: v4l2_device: Expose the device node pathJacopo Mondi
Provide a getter method to access the device node path. For video devices it is usually the most informative description. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-03-01test: v4l2_device: Add format handling testJacopo Mondi
Add test for V4L2Device set and get format methods. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-03-01test: v4l2_subdevice: Add format handling testJacopo Mondi
Add test for video format get and set operations on V4L2Subdevice class. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-03-01libcamera: v4l2_subdevice: Update crop/compose rectangleJacopo Mondi
Update the crop/compose rectangle provided to setCrop()/setCompose() methods with the rectangle sizes set by the device driver after a S_SELECTION ioctl operation. While at there, fix the use of 'top' and 'left' field of the selection rectangle, which where wrongly used. Fixes: 468176fa07d9 ("libcamera: Add V4L2Subdevice") Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>