Age | Commit message (Collapse) | Author |
|
Two incorrect spellings are fixed.
'logr' -> 'log'
'environement' -> 'environment'
Fixes: 747ace042cc1 ("libcamera: log: Get log levels from the environment")
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
The log levels configuration is stored in category:level pairs, not
category=value. Fix the documentation.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The capabilities structure from the kernel can return capabilities of the
driver, or potentially more specific device capabilities.
Handle this with an inline function 'device_caps()' to return the device
specific capabilities when available, or fall back to the driver capabilities
otherwise.
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The compiler creates a move constructor automatically when none is
supplied, and it does the right thing by default in this case. Using
std::move() inside the function prevents the compiler from doing
return value optimization and actually hinders performances. Using
std::move() in the caller is unnecessary, the move constructor is used
automatically by the compiler.
For all these reasons remove the tentative optimization that resulted in
worse performances and worse code.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
In the case that someone calls CameraManager::start() and it has already
started/enumerated, instead of returning -ENODEV, return -EBUSY.
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Log the IPU3 pipeline using IPU3 log category
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Extend the documentation of the intended usage of DeviceMatch. The
DeviceMatch needs enough information to be able to uniquely identify a
specific media device.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Provide a pipeline handler for uvcvideo devices. The entity names for
UVC devices are different for different cameras so matching on entity
names is not possible in the generic case. This leaves options to create
specialized UVC pipeline handlers if needed to fit a specific model's
needs.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Pipeline handlers such as the upcoming ucvideo handler need the model
name to properly name the Camera objects they create. Store the model
name when querying the media device info and handle it in a similar
fashion as the driver name which is already retrieved.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Do not use the abreviated version for members, variables and getter
methods.
Library-wise rename, no intended functional changes.
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Construct a V4L2Device from a MediaEntity device node path. While at
there mark constructor as explicit to avoid copy-construction.
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
And turn it into an OptionsParser object.
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>
|
|
Provide a utility to interact with cameras. This initial state is
limited and only supports listing cameras in the system and selecting a
camera to interact with.
There is not much a interacting possible yet with a camera so the tool
simply exercise the API to get hold of a camera.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add a pipeline handler for the Intel IPU3 device.
The pipeline handler creates a Camera for each image sensor it finds to be
connected to an IPU3 CSI-2 receiver, and enables the link between the two.
Tested on Soraka, listing detected cameras on the system, verifying the
pipeline handler gets matched and links properly enabled.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Use log categories in the whole existing code base.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
If the LIBCAMERA_LOG_FILE environment variable is set, open the file it
points to and redirect the logger output to it.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Set the log level for each log category from the environment variable
LIBCAMERA_LOG_LEVELS.
The variable contains a comma-separated list of category:level pairs,
and category names can include wildcards.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Log categories are used to group log messages by topic. Introduce
support for categories by making the LOG() macro variadic. Support for
configuring log level per category will be introduced in a subsequent
commit.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The MediaEntity::setDeviceNode() function was designed to set the device
node path associated with a MediaEntity. The function was there, but the
devnode_ member field was never actually set. Fix this.
While at there add a getter method for the devnode_ member as it will
soon be used.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Media entities convey information about their main function in the
'function' field of 'struct media_v2_entity'.
Store the main function in the MediaEntity function_ class member and provide
a getter function for that.
While at there update comments, keep the MediaPad description in sync
with the MediaEntity one and remove a stale TODO entry.
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The Camera class is explicitly reference-counted to manage the lifetime
of camera objects. Replace this open-coded implementation with usage of
the std::shared_ptr<> class.
This API change prevents pipeline handlers from subclassing the Camera
class. This isn't deemed to be an issue. Mark the class final to make
this explicit.
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>
|
|
Cameras are listed through a double indirection, first iterating over
all available pipeline handlers, and then listing the cameras they each
support. To simplify the API make the pipeline handlers register the
cameras with the camera manager directly, which lets the camera manager
easily expose the list of all available cameras.
The PipelineHandler API gets simplified as the handlers don't need to
expose the list of cameras they have created.
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>
|
|
The CameraManager takes ownership of the dispatcher passed to the
setEventDispatcher() function. Enforces this by using std::unique_ptr<>.
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>
|
|
signal.cpp is missing a \file signal.h Doxygen directive, preventing
documentation from being generated for the Signal class. Fix it.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Nesting namespace names in a single namespace declaration is a C++17
feature. As libcamera depends on C++11 only, nest two separate namespace
declarations instead.
Reported-by: Shik Chen <shik@google.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Provide a helper V4L2 device object capable of interacting with the
V4L2 Linux Kernel APIs.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Correct the spelling of 'notifiers'.
Fixes: 8356f8a6ab87 ("libcamera: Add a poll-based event dispatcher")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The checkstyle utility highlights some minor warnings against the logger
implementation.
Fix these up.
Fixes: edbd2059d8a4 ("libcamera: Add initial logger")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The msec parameter was multiplied as a 32 bit value when converting to
nanosecond resolution. This wraps at 4.2949 seconds, and causes timers
longer than this to fail.
Fix the multiplication to upcast to 64 bit using an unsigned long long
specifier on the multiplier.
While we're here, initialise the two integer class members in the
constructor initialiser list.
Fixes: 1a57bcb8d1a7 ("libcamera: Add event notification infrastructure")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Convey the fact that the CameraManager class owns the DeviceEnumerator
instance it creates by using std::unique_ptr<> to store the pointer.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
C++14 introduces std::make_unique<>() that makes it easier to initialize
unique_ptr<> instances. As libcamera is limited to C++11, implement our
own version of the function in the libcamera::utils namespace.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
While the DeviceEnumerator::search() function doesn't modify the
instance directly, it returns a non-const pointer to a MediaEntity that
is owned by the DeviceEnumerator instance. This breaks the const
semantics. Don't mark the function as const.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
The EventDispatcherPoll::processNotifiers() function doesn't modify the
argument it receives, make it const.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
The PipelineHandlerFactory::handlers() static method returns a list of
factories, not a list of handlers. Rename it accordingly.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Move documentation from the \file directive to the CameraManager class,
as it documents the class, not the file. Improve the documentation to
provide a brief overview of how the camera manager operates, and fix a
few typos and inconsistencies.
The documentation mentions hotplug even though it isn't implement yet,
as this is a planned feature. More improvements are needed for the
documentation of the CameraManager member functions, and will be added
as part of the API improvements in the near 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>
|
|
Pipeline handler factories are register in a map indexed by their name,
and the list of names is used to expose the factories and look them up.
This is unnecessary cumbersome, we can instead store factories in a
vector and expose it directly. The pipeline factory users will still
have access to the factory names through the factory name() function.
The PipelineHandlerFactory::create() method becomes so simple that it
can be inlined in its single caller, removing the unneeded usage of the
DeviceEnumerator in the factory.
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>
|
|
Address a few issues I missed during patch review.
Minor cosmetic change.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Add a few debug printouts that help follow the library intialization
process: what pipeline handlers are registered, what media devices are
created, and which pipeline manager gets matches with the current
system.
The resulting output is the following, on IPU3 devices:
DBG pipeline_handler.cpp:119 Pipeline handler: "PipeHandlerVimc" registered
DBG pipeline_handler.cpp:119 Pipeline handler: "PipelineHandlerIPU3" registered
DBG device_enumerator.cpp:214 New media device: ipu3-imgu created from: /dev/media0
DBG device_enumerator.cpp:214 New media device: ipu3-cio2 created from: /dev/media1
DBG device_enumerator.cpp:255 Succesfull match for media device: ipu3-cio2
DBG device_enumerator.cpp:255 Succesfull match for media device: ipu3-imgu
DBG pipeline_handler.cpp:150 Pipeline handler: "PipelineHandlerIPU3" matched
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Commit 99a3e7bcfb38 ("libcamera: log: Add a LogFatal log level")
expanded the text representation of the log levels to support the FATAL
string, but left the default unknown match at four characters.
This code should never expect to be executed, but for completeness match
the string lengths by adding an extra character to the result.
Fixes: 99a3e7bcfb38 ("libcamera: log: Add a LogFatal log level")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The DeviceEnumerator::create() function allocates a
DeviceEnumeratorUdev and fails to delete it in the error path, causing a
memory leak. Fix it.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Several functions are missing documentation for some of them parameters
and/or for their return value. Fix this.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Add a function to the MediaLink class to set the state of a link to
enabled or disabled. The function makes use of an internal MediaDevice
method, which is defined private and only accessible by the MediaLink
setEnabled() function itself.
Also add to MediaDevice a function to reset all links registered in the
media graph.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Add three overloaded functions 'link()' to retrieve a link between two
pads. Each overloaded implementation exposes a different method to
identify the source and sink pads.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Add a MediaDevice member field to the MediaObject class hierarcy.
Each media object now has a reference to the media device it belongs to,
and which it has been created by.
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Provide a poll-based event dispatcher implementation as convenience for
applications that don't need a custom event loop. The poll-based
dispatcher is automatically instantiated if the application doesn't
provide its own dispatcher.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add three new classes, EventDispatcher, EventNotifier and Timer, that
define APIs for file descriptor event notification and timers. The
implementation of the EventDispatcher is meant to be provided to
libcamera by the application.
The event dispatcher is integrated twith the camera manager to implement
automatic registration of timers and events.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Introduce a Signal class that allows connecting event sources (signals)
to event listeners (slots) without adding any boilerplate code usually
associated with the observer or listener design patterns.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
There can only be a single camera manager instance in the application.
Creating it as a singleton helps avoiding mistakes. It also allows the
camera manager to be used as a storage of global data, such as the
future event dispatcher.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The logger prints the timestamp fields with a fixed width, but pads them
with spaces instead of zeros. Fix this.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
The ASSERT() macro is similar to the assert() macro defined by the C
standard, but uses the libcamera logging infrastructure.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|