summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-04-30libcamera: Use the Size class through libcameraLaurent Pinchart
Several of our structures include width and height fields that model a size while we have a Size class for that purpose. Use the Size class through libcamera, and give it a toString() method like other geometry and format classes. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-04-30libcamera: pipeline_handler: Remove duplicated log from uvc and vimcLaurent Pinchart
The uvcvideo and vimc pipeline handlers print the requested resolution in their configureStreams() operation. This duplicates a generic log statement in the Camera::configureStreams() method, remove it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-04-29libcamera: device_enumerator_udev: Include missing headerLaurent Pinchart
The makedev() macro is defined in sys/sysmacros.h, include the header explicitly. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-04-29libcamera: Don't ignore the return value of read() and write()Laurent Pinchart
The glibc read() and write() functions are defined with the __warn_unused_result__ attribute when using FORTIFY_SOURCE. Don't ignore their return value. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-04-28Documentation: Drop install directive for DoxyfileNiklas Söderlund
Building the documentation reports warnings, WARNING: Project targetting '>= 0.40' but tried to use feature introduced in '0.50.0': install arg in configure_file WARNING: Project specifies a minimum meson_version '>= 0.40' but uses features which were added in newer versions: * 0.50.0: {'install arg in configure_file'} Due to the usage of the directive configure_file { install: false } in Documentation/meason.build which is introduced in meson 0.50. As we do not wish to install the Doxyfile no install_dir is set so there is no need to explicitly state that it should not be installed. Silence the warning by dropping the install directive. Fixes: 53c4d4c34fc49b95 ("Documentation: Generate source code documentation using Doxygen") Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-04-28libcamera: camera: Log proposed configuration in streamConfiguration()Laurent Pinchart
The IPU3 and RKISP1 pipeline handlers log the camera configuration they propose in their streamConfiguration() methods. Other pipeline handlers are expected to log similar information, move it to the Camera class. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-04-28libcamera: camera: Check requests before queueing themNiklas Söderlund
Make sure all requests queued to a camera only contain streams which have been configured and belong to the camera. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-04-27test: signal: Exercise the signal delivery code paths for ObjectLaurent Pinchart
Member slots for objects deriving from the Object class receive special handling. Add one test to make sure we exercise the related code paths. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-04-27libcamera: Make libudev optionalLaurent Pinchart
libcamera depends on libudev for device enumeration. It is however useful to allow building documentation without requiring the dependency to be installed. Make the libudev dependency optional and compile the udev-based device enumerator out when libudev is not present. Note that while libcamera will compile without libudev, it will not be able to enumerate devices. A sysfs-based device enumerator is planned as a fallback but not implemented yet. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-04-27libcamera: v4l2_device: Prefix V4L2 direction in log messagesKieran Bingham
The V4L2Device will use the same deviceNode for two directions in the case of an M2M device. Add the direction to identify the queue direction on each instance. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-04-26libcamera: Remove outdated \todo commentsLaurent Pinchart
Some \todo comments are outdated and refer to tasks that have been completed. Remove them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-04-26cam: options: Fix string concatenationLaurent Pinchart
Adding an integer value to a char pointer doesn't concatenate strings, it indexes in the pointed string. Fix it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-04-26cam: options: Don't initialise variable-length arraysLaurent Pinchart
According to clang, variable-length arrays can't be initialised. Don't do so, and explicitly set the last element to 0 instead. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-04-26test: v4l2_subdevice: Remove std::move() that prevents copy elisionLaurent Pinchart
Moving a temporary value prevents copy elision. Remove it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-04-26libcamera: v4l2_device: Buffer is not a structLaurent Pinchart
Buffer is a class, not a struct. Fix a variable declaration accordingly. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-04-26libcamera: Mark overridden functions with overrideLaurent Pinchart
Several overridden virtual functions are not marked with override. Fix it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-04-26libcamera: log: Add a LogInvalid entry to LogSeverityLaurent Pinchart
enum LogSeverity values are assigned or compared to -1 to flag invalid log severities. This generates compilation warnings with clang. Fix it by adding an explicit LogInvalid entry to the enumeration. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-04-26libcamera: event_dispatcher_poll: Fix bitwise testLaurent Pinchart
Add missing parentheses to fix a bitwise test. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-04-26libcamera: Correct struct forward declarationsLaurent Pinchart
Several structures are forward-declarated as classes. Fix this by using the struct keyword where appropriate, or removing the forward declaration when not needed. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-04-26libcamera: utils: call secure_getenv() if it exists or workaround with ↵Giulio Benetti
issetugid() When secure_getenv() is not available, need to have a workaround. Check if secure_getenv() is present, otherwise call issetugid() on its place. Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> [Kieran: include stdlib.h] Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-04-26meson: check if secure_getenv() is presentGiulio Benetti
Not all libc make secure_getenv() available, this could lead to build failure on certain build systems. Check if secure_getenv() is available and emit #define HAVE_SECURE_GETENV to config.h Include config.h to every c/c++ file during building by adding `-include config.h` to project arguments for both c and c++. Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> [Kieran: Drop unnessecary meson message Update commit message] Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-04-19libcamera: ipu3: Connect viewfinder's BufferReady signalJacopo Mondi
The viewfinder and main output require identical logic for buffer and request completion. Connect the viewfinder bufferReady signal to the slot and handle requests for both main output and viewfinder there. Update the slot logic to complete the request only when the last buffer has completed, and make sure to complete requests in the same order they have been queued to the pipeline handler. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-04-19libcamera: ipu3: Queue requests for multiple streamsJacopo Mondi
Add support for queueing requests for multiple streams in the IPU3 pipeline handler class. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-04-19libcamera: ipu3: Add multiple stream memory managementJacopo Mondi
Perform allocation and setup of memory sharing between the CIO2 output and the ImgU input and allocate memory for each active stream. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-04-19libcamera: ipu3: Use roles in stream configurationJacopo Mondi
Use and inspect the stream roles provided by the application to streamConfiguration() to assign streams to their intended roles and return a default configuration associated with them. Support a limited number of usages, with the viewfinder stream able to capture both continuous video streams and still images, and the main output stream supporting still images only. This is an artificial limitation until we figure out the exact capabilities of the hardware. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-04-19libcamera: ipu3: Create camera with 2 streamsJacopo Mondi
Sub-class the Stream class with an IPU3-specific implementation and create each IPU3 camera with two streams: 'output' and 'viewfinder' which represent the video streams from main and secondary ImgU output respectively. Rework stream configuration to handle the two video streams 'output' and 'viewfinder' separately. As the IPU3 driver requires viewfinder and stat video nodes to be started not to stall ImgU processing, configure 'output', 'viewfinder' and 'stat' regardless of the user-requested active streams. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-04-19libcamera: camera: Reset basefield to decimalJacopo Mondi
When logging the camera configuration, the same ostringstream instance is used to assemble a message describing configuration of all the configured streams. After the first stream configuration has been assembled, the use of std::hex modifies the ostringstream basefield, causing all successive integers values inserted in the stream to be expressed as hexadecimals. Fix that by resetting the stream's basefield to decimal, before assembling a stream configuration description. Before this patch: INFO Camera camera.cpp:615 (0) 640x480-0x3231564e (1) 140xa0-0x3231564e After this patch: INFO Camera camera.cpp:616 (0) 640x480-0x3231564e (1) 320x160-0x3231564e Fixes: 9c9078133216 ("libcamera: camera: Log requested configuration in configureStreams()") Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-04-19libcamera: stream: Document protected membersJacopo Mondi
Since commit: 4e1dc9004fca ("libcamera: stream: Make Stream inheritable") the private members of the Stream class have been turned into protected, to allows subclasses to access them. As Doxygen generates documentation for protected members (but not for private memebers), add documentation to the stream class for the 'bufferMap_' and 'configuration_' members. Fixes: 4e1dc9004fca ("libcamera: stream: Make Stream inheritable") Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-04-19libcamera: Include header related to source file firstLaurent Pinchart
Include the header file corresponding to the source file in the very first position. This complies with the Google C++ coding style guideliens, and helps ensuring that the headers are self-contained. Three bugs are already caught by this change (missing includes or forward declarations) in device_enumerator.h, event_dispatcher_poll.h and pipeline_handler.h. Fix them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-04-19libcamera: stream: Add and use toString() method to StreamConfigurationLaurent Pinchart
Add a toString() method to the StreamConfiguration class, and replace all manually coded implementations through the source code. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-04-19libcamera: pipeline: rkisp1: Don't hardcode NV12 in configureStreams()Laurent Pinchart
Use the pixel format requested by the application in the RkISP1PipelineHandler::configureStreams() method instead of hardcoding NV12. The streamsConfiguration() method still proposes NV12 by default. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-04-19libcamera: Document documentation style and update the code accordinglyLaurent Pinchart
The documentation style for the Doxygen comment blocks is inconsistent in the library. Document the expectations and update all existing comment blocks to match. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Jacopo Mondi <jacopo@jmondi.org>
2019-04-18libcamera: pipeline: Add RKISP1 pipelineLaurent Pinchart
The pipeline handler for the Rockchip ISP creates one camera instance per detected raw Bayer CSI-2 sensor. Parallel sensors and YUV sensors are not supported yet. As the ISP has a single CSI-2 receiver, only one camera can be used at a time. Mutual exclusion isn't implemented yet. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-04-18libcamera: pipeline: ipu3: Use the new CameraSensor classLaurent Pinchart
Replace the manual handling of sensor formats with usage of the new CameraSensor class. 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-04-18libcamera: camera_sensor: Add a new class to model a camera sensorLaurent Pinchart
The CameraSensor class abstracts camera sensors and provides helper functions to ease interactions with them. It is currently limited to sensors that expose a single subdev, and offer the same frame sizes for all media bus codes, but will be extended to support more complex sensors as the needs arise. 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-04-18libcamera: v4l2_subdevice: Add method to retrieve the media entityLaurent Pinchart
Add a method to retrieve the media entity associated with a subdevice. The entityName() and deviceNode() methods are not needed anymore as they can be accessed through the media entity, remove them. 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-04-18libcamera: v4l2_subdevice: Close subdevice when destroyedLaurent Pinchart
Make sure the subdevice file descriptor isn't leaked by closing it when the V4L2Subdevice instance is destroyed. 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-04-18libcamera: utils: Add set_overlap() functionLaurent Pinchart
The new set_overlap() function counts the number of overlapping elements in the intersection of two sorted ranges defined by their beginning and ending iterators. 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-04-18test: geometry: Add tests for Size class comparison operatorsLaurent Pinchart
Add a test that exercises all the comparison operators for the Size class. 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-04-18libcamera: geometry: Add comparison operators to geometry classesLaurent Pinchart
Add equality and inequality comparison operators for the Rectangle, Size and SizeRange classes. For the Size class, also add ordering operators. Sizes are first compared on combined width and height, then on area, and finally on width only to achieve a stable ordering. 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-04-18libcamera: geometry: Use Size to store min and max in SizeRangeLaurent Pinchart
Instead of storing four integers for the minimum and maximum width and height in the SizeRange class, use two instance of the Size class for the minimum and maximum sizes. While it at replace the mention of image size with size in the SizeRange documentation, as the Size class isn't limited to image sizes. 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-04-18libcamera: geometry: Sort classes alphabeticallyLaurent Pinchart
Move the Size class before the SizeRange class. No functional change. 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-04-18libcamera: camera: Log requested configuration in configureStreams()Laurent Pinchart
The IPU3 pipeline handler logs the requested configuration in its configureStreams() handler. This is useful for other pipeline handlers as well, move it to the Camera class. 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-04-18libcamera: log: Mark Loggable::_log() methods as constLaurent Pinchart
The methods don't modify the object instance, mark them as const. This allows using the LOG() macro from a const method of a Loggable object. 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-04-18Install the cam and qcam utilitiesLaurent Pinchart
The cam and qcam utilities are meant to be shipped with libcamera, install them by default. 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-04-18libcamera: buffer: Store Request reference in BufferJacopo Mondi
Add to the Buffer class methods to set and retrieve a reference to the Request instance the buffer is part of. As buffers outlive the Request they are associated with, the reference is only temporary valid during the buffer completion interval (from when the buffer gets queued to Camera for processing, until it gets marked as completed). 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-04-18libcamera: request: Expose the Stream to Buffers mapJacopo Mondi
Add to the Request class a method to access the map of Stream to Buffer. With the introduction of multiple stream support, pipeline handler should be able to access the map of streams at request queueing time. 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-04-18libcamera: camera: Validate Request before queueing itJacopo Mondi
Extend the Request::prepare() operation to validate the request before preparing it. Return an error if the request is invalid, which for now is limited to ensuring that the request contains at least one buffer. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-04-18libcamera: request: Add hasPendingBuffers() methodJacopo Mondi
Add method to verify if a request has pending buffers yet to be completed. 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-04-18libcamera: v4l2_device: Propagate releaseBuffers() errorJacopo Mondi
The error code returned by requestBuffers(0) was not propagated to the caller. Fix it. 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>