summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-01-15libcamera: Add debug printoutsJacopo Mondi
Add a few debug printouts that help follow the library intialization process: what pipeline handlers are registered, what media devices are created, and which pipeline manager gets matches with the current system. The resulting output is the following, on IPU3 devices: DBG pipeline_handler.cpp:119 Pipeline handler: "PipeHandlerVimc" registered DBG pipeline_handler.cpp:119 Pipeline handler: "PipelineHandlerIPU3" registered DBG device_enumerator.cpp:214 New media device: ipu3-imgu created from: /dev/media0 DBG device_enumerator.cpp:214 New media device: ipu3-cio2 created from: /dev/media1 DBG device_enumerator.cpp:255 Succesfull match for media device: ipu3-cio2 DBG device_enumerator.cpp:255 Succesfull match for media device: ipu3-imgu DBG pipeline_handler.cpp:150 Pipeline handler: "PipelineHandlerIPU3" matched Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-14libcamera: log: Fix unknown log level representationKieran Bingham
Commit 99a3e7bcfb38 ("libcamera: log: Add a LogFatal log level") expanded the text representation of the log levels to support the FATAL string, but left the default unknown match at four characters. This code should never expect to be executed, but for completeness match the string lengths by adding an extra character to the result. Fixes: 99a3e7bcfb38 ("libcamera: log: Add a LogFatal log level") Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-14test: media_device: Add link handling testJacopo Mondi
Add a test unit that exercise link handling on the VIMC media graph. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-14test: media_device: Make MediaDeviceTest a MediaDevicePrintTestJacopo Mondi
As a new class for test link handling will be added as a separate test, it makes no sense to have a generic "MediaDeviceTest" class. Rename it in "MediaDevicePrintTest", and make it run only printing test. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-14test: media_device: Convert to foreachKieran Bingham
Prevent duplication of boilerplate code as the suite grows by establishing the foreach pattern in the media_device test suite. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-14Documentation: quieten sphinx-build outputKieran Bingham
The output of the sphinx-build for our documentation is overly verbose. Reduce this output to warnings and errors with the '-q' quiet option. Acked-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-11Documentation: Add placeholder for Doxygen-generated API documentationLaurent Pinchart
Until we have better Sphinx + Doxygen integration, replace the relative external link to the API documentation with a placeholder directory, which will be populated with the Doxygen-generated doc when exporting documentation to the website. This is needed as the Sphinx documentation is exported to the root of the website, linking to ../api-html is thus not possible. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-11Documentation: Update copyright yearsLaurent Pinchart
Happy new year :-) Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-11Documentation: Link to the API documentation generated by DoxygenLaurent Pinchart
Add a link in the toctree to the API documentation. sphinx doesn't seem to support relative external links, but we can trick it into thinking the link is absolute by adding '#://' at the end. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-11Documentation: Make the toctree more web-friendlyLaurent Pinchart
The toctree is displayed in the navigation bar at the top of the page. Add short names to the entries that replicate the names currently used on libcamera.org. Remove the link to the index and search pages, as the former is empty, and the latter can be accessed directory from the navigation bar search box. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-11Documentation: Add custom themeLaurent Pinchart
The theme replicates the look and feel of the libcamera.org website. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-10libcamera: device_enumerator: Fix memory leak in error pathLaurent Pinchart
The DeviceEnumerator::create() function allocates a DeviceEnumeratorUdev and fails to delete it in the error path, causing a memory leak. Fix it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-10libcamera: Document missing parameters and return valuesLaurent Pinchart
Several functions are missing documentation for some of them parameters and/or for their return value. Fix this. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-10libcamera: Update libcamera.hLaurent Pinchart
libcamera.h hasn't been updated with the recently added public headers event_notifier.h, signal.h and timer.h. Add them. The event_dispatcher_poll.h header, which used to be public, is now private, but hasn't been removed from libcamera.h. Remove it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-09libcamera: Add link handling functionsJacopo Mondi
Add a function to the MediaLink class to set the state of a link to enabled or disabled. The function makes use of an internal MediaDevice method, which is defined private and only accessible by the MediaLink setEnabled() function itself. Also add to MediaDevice a function to reset all links registered in the media graph. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-08libcamera: media_device: Add functions to get a MediaLinkJacopo Mondi
Add three overloaded functions 'link()' to retrieve a link between two pads. Each overloaded implementation exposes a different method to identify the source and sink pads. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-08libcamera: Add pointer to MediaDevice to MediaObjectJacopo Mondi
Add a MediaDevice member field to the MediaObject class hierarcy. Each media object now has a reference to the media device it belongs to, and which it has been created by. 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-08test: Add event notifier testLaurent Pinchart
The test covers read notification and notifier enable/disable. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-08test: Add timer testLaurent Pinchart
The test covers timer start, timeout, restart after completion, restart before completion and multiple timers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-08test: Add signal/slot testLaurent Pinchart
The test covers signal connection, disconnection through all the provided methods, emission, parameters, and connection of a signal to multiple slots. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-08test: Rename list test to list-camerasLaurent Pinchart
The list test generates a list binary in the test directory, which conflicts with the C++ std::list header of the same name. The binary gets included instead of the header file, breaking compilation. Rename the test to avoid this. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-08libcamera: Add a poll-based event dispatcherLaurent Pinchart
Provide a poll-based event dispatcher implementation as convenience for applications that don't need a custom event loop. The poll-based dispatcher is automatically instantiated if the application doesn't provide its own dispatcher. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-08libcamera: Add event notification infrastructureLaurent Pinchart
Add three new classes, EventDispatcher, EventNotifier and Timer, that define APIs for file descriptor event notification and timers. The implementation of the EventDispatcher is meant to be provided to libcamera by the application. The event dispatcher is integrated twith the camera manager to implement automatic registration of timers and events. 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-01-08libcamera: Add signal/slot communication mechanismLaurent Pinchart
Introduce a Signal class that allows connecting event sources (signals) to event listeners (slots) without adding any boilerplate code usually associated with the observer or listener design patterns. 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-01-08libcamera: camera_manager: Make the class a singletonLaurent Pinchart
There can only be a single camera manager instance in the application. Creating it as a singleton helps avoiding mistakes. It also allows the camera manager to be used as a storage of global data, such as the future event dispatcher. 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-01-08libcamera: log: Pad timestamp fields with zerosLaurent Pinchart
The logger prints the timestamp fields with a fixed width, but pads them with spaces instead of zeros. Fix this. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-08libcamera: log: Add an ASSERT macroLaurent Pinchart
The ASSERT() macro is similar to the assert() macro defined by the C standard, but uses the libcamera logging infrastructure. 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-01-08libcamera: log: Add a LogFatal log levelLaurent Pinchart
The LogFatal log level is similar to the LogError level, but additionally abort program execution. This is useful to implement assertion handlers. 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-01-08Documentation: Suppress normal doxygen outputKieran Bingham
Enable the QUIET mode of Doxygen so that warnings and errors from Doxygen are more prominent in the build logs. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-08libcamera: media_object: Rename major/minor functionsKieran Bingham
The system libraries define macro's for major/minor through <sys/types.h> on some versions of GCC/GLibc. To prevent namespace collisions with these macros, rename our major and minor device node accessors. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-04libcamera: pipeline_handler: Improve documentationLaurent Pinchart
Miscellaneous documentation improvements for the PipelineHandler and related classes. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-04libcamera: pipeline_handler: Remove unneeded forward declarationLaurent Pinchart
There's no need to forward-declare the PipelineManagerFactory class. Remove it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-04libcamera: device_enumerator: Improve documentationLaurent Pinchart
Miscellaneous documentation improvements for the DeviceEnumerator and related classes. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-04libcamera: device_enumerator: Constify argument to search functionLaurent Pinchart
The DeviceEnumerator::search() function doesn't need to modify its DeviceMatch argument, make it const. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-04libcamera: device_enumerator: Fix wording of log messageLaurent Pinchart
The log message still refers to the DeviceInfo class that has been removed. Replace it with a reference to MediaDevice. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-04libcamera: device_enumerator: Downgrade skipped device errors to warningsLaurent Pinchart
When a device is skipped by the udev-based enumerator a message is logged. Downgrade its severity to warning as the error isn't fatal. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-04libcamera: device_enumerator: Fix indentationLaurent Pinchart
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-04libcamera: camera_manager: Sort includes alphabeticallyLaurent Pinchart
Alphabetically sorted includes help finding where to insert new include statements, and avoiding duplicates. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-04libcamera: camera_manager: Remove put() methodLaurent Pinchart
The method is declared but not implemented. Remove it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-03libcamera: Use 'struct' for structure typesJacopo Mondi
Add back the 'struct' keyword for structure types. C++ allows omitting the 'struct' keywork. Add it back to make clear we're dealing with structures and not class types. While at there re-sort fields of media_v2_* type in populate() function to reflect the declaration order in the kernel headers. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-03libcamera: media_device: Minor cleanup in findInterface()Jacopo Mondi
Do not compare an usigned int with -1 to avoid going through cast. Also align function parameters and long assignement lines while at there. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-02licenses: Add the Developer CoOKieran Bingham
Provide a reference copy of the Developers Certificate of Origin. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-02libcamera: media_device: Zero media graph arrays when querying topologyLaurent Pinchart
This silences valgrind that otherwise warns about usage of uninitialized values. While not strictly required as the kernel should fill the whole arrays in MEDIA_IOC_G_TOPOLOGY, the extra cost, in a non-critical path, is negligible compared to the ability to run without valgrind warnings. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-02libcamera: media_device: Make getEntityByName() constJacopo Mondi
The function does not modify the instance state. Mark it as const. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-02libcamera: media_device: Tiny valid() documentation improvementJacopo Mondi
Mention in the valid() method documentation, that a media graph has to be populated to be valid. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-02libcamera: device_enumerator: Use MediaDeviceJacopo Mondi
Replace usage of the DeviceInfo class with MediaDevice in the DeviceEnumerator and remove the DeviceInfo class. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-02libcamera: media_device: Create entities with major and minor numbersJacopo Mondi
Extend the MediaEntity object with device node major and minor numbers, and retrieve them from the media graph using interfaces. They will be used by the DeviceEnumerator to retrieve the devnode path. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-02libcamera: media_device: Add DeviceInfo featuresJacopo Mondi
Add the features of the DeviceInfo class needed to replace it with MediaDevice. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-02test: Move include definitions to libtestKieran Bingham
With the libtest functionality moved to its own library folder, the definitions for test includes should reasonably live there too. The libtest subdir should always remain the first entry in the test/meson.build file. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-02test: Use foreach iterators to simplify definitionsKieran Bingham
Create two arrays, to contain public and internal test targets, and use the foreach iterators to automatically generate test output targets for each entry in each array. The public tests array is linked only against public libcamera headers, while tests declared in the internal_tests will have access to non-public API headers from within the libcamera sources. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>