Age | Commit message (Collapse) | Author |
|
The bound method classes are not part of the public API, even though
they need to be exposed to applications due to the Object and Signal
template methods that use them. They are excluded from documentation
generation through EXCLUDE_SYMBOLS, but the corresponding .h file is
still listed in the generated documentation. Fix this by excluding the
bound_method.{h,cpp} files themselves.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The process test runs for just 100mS. The spawned process runs for at
least 50mS. Ordinarily this should allow plenty of time for both the
process to be spawned and run, but when adding extra debug
instrumentation, the processes can be slowed down, leading to a false
negative test failure.
Extend the timeout to 2 seconds to allow the short process to be run
correctly - but use the now initialised exitStatus_ to exit the event
loop as soon as the process has completed.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The ProcessTest() declares member variables but leaves them unitialised.
Set them appropriately from the constructor.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The procFinished event handler is registered after the process is
started. This doesn't actually create any race, as the finished signal
is emitted after a SIGCHLD is caught and handled through the
ProcessManager and processed by the event loop.
However, to follow the best practice that resources should be acquired
before performing an action, connect the finished signal before starting
the process.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
On some architectures, atomic binutils are provided by the libatomic
library from gcc. Linking with libatomic is therefore necessary,
otherwise the build fails with:
src/libcamera/4ab8042@@camera@sha/message.cpp.o: In function `libcamera::Message::registerMessageType()':
message.cpp:(.text+0x178): undefined reference to `__atomic_fetch_add_4'
collect2: error: ld returned 1 exit status
This is often for example the case on sparc v8 32 bits.
Fixes:
- http://autobuild.buildroot.org/results/1f0b8338f5f39aa86b9d432598dae2f53c5f7c84
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
[Kieran: Updated commit message to refer to build failure on current
master, rather than the old code currently built by buildroot]
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
When a MediaDevice is enumerated and populated by the
DeviceEnumeratorUdev, there is a possibility that the member device
nodes of the media graph would not be ready (either not created, or
without proper permissions set by udev yet). The MediaDevice is still
passed up to the pipeline handler, where an attempt to access the device
nodes will fail in EPERM. This whole issue is especially likely to
happen when libcamera is run at system init time.
To fix this, we first split DeviceEnumerator::addDevice() into three
methods:
- createDevice() to simply create the MediaDevice
- populateMediaDevice() to populate the MediaDevice
- addDevice() to pass the MediaDevice up to the pipeline handler
DeviceEnumeratorSysfs calls these methods in succession, similar to what
it did before when they were all together as addDevice().
DeviceEnumeratorUdev additionally keeps a map of MediaDevices to a list
of pending device nodes (plus some other auxillary maps), and a simple
list of orphan device nodes. If a v4l device node is ready and there
does not exist any MediaDevice node for it, then it goes to the orphan
list, otherwise it is initialized and removed from the pending list of
the corresponding MediaDevice in the dependency map. When a MediaDevice
is populated via DeviceEnumeratorUdev::populateMediaDevice(), it first
checks the orphan list to see if the device nodes it needs are there,
otherwise it tries to initialize the device nodes and if it fails, then
it adds the device nodes it wants to its list in the dependency map.
This allows MediaDevice instances to be created and initialized properly
with udev when v4l device nodes in the media graph may not be ready when
the MediaDevice is populated.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Report the list of available static metadata tags (characteristicKeys),
of supported controls (requestKeys) and produced metadata (resultKeys)
in the static metadata pack.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
According to the Android camera HALv3 documentation, the request
template metadata pack should not be modified after it is returned to
the camera stack from the HAL.
Currently, the same metadata pack is used for all types of template
request, without updating the capture intent there contained to match
the requested template type, as correctly reported by the
cros_camera_test test application.
In order to avoid modifying the single request template already returned
to the camera stack in order to update the capture intent it contains,
create a map that associates a dedicated template to each supported
capture type.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Simplify the implementation of metadata handling in the CameraDevice
class by using the new CameraMetadata helper class.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The new CameraMetadata helper class wraps the Android camera_metadata_t
to simplify its usage.
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Use more opportune sizes, manually calculated, for the generated request
template.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add two missing tags from the request template generated by the HAL.
The tags are reported as missing by the cros_camera_test tool.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Remove metadata tags wrongly added to the request template constructed
by the libcamera HAL.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Use more opportune sizes for the static metadata pack, and for the
dynamic metadata sizes which where wrongly set to use the ones defined
for the static pack.
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Add all the static metadata keys part of the BC (backward compatible)
metadata group, which represent the minimum requirement for devices
supporting the LIMITED hardware level.
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The error messages are copied from getControls() without being updated
for the set controls case, fix this.
Fixes: eb068f4e67eedacd ("libcamera: v4l2_device: Implement get and set controls")
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The 'tests' option enables compilation of tests. On Gentoo and Chrome
OS, the corresponding package USE flag is named 'test'. Rename the
option to 'test' to bring it in line.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
_FORTIFY_SOURCE adds useful checks during compilation. The option is
enabled by default by gcc on all non-optimised builds (as it requires
-O1 or higher). Enable it explicitly for clang.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Casting the return value of a function to (void) doesn't ignore the
unused result warning with gcc. Use a #pragma to fix this properly, to
fix compilation with _FORTIFY_SOURCE.
Fixes: df23ab95f3d7 ("libcamera: process: fix compilation on Chromium OS")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
|
|
M2M devices using MPLANE API will set the V4L2_CAP_VIDEO_M2M_MPLANE
capability flag.
Ensure that this is matched when checking for Multiplanar capabilities.
Fixes: 4f7625cca7ec ("libcamera: v4l2_videodevice: Support M2M devices")
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
The CameraDevice class has a mechanism to cache static metadata, but
doesn't use it. Fix it.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The CameraManager class is not supposed to be instantiated multiple
times, which led to a singleton implementation. This requires a global
instance of the CameraManager, which is destroyed when the global
destructors are executed.
Relying on global instances causes issues with cleanup, as the order in
which the global destructors are run can't be controlled. In particular,
the Android camera HAL implementation ends up destroying the
CameraHalManager after the CameraManager, which leads to use-after-free
problems.
To solve this, remove the CameraManager::instance() method and make the
CameraManager class instantiable directly. Multiple instances are still
not allowed, and this is enforced by storing the instance pointer
internally to be checked when an instance is created.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The CameraHalManager starts the libcamera CameraManager and creates
CameraProxy instances for each camera in the system. Clean up those
resources when the CameraHalManager terminates.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The CameraHalManager::close() method isn't used, remove it.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The CameraHalManager starts a thread that is never stopped. This leads
to the thread being destroyed while running, which causes a crash. Fix
this by stopping the thread and waiting for it to finish in the
destructor of the CameraHalManager.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The CameraProxy is constructed with a Camera instance passed through a
shared pointer. It forwards it to the CameraDevice constructor, which
takes a reference used for the sole purpose of making an internal copy
of the shared pointer. Both constructors can thus take a const reference
instead of a value or a mutable reference. This optimises the
constructors slightly.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Make the camera manager a protected field of the CameraTest class, and
use it instead of CameraManager::instance() in the camera tests. This
prepares for the removal of CameraManager::instance().
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
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>
|
|
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Commit 92b4af98cd67 ("test: Add EventNotifier thread move test") causes
the build to fail in the Chromium OS build environment, because the
return values of the pipe() function marked with the
__warn_unused_result__ attribute is ignored. Fix this.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Pass the CameraManager instance from the main() function to the
MainWindow class instead of accessing it through
CameraManager::instance(). This prepares for the removal of the
CameraManager::instance() method.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The camera manager is stopped both in the destructor of the MainWindow
class and in the main() function. This double stop isn't needed, remove
the former and keep the latter as the manager is started in the main()
function.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
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>
|
|
The device enumerator logs an error message when a media device is
removed while still in use. Add the device name to the message to help
debugging.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Replace the manual implementation of asynchronous method invocation
through a custom message with Object::invokeMethod(). This simplifies
the thread RPC implementation.
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>
|
|
Create object instances with a parent to avoid the need for reparenting
objects manually.
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>
|
|
The test verifies correct behaviour of parent-child relationships in
relation to thread affinity.
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>
|
|
Now that the Object class implements parent-child relationships, make it
possible to create EventNotifier and Timer instances with a parent by
adding a parent argument to their constructors.
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>
|
|
Add a parent Object to Object instances, and track the parent-children
relationships. Children are bound to the same thread as their parent,
and moving an Object to a thread automatically moves all its children.
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>
|
|
The test verifies correct behaviour of a running timer moved to a
different thread.
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>
|
|
The test verifies correct behaviour of an enabled event notifier moved
to a different thread.
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>
|
|
The Timer instances are registered with the event dispatcher instance of
the CameraManager. This makes it impossible to use timers in other
threads.
Fix this by inheriting from Object, which allows binding instances to a
thread, and register them with the event dispatcher for the thread they
are bound to.
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>
|
|
The EventNotifier instances are registered with the event dispatcher
instance of the CameraManager. This makes it impossible to use event
notifiers in other threads.
Fix this by inheriting from Object, which allows binding instances to a
thread, and register them with the event dispatcher for the thread they
are bound to.
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>
|
|
The CameraManager class uses the event dispatcher of the current thread.
This makes the CameraManager::eventDispatcher() and
CameraManager::setEventDispatcher() methods inconsistent, as they access
different event dispatcher instances depending on the calling thread.
Fix this by inheriting from the Object class, which binds the
CameraManager to a thread, and use the event dispatcher of the bound
thread.
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>
|
|
The test verifies thread affinity and thread move notifications.
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>
|
|
The test verifies correct behaviour of asynchronous method invocation
for Object instances.
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>
|
|
Send a synchronous message to objects just before they get moved to a
new thread. This allows the object to perform any required processing.
EventNotifier and Timer objects will use this mechanism to move
themselves to the new thread's event disaptcher.
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>
|
|
Add a helper invokeMethod() to the Object class that allows asynchrnous
invocation of any method of an Object instance. Asynchronous invocation
occurs when control returns to the event dispatcher of the target
object's thread, in the context of that thread.
To support this, generalise the SignalMessage implementation to support
automatic deletion of the associated BoundMethod, and rename the message
to InvokeMessage to reflect the more generic purpose.
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>
|
|
To make the BoundMethod classes more generic, replace direct access to
private member from Signal classes with accessors or helper functions.
This allows removal of friend statements from the BoundMethod classes.
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>
|
|
Move the Slot* classes to bound_method.{h,cpp} and rename them to
Bound*Method*. They will be reused to implement asynchronous method
invocation similar to cross-thread signal delivery.
This is only a move and rename, no functional changes are included.
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>
|