summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2019-06-12tests: Add CameraSensor class testLaurent Pinchart
Add a test to verify media bus codes, sizes and resolution retrieval through the CameraSensor API based on the Sensor A in the vimc pipeline. Also check that the getFormat() method returns the expected media bus code and size. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-06-11test: camera: Increase runtime for capture testNiklas Söderlund
Upstream commit 2978a505aaa981b2 ("media: vimc: stream: fix thread state before sleep") changes the frame rate when capturing from the vimc raw capture video nodes. The commit changes the frame rate from thousands of frames per second to to roughly fifty. The libcamera capture test was written with the assumption that vimc would keep providing this fast frame rate and ran for a very short time to decrease the overall run time of tests. This is no longer possible and the test fails as it can't capture enough frames in its runtime, increase the runtime to match the new vimc frame rate. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-10test: camera: Fix initialisationKieran Bingham
Three tests {capture,configuration_set,statemachine} override the CameraTest::init() function, and call it as the first action. However they were not checking the return value, and each of the tests will segfault if the VIMC camera is not obtained. Check the return value of the CameraTest base class initialisation and return any errors to the test suite if initialisation fails. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-06-05libcamera: test: remove test IPA and use dummy IPA insteadPaul Elder
Use the dummy IPA for testing/sample IPA instead of the earlier test IPA. Remove the test IPA, and update tests and meson accordingly. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-05libcamera: ipa_manager: implement class for managing IPA modulesPaul Elder
IPAManager is a class that will search in given directories for IPA modules, and will load them into a list. It also provides an interface for pipeline handlers to acquire an IPA. A meson build file for the IPAs is added, which also specifies a hard-coded path for where to load the IPAs from in the installation directory. More paths can be specified with the environment variable LIBCAMERA_IPA_MODULE_PATH, with the same syntax as the regular PATH environment variable. Make the test framework set this environment variable. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-05libcamera: ipa_module_info: update struct to allow IPA matchingPaul Elder
We need a way to match pipelines with IPA modules, so add fields in IPAModuleInfo to hold the IPA module API version number, the pipeline name, and the pipeline version. The module API version is used to determine the layout of struct IPAModuleInfo. Also update IPA module tests and Doxygen accordingly. Doxygen needs to be updated to accomodate __attribute__((packed)). Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-05libcamera: ipa_interface: add headerPaul Elder
Define an IPAInterface class which will contain an IPA implementation. The methods that the IPAInterface exposes form the interface to the IPA implementation, hence the name. IPA module shared objects will implement this class. This also means that IPA module shared objects must be implemented in C++, so remove the C test IPA module. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-05-25tests: list_formats: Fix argument names and add constNiklas Söderlund
Argument name differs from definition and implementation, fix it by renaming the definition. While at it make the argument const. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-05-23meson: Create and use a dependency for libcamera and its headersLaurent Pinchart
Instead of manually adding the libcamera library and include path to every target that requires it, declare a dependency that groups the headers as source, the library and the include path, and use it through the project. This simplifies handling of the dependency. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-05-23meson: Fix coding style in meson.build filesLaurent Pinchart
Consistently go for 4 spaces indentation, and always put a space between the colon in argument lists, as per the examples from the meson documentation. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-05-23libcamera: camera: Add a validation API to the CameraConfiguration classLaurent Pinchart
The CameraConfiguration class implements a simple storage of StreamConfiguration with internal validation limited to verifying that the stream configurations are not empty. Extend this mechanism by implementing a smart validate() method backed by pipeline handlers. This new mechanism changes the semantic of the camera configuration. The Camera::generateConfiguration() operation still generates a default configuration based on roles, but now also supports generating empty configurations to be filled by applications. Applications can inspect the configuration, optionally modify it, and validate it. The validation implements "try" semantics and adjusts invalid configurations instead of rejecting them completely. Applications then decide whether to accept the modified configuration, or try again with a different set of parameters. Once the configuration is valid, it is passed to Camera::configure(), and pipeline handlers are guaranteed that the configuration they receive is valid. A reference to the Camera may need to be stored in the CameraConfiguration derived classes in order to access it from their validate() implementation. This must be stored as a std::shared_ptr<> as the CameraConfiguration instances belong to applications. In order to make this possible, make the Camera class inherit from std::shared_from_this<>. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-05-23libcamera: camera: Return a pointer from generateConfiguration()Laurent Pinchart
To prepare for specialising the CameraConfiguration class in pipeline handlers, return a pointer to a camera configuration instead of a reference from Camera::generateConfiguration(). The camera configuration always needs to be allocated from the pipeline handler, and its ownership is passed to the application. For symmetry, change Camera::configure() to take a CameraConfiguration pointer instead of a reference. This aligns with our coding practice of passing parameters that are modified by the callee by pointer. 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-05-23libcamera: Refactor the camera configuration storage and APILaurent Pinchart
Refactor the CameraConfiguration structure to not rely on Stream instances. This is a step towards making the camera configuration object more powerful with configuration validation using "try" semantics. The CameraConfiguration now exposes a simple vector-like API to access the contained stream configurations. Both operator[]() and at() are provided to access elements. The isEmpty() method is renamed to empty() and the methods reordered to match the std::vector class. As applications need access to the Stream instances associated with the configuration entries in order to associate buffers with streams when creating requests, expose the stream selected by the pipeline handler through a new StreamConfiguration::stream(). 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-05-23libcamera: Use stream roles directly instead of StreamUsageLaurent Pinchart
In order to prepare for an API overhall of the camera configuration generation, remove the StreamUsage class and replace its uses by stream roles. The size hints can't be specified anymore, and will be replaced with an API on the StreamConfiguration to negotiate configuration parameters with cameras. 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-05-23libcamera: camera: Rename configureStreams() and streamConfiguration()Laurent Pinchart
Rename the configureStreams() and streamConfiguration() methods to configure() and generateConfiguration() respectively in order to clarify the API. Both methods deal with CameraConfiguration objects, and are thus not limited to streams, even if a CameraConfiguration currently contains streams only. While at it, remove the qcam MainWindow::configureStreams() method that is declared but never defined or used. 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-05-21test: ipa: add IPAModule testsPaul Elder
Add tests to test the the IPAModule class, for loading the IPA module info from IPA module .so shared objects, with modules written in both C and C++. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-05-17test: v4l2_device: Switch most tests to vimcNiklas Söderlund
The vimc driver delivers frames much faster then the vivid driver hence most v4l2 device tests complete much quicker if vimc is used. The only v4l2 device test which can't be switched is buffer_sharing as it needs to import buffers somewhere, something vimc do not support. With this change I manage to shave of almost 7 seconds for each run of all v4l2 device tests. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-05-17test: v4l2_device: Reset media links and set a resolutionNiklas Söderlund
When initializing the test reset any media links and set a know resolutions. This is needed to put the device under test into known state and not have the v4l2 device tests depend on that no one have touched the device before the test is executed. The resolution is picked purely at random and could possibly be moved to each test case if there is a need for different resolutions for a specific one. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-05-17test: v4l2_device: Allow each test to specify which device and entity to testNiklas Söderlund
Prepare for different tests which implements V4L2DeviceTest to specify which media device and entity they wish to test. There is no functional changes, all tests still use vivid to perform there tests. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-05-17test: v4l2_device: Implement functions inside class definition in cpp filesNiklas Söderlund
Align the style of the formats test with the other v4l2_device tests by impending the functions in the class definition instead of first declaring the class and then implement the functions. There is no functional change only restructuring of existing code to align with the style of other tests. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-05-17test: v4l2_device: Order class sectionsNiklas Söderlund
Order the sections of a class public, protected and private. There is no functional change only restructuring of existing code to align with the style of other tests. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-05-17test: media_device: Add test for acquire() and release()Niklas Söderlund
The interfaces MediaDevice::{open,close}() are about to be made private, replace them with a test of MediaDevice::{acquire,release}() instead. The new test will implicitly tests the open() and close() methods as they are about to be move inside acquire() and release() which will remain public. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-05-17test: media_device: Create a common MediaDeviceTest base classNiklas Söderlund
Before adding more tests which will act on the vimc pipeline break out a common base from media_device_link_test.cpp which already acts on vimc. The new common base class will help reduce code duplication. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-05-17libcamera: media_device: Handle media device fd in acquire() and release()Niklas Söderlund
To gain better control of when a file descriptor is open to the media device and reduce the work needed in pipeline handler implementations, handle the file descriptor in acquire() and release(). This changes the current behavior where a file descriptor is only open when requested by the pipeline handler to that one is always open as long a media device is acquired. This new behavior is desired to allow implementing exclusive access to a pipeline handler between processes. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-05-17libcamera: media_device: Open and close media device inside populate()Niklas Söderlund
Remove the need for the caller to open and close the media device when populating the MediaDevice. This is done as an effort to make the usage of the MediaDevice less error prone and the interface stricter. The rework also revealed and fixes a potential memory leak in MediaDevice::populate() where resources would not be deleted if the second MEDIA_IOC_G_TOPOLOGY would fail. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-05-17libcamera: Always check return value of MediaDevice::acquire()Niklas Söderlund
In preparation for adding more responsibility to MediaDevice::acquire() remove unneeded calls to acquire() and release(), and make sure all needed calls to acquire() are checked and acted on. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-04-30test: Unify naming of configurations in testsLaurent Pinchart
Name all instances of CameraConfiguration "config", and all instances of StreamConfiguration "cfg" accross all tests. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
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-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-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-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-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-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: 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-09libcamera: Switch to CameraConfigurationNiklas Söderlund
Implement the camera configuration thru out the library, tests, cam and qcam tools. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-04-05libcamera: camera: Add support for stream usagesNiklas Söderlund
Instead of requesting the default configuration for a set of streams where the application has to figure out which streams provided by the camera is best suited for its intended usage, have the library figure this out by using stream usages. The application asks the library for a list of streams and a suggested default configuration for them by supplying a list of stream usages. Once the list is retrieved the application can fine-tune the returned configuration and then try to apply it to the camera. Currently no pipeline handler is prepared to handle stream usages but nor did it make use of the list of Stream IDs which was the previous interface. The main reason for this is that all cameras currently only provide one stream each. This will still be the case but the API will be prepared to expand both pipeline handlers and applications to support streams usages. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-04-05libcamera: Make geometry.h a public headerNiklas Söderlund
Make the geometry header public so it can be used by the API facing applications. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-04-04test: camera: Remove test for bad Stream IDsNiklas Söderlund
In preparation of reworking how a default configuration is retrieved from a camera remove test that stream IDs must be valid as the data type passed to Camera::streamConfiguration() will change. This change is in preparation for an invasive change. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-04-04test: camera: Remove streams argument from configurationValid()Niklas Söderlund
In preparation of reworking how a default configuration is retrieved from a camera remove the streams and validation using the stream when judging if a camera configuration is valid. This is needed as once stream usage hints are added applications will no longer fetch default configuration based on Stream IDs so using them to verify the returned format is not useful. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-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-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-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-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-02-13test: v4l2_device: Provide buffer sharing testKieran Bingham
Obtain two V4L2Devices and use one to obtain a BufferPool. Propagate the formats from the first to the second device and then commence sending buffers between the two devices in a ping-pong fashion. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-02-13test: v4l2_device: release capture device resourcesKieran Bingham
Ensure that the cleanup operation releases the device and resources. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-02-13test: v4l2_device: Rename dev_ to capture_Kieran Bingham
Change the variable name globally throughout the tests. Repair the V4L2DeviceTest constructor style, as checkstyle complained. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>