summaryrefslogtreecommitdiff
path: root/test/v4l2_videodevice
AgeCommit message (Collapse)Author
2021-07-11libcamera: buffer: Rename buffer.h to framebuffer.hLaurent Pinchart
libcamera names header files based on the classes they define. The buffer.h file is an exception. Rename it to framebuffer.h. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25libcamera/base: Validate internal headers as privateKieran Bingham
Headers which must not be exposed as part of the public libcamera API should include base/private.h. Any interface which includes the private.h header will only be able to build if the libcamera_private dependency is used (or the libcamera_base_private dependency directly). Build targets which are intended to use the private API's will use the libcamera_private to handle the automatic definition of the inclusion guard. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25libcamera/base: Move extended base functionalityKieran Bingham
Move the functionality for the following components to the new base support library: - BoundMethod - EventDispatcher - EventDispatcherPoll - Log - Message - Object - Signal - Semaphore - Thread - Timer While it would be preferable to see these split to move one component per commit, these components are all interdependent upon each other, which leaves us with one big change performing the move for all of them. Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25libcamera/base: Move utils to the base libraryKieran Bingham
Move the utils functionality to the libcamera/base library. Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-05-26test: v4l2_videodevice: controls: Test 64-bit controlsLaurent Pinchart
The recent merge (and revert) of commit 34bee5e84ecb ("libcamera: V4L2Device: Remove the controls order assumption in updateControls()") showed that 64-bit controls were missing from unit tests. Fix this by testing the VIVID_CID_INTEGER64 control in the V4L2 video device controls test. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
2021-02-11meson: Fix coding style when declaring arraysLaurent Pinchart
The meson.build files mix array declarations with and without a space after the opening and before the closing square bracket. The vast majority of cases don't use spaces, so standardize on that. While it it, fix indentation in a few places. 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>
2020-11-15libcamera: Move EventDispatcher to internal APILaurent Pinchart
There's no user of the EventDispatcher (and the related EventNotifier and Timer classes) outside of libcamera. Move those classes to the internal API. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-10-21test: v4l2_videodevice: Prevent variable shadowing of formatKieran Bingham
Rename the scoped usage of the variable format while iterating the formats as it shadows the outer scoped format which is used for specific testing. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-10-20test: Omit extra semicolonsHirokazu Honda
TEST_REGISTER macro is main function. The end semicolon with the macro is unnecessary. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-06-18test: Replace explicit DRM FourCCs with libcamera formatsLaurent Pinchart
Use the new pixel format constants to replace usage of macros from drm_fourcc.h. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-05-16libcamera: Move internal headers to include/libcamera/internal/Laurent Pinchart
The libcamera internal headers are located in src/libcamera/include/. The directory is added to the compiler headers search path with a meson include_directories() directive, and internal headers are included with (e.g. for the internal semaphore.h header) #include "semaphore.h" All was well, until libcxx decided to implement the C++20 synchronization library. The __threading_support header gained a #include <semaphore.h> to include the pthread's semaphore support. As include_directories() adds src/libcamera/include/ to the compiler search path with -I, the internal semaphore.h is included instead of the pthread version. Needless to say, the compiler isn't happy. Three options have been considered to fix this issue: - Use -iquote instead of -I. The -iquote option instructs gcc to only consider the header search path for headers included with the "" version. Meson unfortunately doesn't support this option. - Rename the internal semaphore.h header. This was deemed to be the beginning of a long whack-a-mole game, where namespace clashes with system libraries would appear over time (possibly dependent on particular system configurations) and would need to be constantly fixed. - Move the internal headers to another directory to create a unique namespace through path components. This causes lots of churn in all the existing source files through the all project. The first option would be best, but isn't available to us due to missing support in meson. Even if -iquote support was added, we would need to fix the problem before a new version of meson containing the required support would be released. The third option is thus the only practical solution available. Bite the bullet, and do it, moving headers to include/libcamera/internal/. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Jacopo Mondi <jacopo@jmondi.org>
2020-05-13licenses: License all meson files under CC0-1.0Laurent Pinchart
In an attempt to clarify the license terms of all files in the libcamera project, the build system files deserve particular attention. While they describe how the binaries are created, they are not themselves transformed into any part of binary distributions of the software, and thus don't influence the copyright on the binary packages. They are however subject to copyright, and thus influence the distribution terms of the source packages. Most of the meson.build files would not meet the threshold of originality criteria required for copyright protection. Some of the more complex meson.build files may be eligible for copyright protection. To avoid any ambiguity and uncertainty, state our intent to not assert copyrights on the build system files by putting them in the public domain with the CC0-1.0 license. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Acked-by: Giulio Benetti <giulio.benetti@micronovasrl.com> Acked-by: Jacopo Mondi <jacopo@jmondi.org> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Acked-by: Naushir Patuck <naush@raspberrypi.com> Acked-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Acked-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Acked-by: Paul Elder <paul.elder@ideasonboard.com> Acked-by: Show Liu <show.liu@linaro.org>
2020-04-28libcamera: v4l2_device: Simplify usage of getControls()Laurent Pinchart
The V4L2Device::getControls() function takes a ControlList that needs to be pre-populated with dummy entries for the controls that need to be read. This is a cumbersome API, especially when reading a single control. Make it nicer by passing the list of V4L2 controls as a vector of control IDs, and returning a ControlList. 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>
2020-03-27libcamera: v4l2PixelFormat: Replace hex with fourCCKaaira Gupta
Print fourCC characters instead of the hex value in toString() as they are more informative. Also, write the tests for this in formats.cpp Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-23test: v4l2_videodevice: Test U8 array controlsJacopo Mondi
Test V4L2 array control using vivid control VIVID_CID_U8_4D_ARRAY. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-03-20libcamera: controls: Rename ControlRange to ControlInfoLaurent Pinchart
To prepare for storage of additional information in the ControlRange structure, rename it to ControlInfo. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-03-20libcamera: controls: Name all ControlInfoMap instance variables infoMapLaurent Pinchart
To prepare for the rename of ControlRange to ControlInfo, rename all the ControlInfoMap instance variables currently named info to infoMap. This will help avoiding namespace clashes. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-03-19libcamera: v4l2_videodevice: Make V4L2PixelFormat constructor explicitLaurent Pinchart
To achieve the goal of preventing unwanted conversion between a DRM and a V4L2 FourCC, make the V4L2PixelFormat constructor that takes an integer value explicit. All users of V4L2 pixel formats flagged by the compiler are fixed. 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>
2020-03-18libcamera: v4l2_videodevice: Rename exportBuffers() to allocateBuffers()Laurent Pinchart
To prepare for the rework of buffer allocation that will differentiate export and allocation, rename exportBuffers() to allocateBuffers(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-03-18libcamera: PixelFormat: Make constructor explicitLaurent Pinchart
To achieve the goal of preventing unwanted conversion between a DRM and a V4L2 FourCC, make the PixelFormat constructor that takes an integer value explicit. All users of pixel formats flagged by the compiler are fixed. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-03-18test: v4l2_videodevice: buffer_cache: Use DRM pixel formatNiklas Söderlund
The pixel format used in the stream configuration is from V4L2 but should be from DRM, fix it. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-06test: v4l2_videodevice: Add test for V4L2BufferCacheNiklas Söderlund
Add test to test the different modes and situations the V4L2BufferCache can be put in. The tests verify that a FrameBuffer used with the cache results in a V4L2 video device index, and that the cache implementation is capable of keeping buffers in a hot state. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-01-12libcamera: v4l2_videodevice: Remove Buffer interfaceNiklas Söderlund
The Buffer interface is no longer in use and can be removed. While doing so clean up the two odd names (dequeueFrameBuffer() and queuedFrameBuffers_) that had to be used when adding the FrameBuffer interface. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-01-12test: v4l2_videodevice: Switch to FrameBuffer interfaceNiklas Söderlund
The V4L2VideoDevice class can now operate using a FrameBuffer interface, switch all test cases to use it. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-01-12libcamera: buffer: Move captured metadata to FrameMetadataNiklas Söderlund
Move the metadata retrieved when dequeuing a V4L2 buffer into a FrameMetadata object. This is done as a step to migrate to the FrameBuffer interface as the functions added to Buffer around FrameMetadata match the ones in FrameBuffer. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-12-16libcamera: Remove buffer index from loggingNiklas Söderlund
The buffer index is a V4L2 concept that will be hidden from users with the introduction of a new FrameBuffer class. In preparation for this, remove the index from log messages. Keep and move one debug log message where the index is available as the V4L2 buffer is being dequeued for the video device and it's useful when debugging. 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-11-08libcamera: Remove unneeded semicolonsLaurent Pinchart
Comply with the coding style by removing lots of unneeded semicolons. Fix a few other coding style violations on the lines touched by those fixes. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-10-23libcamera: Standardise on C compatibility headersLaurent Pinchart
Now that our usage of C compatibility header is documented, use them consistently through the source code. While at it, group the C and C++ include statements as defined in the coding style, and fix a handful of #include ordering issues. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-10-15libcamera: v4l2_controls: Remove V4L2ControlList classLaurent Pinchart
The V4L2ControlList class only provides a convenience constructor for the ControlList, which can easily be moved to the ControlList class and may benefit it later (to construct a ControlList from controls supported by a camera). Move the constructor and remove V4L2ControlList. 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-10-15libcamera: controls: Merge ControlInfoMap and V4L2ControlInfoMapLaurent Pinchart
The ControlInfoMap and V4L2ControlInfoMap classes are very similar, with the latter adding convenience accessors based on numerical IDs for the former, as well as a cached idmap. Both features can be useful for ControlInfoMap in the context of serialisation, and merging the two classes will further simplify the IPA API. Import all the features of V4L2ControlInfoMap into ControlInfoMap, turning the latter into a real class. A few new constructors and assignment operators are added for completeness. 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-10-15libcamera: v4l2_controls: Store a ControlRange in V4L2ControlInfoMapLaurent Pinchart
V4L2ControlRange only offers a convenience constructor for a ControlRange. Store the ControlRange instead of V4L2ControlRange in V4L2ControlInfoMap to make the map less dependent on V4L2 types. 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-10-15libcamera: v4l2_controls: Replace V4L2ControlInfo with V4L2ControlRangeLaurent Pinchart
The V4L2ControlInfo class only stores a ControlRange. Make it inherit from ControlRange to provide a convenience constructor from a struct v4l2_query_ext_ctrl and rename it to V4L2ControlRange. 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-10-15test: v4l2_videodevice: controls: Use correct control range in checkLaurent Pinchart
A value check on the V4L2_CID_CONTRAST control is using the brightness control range. Fix it. 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-10-13libcamera: v4l2_device: Replace V4L2ControlList with ControlListLaurent Pinchart
The V4L2Device class uses V4L2ControlList as a controls container for the getControls() and setControls() operations. Having a distinct container from ControlList will makes the IPA API more complex, as it needs to explicitly transport both types of lists. This will become even more painful when implementing serialisation and deserialisation. To simplify the IPA API and ease the implementation of serialisation and deserialisation, replace usage of V4L2ControlList with ControlList in the V4L2Device (and thus CameraSensor) API. The V4L2ControlList class becomes a thin wrapper around ControlList that slightly simplifies the creation of control lists for V4L2 controls, and may be removed in the future. 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> Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-10-13test: v4l2_videodevice: Add V4L2 control testLaurent Pinchart
Add a test that exercises the control enumeration, get and set APIs on a V4L2Device. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-08-19test: Get event dispatcher from current threadLaurent Pinchart
For all tests that don't otherwise require access to the camera manager, get the event dispatcher from the current thread instead of the camera manager. This prepares for the removal of CameraManager::instance(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-08-13test: v4l2_device: Remove unused functionKieran Bingham
The 'exists()' call is not used within the code base. Remove it. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-08-13test: v4l2_videodevice: Add M2M device testKieran Bingham
The V4L2M2MDevice requires two video devices to be configured. This makes it unsuitable to reuse the existing V4L2DeviceTest test library in its current form. Implement a full test to run the two M2M pipelines through VIM2M. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-08-11tests: v4l2_videodevice: Set media bus and pixel formats for vimcNiklas Söderlund
Most of the video device tests are based on vimc and Linux commit 85ab1aa1fac17bcd ("media: vimc: deb: fix default sink bayer format") changes the default media bus format for the debayer subdevices. This leads to a -EPIPE error when trying to use the raw capture video device nodes. Fix this by explicitly setting media bus and pixel formats to known good values which works before and after the upstream change. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-07-14libcamera: v4l2_videodevice: Signal buffer completion at streamoff timeLaurent Pinchart
When stopping the stream buffers have been queued, in which case their completion is never be notified to the user. This can lead to memory leaks. Fix it by notifying completion of all queued buffers with the status set to error. As a result the base PipelineHandler implementation can be simplified, as all requests complete as the result of stopping the stream. The stop() method that manually completes all queued requests isn't needed anymore. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-07-14libcamera: v4l2_videodevice: Add helper to queue all buffersLaurent Pinchart
When starting the stream on a capture video device it is often needed to queue all the allocated buffers. Add a helper method to do so, and refactor the existing queueBuffer() method to make it clearer. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-07-13test: v4l2_videodevice: buffer_sharing: Lower resolution to speed up testLaurent Pinchart
Lower the resolution to the smallest vivid supports, 320x180, in order to speed up the test. This isn't enough in itself as the frame rate also has to be configured, but the V4L2VideoDevice class doesn't support frame rate control yet. In the meantime the frame rate can be set manually with yavta or v4l2-ctl. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2019-06-19libcamera: Rename V4L2Device to V4L2VideoDeviceJacopo Mondi
In preparation of creating a new V4L2Device base class, rename V4L2Device to V4L2VideoDevice. This is a project wide rename without any intended functional change. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>