Age | Commit message (Collapse) | Author |
|
Copy the information from the struct v4l2_buffer when dequeueing the
buffer as applications need this information to make sense of the
captured data.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Utilise the event_dispatcher to create a default event loop, and process
asynchronous buffer receive events.
If no frames are captured in 5 seconds, the test will fail.
It will also fail if less than 30 frames have been captured in the same
timeout period.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Provide a small test to exercise the streamOn() and streamOff() calls.
8 buffers are requested locally.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Support starting and stopping a stream on a V4L2 device. Buffers must be
queued before the stream is started.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Provide queueBuffer() and dequeueBuffer() methods to interact with the
V4L2Device.
Buffers will be directly referenced from the bufferPool of the
V4L2Device based on the index in the pool.
The V4L2Device is now opened in non-blocking mode in order to avoid
blocking the dequeueBuffer() method. A signal is emitted when a buffer
is ready and has been dequeued.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Add a utility to the test suite to request and allocate buffers from
a V4L2Device to ensure it functions correctly.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Provide an exportBuffers() function which allocates buffers with the MMAP
method, exports them using the dmabuf API and populates the given BufferPool.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Utilise the existing DeviceEnumerator system to identify a suitable
V4L2Device for testing.
Specifically target these tests at a uvcvideo driver based device as a known
supported target.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Provide classes that represent frame buffers and pools of frame buffers.
An image within the system may use one or more Plane objects to track each
plane in the case of multi-planar image formats. The Buffer class manages all
of the data required to render or interpret the raw image data.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Improve the V4L2DeviceFormat documentation as suggested during patches
review.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Return the device format actually applied to the device on setFormat().
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The V4L2Device constructor wants a "const MediaEntity &", while
entities are usually retrieved by pointer before being used to construct
a V4L2Device. Change the constructor argument to "const MediaEntity *".
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Pick a default format for the UVC one stream in a UVC camera. This is
just a starting point to define a good default format for the UVC camera
it's expected to evolve over time as the capabilities of the library
grows.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The camera needs to be configured with the number of buffers required to
satisfy the applications use case. While the application can request any
number of buffers, the pipeline must take the constraints of the Linux
driver into consideration.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Create a camera for Sensor B of the vimc pipeline. At this stage only
Sensor B is exposed while the are in total two sensors in the graph.
Going forward Sensor A should also be exposed as another camera. Sensor
B was chosen since the graph is configured correctly for it out of the
box. As we lack control over sub devices formats it's not really
possible to use Sensor A yet with the library.
Once both cameras are registered with the library they should be
extended to provide two streams each, one for the raw output and one for
the output which uses the shared scaler.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
This produces code with the ternary operators at the beginning instead of the
end of the line:
return caps_.isMultiplanar() ? getFormatMultiplane(fmt)
: getFormatSingleplane(fmt);
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Fix a small typo in the camera object documentation.
cameera -> camera
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The 'bytesperline' field of 'struct v4l2_pix_format' has to be set for
the single planar set format use case.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Zero initialize v4l2_format structures used to set and get format on the
V4L2 device.
Fixes: ba8da0f2fcd0 ("libcamera: v4l2_device: Add methods to get/set format")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Rename the number of valid plane formats to 'planesCount' and the actual
per-plane size information array to 'planes'.
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Rename parameters to get and set format functions to expand 'fmt' to
'format'.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The single plane getFormat() function wrongly used the VIDIOC_S_FMT ioctl.
Fix that by using the more opportune VIDIOC_G_FMT one.
Fixes: ba8da0f2fcd0 ("libcamera: v4l2_device: Add methods to get/set format")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Rename format() to getFormat() to reflect the v4l2 API names more
closely.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The OptionValue class defines operators to convert the variant to all
the supported option types. As a convenience, add explicit methods to
perform the same operations, avoiding the need to write long
static_cast<>() statements in the caller.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Add an option to configure the first stream of a camera from an argument
with options and parse the width, height and pixel format from that
list.
The pixel format is still specified as a integer which should correspond
to the kernels FOURCC identifiers. Going forward this should be turned
into a string representation and the cam parser should translate between
the two.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Some options passed to the cam utility need to be complex and specify a
list of key=value pairs. Add a new parser to deal with these options,
usable on its own to parse key=value pairs from any string.
Integrate the KeyValueParser into the existing OptionsParser. The cam
application can fully describe all its options in one location and
perform full parsing of all arguments in one go. The KeyValueParser also
integrates itself with the usage() printing of the OptionsParser.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Extend the options parser with support for option types. All options
must now specify the type of their argument, and the parser
automatically parses the argument and handles errors internally.
Available types are none, integer or string.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
When option are added to the parser, they are stored in the
OptionsParser::options_ vector, and a pointer to the option referencing
the vector entry is indexed in the OptionsParser::optionsMap_ map. When
the next option is added the vector may be resized, which invalidates
the pointers stored in the map.
Fix this by storing the options in an std::list<> instead of
std::vector<>.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
To later extend the options handling to cover subparsing of arguments it
will be needed to know if the addition of the option itself was
successful or not. The information is already present in addOption()
this change just makes it available.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
In preparation to adding more parsers create a template class to hold
the parsed information. The rational for making it a template are that
different parsers can index the options using different data types.
The OptionsParser index its options using an int while the upcoming
KeyValyeParser will index its options using strings for example.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The Option structure is declared within the OptionsParser, but will
later be needed by other parsers. Move it outside the OptionsParser
class.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
The enumeration of the different possibilities for arguments can be used
by other parser then OptionsParser. Move it outside the class to make it
ready to be used by other parsers.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Extend the camera to support reading and configuring formats for
groups of streams. The implementation in the Camera are minimalistic as
the heavy lifting are done by the pipeline handler implementations.
The most important functionality the camera provides in this context is
validation of data structures passed to it from the application and
access control to the pipeline handler.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
All streams which are to be used for capture need to be configured at
the same time. This allows the pipeline handler to take any dependencies
between the different streams and their configuration into account when
setting up the hardware.
Extend the pipeline API and all pipeline implementations with two new
functions, one to read a default configuration and one to set a new
configuration. Both functions operate on a group of streams which the
pipeline handler should consider when performing the operations.
In the current implemented pipelines this is rather easy as they only
have one stream each per camera. Furthermore as there is yet no way for
the pipeline handlers to interact with the hardware all they do is
return a null format, log that a default configuration has been
requested and log that a new configuration has been set. Future work
based on more components are needed to make the pipelines return a good
default format and actually interact with the hardware.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
A camera consists of one or more video streams originating from the same
video source. The different streams could for example have access to
different hardware blocks in the video pipeline and therefore be able to
process the video source in different ways.
All static information describing each stream need to be recorded at
camera creation. After a camera is created an application can retrieve
the static information about its streams at any time.
Update all pipeline handlers to register one stream per camera, this
will be extended in the future for some of the pipelines.
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>
|
|
Exclusive access must be obtained before performing operations that
change the device state. Define an internal flag to track ownership and
provide a means of protecting functions that change device
configuration.
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>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Add an initial StreamConfiguration implementation to hold configuration
data for a single stream of a Camera. In its current form not many
configuration parameters are supported but it's expected the number of
options will grow over time.
At this stage the pixel format is represented as an unsigned int to
allow for easy mapping to the V4L2 API. This might be subject to change
in the future as we finalize how libcamera shall represent pixel
formats.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add an initial Stream implementation. The idea is that once capability
support is added to the library each stream will describe its
capabilities using this class. An application will then select one or
more streams based on these capabilities and use them to configure the
camera and capture.
At this stage the Stream class is empty as capabilities are yet to be
added. The class is still useful as it will be used to communicate how
many streams a Camera object provides.
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>
|
|
The class assignment operator is usually defined as returning a
reference to the object, to allow a = b = c statements. While the return
type makes no difference when deleting the operator in a class
definition, it's still a good practice to use the correct return type.
Fix it in the Camera and CameraManager classes.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
If for any reason a default video device is not found in the media graph
the creation of the UVC pipeline silently failed. This is not optimal
when debugging problems with the pipeline, add an error to notify the
user of the issue.
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>
|
|
Provide an example post-commit hook which a developer can install, ensuring
that every commit gets the style checker executed on it.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Add methods to set and get the image format programmed on a V4L2Device
for both the single and multi planar use case.
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Add a V4L2DeviceFormat class aimed to be used to provide format configuration
requests to a V4L2Device.
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Re-work camera data registration to create the cameraData pointer as
unique_ptr<> and make clear its ownership model.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Provide a method for the IPU3 pipeline handler that hides the downcast
required to return an "IPU3CameraData *" reference from the
PipelineHandler::cameraData() method.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
While the C++ allows the redefinition of operator= to return an
arbitrary type, it is customary to return a reference to the assigned
value type.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Use static_cast<>() instead of reinterpret_cast<>() to perform
downcasts, as reinterpret_cast<>() isn't meant (and guaranteed to be
safe) for that purpose.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Split multi-line help messages and indent all lines the same way.
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>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Once a pipeline-specific data has been associated with a camera, refuse
to update it in order to avoid invalidating the previously set
reference, which might still be owned by the caller.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|