summaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)Author
2020-01-12libcamera: buffer: Switch from Plane to FrameBuffer::PlaneNiklas Söderlund
It is not libcamera's responsibility to handle memory mappings. Switch from the soon to be removed Plane class which deals with memory mappings to FrameBuffer::Plane which just describes it. This makes the transition to the full FrameBuffer easier. As the full FrameBuffer interface has not yet spread to all parts of libcamera core it is hard to create efficient caching of memory mappings in the qcam application. This will be fixed in a later patch, for now the dmabuf is mapped and unmapped each time it is seen by the application. 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>
2020-01-12ipa: Switch to FrameBuffer interfaceNiklas Söderlund
Switch the IPA interfaces and implementations to use the Framebuffer interface. - The IPA interface is switched to use the simpler FrameBuffer::Plane container when carrying dmabuf descriptions (fd and length) over the pipeline/IPA boundary. - The RkISP1 IPA implementation takes advantage of the new simpler and safer (better control over file descriptors) FrameBuffer interface. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-01-12libcamera: buffer: Add FrameBuffer interfaceNiklas Söderlund
Add a new FrameBuffer class to describe memory used to store frames. This change just adds the new interface, future patches will migrate all parts of libcamera to use this and replace the old Buffer interface. This change needs to specify the const keyword for Plane::length() as to not get Doxygen confused with FrameBuffer::Plane::length added in this change. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-01-12libcamera: buffer: Add FrameMetadata container for metadata informationNiklas Söderlund
With the introduction of FrameBuffer objects, the metadata information related to captured frames will not be stored directly in the frame buffer object. Add a new FrameMetadata class to hold this information. 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>
2020-01-12libcamera: Add FileDescriptor to help pass numerical fds aroundNiklas Söderlund
Add a helper to make it easier to pass file descriptors around. The helper class duplicates the fd which decouples it from the original fd which could be closed by its owner while the new FileDescriptor remains valid. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-01-12libcamera: request: remove prepare()Niklas Söderlund
The association of buffers to a request can be done directly in addBuffer() instead of when the request is queued to the camera. Keep the check that a request contains buffers by moving it to Camera::queueRequest() where prepare() was previously called. As a bonus we can remove a friend statement in Request. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-01-07libcamera: bound_method: Rename Bound*Method to BoundMethod*Laurent Pinchart
Most of the bound method classes are named with a BoundMethod prefix, except for BoundMemberMethod and BoundStaticMethod. Rename them to BoundMethodMember and BoundMethodStatic respectively to make the code more coherent. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-01-07libcamera: bound_method: Propagate method return valueLaurent Pinchart
Propagate the return value of the bound method all the way to the caller of activate(). The value is stored in the arguments pack for indirect invocation. As C++ doesn't allow instantiating a variable of type void, we need to specialize the template class BoundMethodPack for methods returning void. This in turn requires template specialization for the BoundMethodArgs class in order to store the return value in the pack, and for the BoundMemberMethod class to extract the return value from the pack. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-01-07libcamera: bound_method: Manage BoundMethodPack through std::shared_ptrLaurent Pinchart
The bound method arguments pack will need to be accessed by the method invoker in order to retrieve the method return value when using a blocking connection type. We thus can't delete the pack unconditionally in the bound method target thread. We also can't delete it unconditionally in the invoker's thread, as for queued connections the pack will be used in the target thread after the invoker completes. This shows that ownership of the arguments pack is shared between two contexts. As a result, manage it using std::shared_ptr<>. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-01-07libcamera: bound_method: Support bindings to non-void methodsLaurent Pinchart
The bound method implementation is restricted to binding to void methods as return values are not supported. This complicates usage of bound methods, as non-void methods used a slots or Object::invokeMethod() targets need to be wrapped in a void method. Simplify this by supporting arbitrary return types and ignoring the return value. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-01-07libcamera: bound_method: Store method arguments in a classLaurent Pinchart
Create a new BoundMethodPack class to replace the PackType type alias. This will allow adding additional fields to the arguments pack, when adding support for propagation of bound method return values. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-01-07libcamera: bound_method: Move sequence and generator to BoundMethodBaseLaurent Pinchart
The sequence and generator member types of BoundMethodArgs are not dependent on the template arguments of BoundMethodArgs. To prepare for template specialization of BoundMethodArgs and avoid code duplication, move them to the BoundMethodBase class. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-01-07libcamera: bound_method: Drop unused BoundMethodBase::connectionType()Laurent Pinchart
The BoundMethodBase::connectionType() method isn't used, drop it. While it at make the connectionType_ member private as it is only used by the class. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-01-07libcamera: bound_method: Mark overriden methods with overrideLaurent Pinchart
Mark the activate() and invoke() methods with the override keyword where appropriate. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-01-07libcamera: object: Use activate() in invokeMethod()Laurent Pinchart
The Object::invokeMethod() implementation duplicates pack creation code from BoundMemberMethod::activate(). Call activate() instead of activatePack() to share code. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-01-03libcamera: camera_manager, pipeline_handler: allow retrieving cameras by ↵Paul Elder
device numbers The V4L2 compatibility layer will need a way to map device numbers to libcamera Camera instances. Expose a method in the camera manager to retrieve Camera instances by devnum. The mapping from device numbers to Camera instances is optionally declared by pipeline handlers when they register cameras with the camera manager. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-01-03libcamera: object: Support reference arguments in invokeMethod()Laurent Pinchart
Invoking a method that takes a reference argument with Object::invokeMethod() results in a compilation error: ../test/object-invoke.cpp:131:11: error: no matching member function for call to 'invokeMethod' object_.invokeMethod(&InvokedObject::methodWithReference, ~~~~~~~~^~~~~~~~~~~~ ../include/libcamera/object.h:33:7: note: candidate template ignored: deduced conflicting types for parameter 'Args' (<const int &> vs. <int>) void invokeMethod(void (T::*func)(Args...), ConnectionType type, Args... args) This is due to the fact that implicit type conversions (from value to reference in this case) takes place after template argument type deduction, during overload resolution. A similar issue would occur if T::func took a long argument and invokeMethod() was called with an in argument. Fix this by specifying to sets of argument types in the invokeMethod() template, one for the arguments to the invoked method, and one for the arguments to invokeMethod() itself. The compiler can then first perform type deduction separately, and implicit conversion in a second step. Reported-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-12-08include: linux: Update Linux headers readme to v5.2Paul Elder
When the Linux headers were updated to v5.2, the version announced in the README was not, so update it. Fixes: 4984973679ec ("include: linux: Update headers to Linux v5.2") Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Acked-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-11-20ipa: Allow short-circuiting the ipa_context_opsLaurent Pinchart
When an IPA module is loaded without isolation and implements the IPAInterface internally, going through ipa_context_ops is a waste of time. Add an operation to retrieve the IPAInterface, and use it directly in the IPAContextWrapper. For debugging purpose, make it possible to forcing usage of the C API by defining the LIBCAMERA_IPA_FORCE_C_API environment variable. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-11-20ipa: Declare the ipaCreate() function prototypeLaurent Pinchart
IPA modules have to implement a public ipaCreate() function, but its prototype isn't declared in any header file. This allows for modules to get the prototype wrong without being warned by the compiler. Fix 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-11-20ipa: Define a plain C APILaurent Pinchart
The C++ objects that are expected to convey data through the IPA API will have associated methods that would require IPAs to link to libcamera. Even though the libcamera license allows this, suppliers of closed-source IPAs may have a different interpretation. To ease their mind and clearly separate vendor code and libcamera code, define a plain C IPA API. The corresponding C objects are stored in plain C structures or have their binary format documented, removing the need for linking to libcamera code on the IPA side. The C API adds three new C structures, ipa_context, ipa_context_ops and ipa_callback_ops. The ipa_context_ops and ipa_callback_ops contain function pointers for all the IPA interface methods and signals, respectively. The ipa_context represents a context of operation for the IPA, and is passed to the IPA oparations. The IPAInterface class is retained as it is easier to use than a plain C API for pipeline handlers, and wrappers will be developed to translate between the C and C++ APIs. Switching to the C API internally will be done in a second step. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-11-20ipa: Pass ControlInfoMap references to IPAInterface::configure()Laurent Pinchart
The IPAInterface::configure() operation receives a map of ControlInfoMap instances. Pass const references instead to avoid copies when not required (the callee can still make manual copies), and to allow for the future serialization layer to keep references to the original object. 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-11-20ipa: Define serialized controlsJacopo Mondi
Define data structures to be used during interaction between IPA modules and pipeline handlers to serialize control lists and control info maps. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> 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-11-20libcamera: buffer: Add const accessor to Buffer planesLaurent Pinchart
In order to inspect planes of a const Buffer, add a const accessor. 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-11-20libcamera: controls: Store reference to the InfoMapJacopo Mondi
Store a reference to the ControlInfoMap used to create a ControlList and provide an operation to retrieve it. This will be used to implement serialization of ControlList. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-11-20libcamera: controls: Make ControList constructor publicLaurent Pinchart
We need to construct empty ControlList objects to serialization. Make the constructor public. 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-11-20libcamera: controls: Make ControlId constructor publicJacopo Mondi
In order to be able to create a ControlId from serialized data, make its constructor public. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-11-20libcamera: controls: Add move constructor to ControlInfoMapLaurent Pinchart
The ControlInfoMap class has a move assignment operator from a plain map, but no corresponding move constructor. Add one. 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> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-11-20libcamera: controls: Index ControlList by unsigned intLaurent Pinchart
In preparation for serialization, index the ControlList by unsigned int. This will allow deserializing a ControlList without requiring external information. 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-11-20libcamera: controls: Add operator== and operator!= to ControlRangeLaurent Pinchart
Allow comparision of control ranges by adding the required operators. 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-11-19libcamera: camera: Remove explicit stream to buffer map in requestCompleted ↵Niklas Söderlund
signal The stream to buffer map in the requestCompleted signal is taken directly from the request which is part of the same signal. Remove the map as it can be fetched directly from the request. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-11-19libcamera: buffer: Drop friend statementNiklas Söderlund
The Buffer class do not need to friend PipelineHandler, drop it. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-11-19libcamera: buffer: Plane: Drop friend statementNiklas Söderlund
The Plane class do not need to friend Stream, drop it. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-11-19libcamera: buffer: Drop forward declaration of BufferPoolNiklas Söderlund
There is no need to forward declare BufferPool, drop it. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> 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-29libcamera: object: Add connection type parameter to invokeMethod()Jacopo Mondi
Allow specifying a different connection type than ConnectionTypeQueued for Object::invokeMethod(). Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-10-29libcamera: object: Use bound method activePack() for invokeMethod()Laurent Pinchart
The BoundMethodBase::activatePack() and the internal Object::invokeMethod() are duplicate implementation of the same mechanism. Use the former to replace the latter. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-10-29libcamera: signal: Specify connection type for signalsLaurent Pinchart
Add a connection type parameter to the Signal::connect() method to control signal delivery. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-10-29libcamera: bound_method: Store connection type in BoundMethodBaseLaurent Pinchart
Store the connection type in the base BoundMethodBase class to make it accessible to all bound methods. The default type is ConnectionTypeAuto. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-10-29libcamera: bound_method: Define connection type for method invocationJacopo Mondi
Define an enumeration of connection types to describe the delivery method of signals and method invocation. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-10-28libcamera: stream: Use the newly defined PixelFormatJacopo Mondi
Use the newly defined PixelFormat type to define the image format contained in the StreamFormats and StreamConfiguration classes. Update the classes documentation accordingly. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-10-28libcamera: Define a PixelFormat type for application-facing formatsJacopo Mondi
Define a PixelFormat type as a simple typedef to an uint32_t. The usage of a dedicated type creates a cleaner and more self-described API. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-10-28include: drm_fourcc: Add Motion-JPEG FourCCJacopo Mondi
Add a FourCC for Motion-JPEG compressed format. This is a temporary addition until the format gets merged in the upstream kernel. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-10-28include: linux: Import DRM/KMS headers from Linux v5.2Jacopo Mondi
Import DRM/KMS header files from Linux kernel v5.2. The DRM headers are used to prepare to use the DRM-defined pixel formats (DRM_FORMAT_*) in place of the currently used V4L2 pixel formats (V4L2_PIX_FMT_*). Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-10-28include: linux: Update headers to Linux v5.2Jacopo Mondi
Update headers to Linux v5.2. The Rockchip ISP1 formats that were added manually in commit 97dce7a13fa3 ("include: linux: Add rkisp1 kernel header and format definitions") are kept. Otherwise the headers come straight from the upstream kernel. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-10-27libcamera: bound_method: Fix compiler warning due to unused argumentsLaurent Pinchart
The BoundStaticMethod::invoke() method is never used, but must still be implemented as the base class defines it as pure virtual. As it doesn't use its arguments, the compiler generates a warning. Fix it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-10-26include: libcamera: Install control_ids.hJacopo Mondi
Make the auto-generated control_ids.h file as part of the libcamera installation. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
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-23libcamera: controls: Remove rogue ';'Jacopo Mondi
The ';' at the end of an inline method declaration is not required. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
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>