Age | Commit message (Collapse) | Author |
|
The tests declare a hard-coded LIBCAMERA_IPA_MODULE_PATH to allow tests
to run from the test-suite.
This requires tests to be run only from the root of the build directory,
otherwise (for example, by running in their local directory) they will
not be able to correctly locate the IPA modules.
Now that the build path for the IPA manager is determined at runtime we
can remove the redundant setting of the LIBCAMERA_IPA_MODULE_PATH for
tests.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
When libcamera is built and tested (or used at all) before installing to
the configured prefix path, it will be unable to locate the IPA
binaries, or IPA binaries previously installed in the system paths may
be incorrect to load.
Utilise the build_rpath dynamic tag which is stripped out by meson at
install time to determine at runtime if the library currently executing
has been installed or not.
When not installed and running from a build tree, identify the location
of that tree by finding the path of the active libcamera.so itself, and
from that point add a relative path to be able to load the most recently
built IPA modules.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Provide an optional means to recurse into subdirectories to search for IPA
libraries. This allows IPAs contained within their own build directory
to be found when loading from a non-installed build.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The addDir call only returns an error if it can't open the directory.
Callers only care about the number of modules added, and discard any
error information.
Simplify the return value and calling code by returning an unsigned int
of the number of modules loaded.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Setting a user environment path in LIBCAMERA_IPA_MODULE_PATH should take
precedence over the system loading locations.
Adjust the IPA search orders accordingly.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Provide a std::string based implementation which conforms to the
behaviour of the dirname() fucntion defined by POSIX.
Tests are added to cover expected corner cases of the implementation.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
clang-10 has introduced the same deprecated-copy warning that appeared
in gcc-9 and caused build issues with Qt header files. However, the
clang version seems more sensitive, and detects issues that are not
fixed in Qt 5.13, unlike gcc-9.
Extend the logic that disables the warning for gcc-9 and Qt < 5.13 to
cover clang-10 and all Qt versions.
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>
|
|
Utilise the QStandardPaths::PicturesLocation as a starting point for
saving images from qcam.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Extend MediaDevice to inherit from the Loggable interface to support a
logPrefix which presents the device node path, and the driver name.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The conversion of pointers to integers is implementation defined and
differs between g++ and clang++ when utilising a uint64_t type.
#include <iostream>
int main(int argc, char **argv)
{
void *ptr = reinterpret_cast<void *>(0xf1234567);
uint64_t u64 = reinterpret_cast<uint64_t>(ptr);
uint64_t uint64 = reinterpret_cast<uintptr_t>(ptr);
std::cout << "ptr " << ptr
<< " ptr -> u64 0x" << std::hex << u64
<< " ptr -> uintptr_t -> u64 0x" << std::hex << uint64
<< std::endl;
return 0;
}
When compiled with g++ for a 32-bit platform produces the following
unexpected output:
ptr 0xf1234567 ptr -> u64 0xfffffffff1234567 ptr -> uintptr_t -> u64 0xf1234567
The standards states:
"A pointer can be explicitly converted to any integral type large enough
to hold all values of its type. The mapping function is
implementation-defined. [Note: It is intended to be unsurprising to
those who know the addressing structure of the underlying machine. — end
note]"
And as such the g++ implementation appears to be little more surprising
than expected in this situation.
The MediaDevice passes pointers to the kernel via the struct
media_v2_topology in which pointers are cast using a uint64 type (__u64),
which is affected by the sign extension described above when BIT(32) is
set and causes an invalid address to be given to the kernel.
Ensure that we cast using uintptr_t which is not affected by the sign
extension issue.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
C++14 introduced useful type traits helpers named std::*_t as aliases to
std::*<...>::type. Use them to simplify the code.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
If one device fails to enumerate, which isn't supposed to happen under
normal conditions, both the sysfs and the udev enumerators stop
enumeration of further devices. This potentially prevents working
devices from being detected and handled. Fix it by skipping the faulty
device.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The <random> header isn't needed since commit 6e1e847753fd ("test:
camera: buffer_import: Update to FrameBuffer restrictions"). Don't
include it.
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>
|
|
Construct two example static metadata to be reported to the Android
framework using the properties reported by the Camera.
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Add a method to the Camera class to retrieve the Camera properties
registered by the pipeline handler.
While at it, reword the Camera::controls() operation documentation to
specify that the camera control information are constant during the
camera lifetime not their value, while the camera properties value are
the actually static information.
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>
|
|
Associate to each Camera a ControlList which contains the Camera
properties as created by pipeline handlers in the pipeline handler's
CameraData and provide an operation to retrieve them.
Collect properties from the camera sensor in all pipeline handlers that
support one (IPU3, RKISP1 and VIMC).
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>
|
|
Parse and collect camera sensor properties by inspecting the associated
v4l2 controls.
Augment the CameraSensor class with an operation to retrieve the
collected properties.
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>
|
|
Augment the the ControlRange class to store the control default value.
This is particularly relevant for v4l2 controls used to create
Camera properties, which are constructed using immutable video device
properties, whose value won't change at runtime.
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>
|
|
The rotation property describes the rotation of the camera sensor.
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>
|
|
Re-use the Control generation infrastructure to generate libcamera properties
and define the first 'Location' property.
Introduce three additional files:
- include/libcamera/property_ids.h
Defines the properties ids
- src/libcamera/property_ids.cpp
Defines the properties Control<> instances
- src/libcamera/property_ids.yaml
Provide the first 'Location' property definition.
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
In preparation to add libcamera Camera properties definitions by re-using
the control generation framework, augment the gen_controls.py script to
support parsing the 'enum' yaml tag and generate documentation and
definition of possible values associated with a Control or a Property
and defined through an enumeration of supported values.
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Import a temporary version of the v4l2-controls.h with the newly added
definition of V4L2_CID_CAMERA_SENSOR_LOCATION and
V4L2_CID_CAMERA_SENSOR_ROTATION controls.
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Test that Thread::wait() on a thread that hasn't been started, or on a
thread that is known to have completed, returns without a timeout.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Add a test case to wait with a timeout, testing both a too short and a
long enough duration.
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>
|
|
Add a parameter to the Thread::wait() function to wait with a timeout.
The delay value utils::duration::max() waits forever.
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>
|
|
Implement a save image button on the toolbar which will take a current
viewfinder image and present the user with a QFileDialog to allow them
to choose where to save the image.
Utilise the QImageWriter to perform the output task.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Provide Quit, Play, Stop icons.
Create a Qt resource to compile icons into the binary and present them
on the toolbar.
Update the Quit button with a 'cross', and implement Play/Stop buttons.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Provide simple clean icons from https://feathericons.com/
(https://github.com/feathericons/feather)
These are provided under the MIT license.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Implement a quit button, and a list of cameras.
Selecting a different camera from the Toolbar will stop the current
stream, and start streaming the chosen camera device if it can be
acquired.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Intialise a local copy of the CameraManager instance to ease
access to the CameraManager which is frequently utilised.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The MainWindow connects a handler to the Camera requestCompleted signal
when the camera is opened, but never disconnects it.
Move the connection to the startCapture() function, and ensure that it
is disconnected again when the stream is stopped.
This ensures that we can successfully tear down the stream, and restart
with a new camera.
Introducing the error_disconnect cleanup path in start_capture
identified that we left the camera in the start state, thus we also add
a call to camera->stop() when disconnecting the signal connection.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The FrameBufferAllocator must be deleted and reconstructed before performing
any reconfiguration of the stream.
Construct the allocator at startCapture, and destroy it during stopCapture so
that we can successfully stop and restart the stream.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add control for cropping/selection on a V4L2 video device through
the VIDIOC_S_SELECTION ioctl. This is similar to the existing cropping
control available on V4L2 sub-devices.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Two occasions in the source utilise the Doxygen '\returns' alias for \return.
We use \return everywhere else in the code. Update the two occurences to match.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Replace the custom string splitting implementation with utils::split().
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[Kieran: Re-fit to master branch]
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The test constructs a string by joining substrings, splits it, and
verifies that the original and resulting substrings match.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Add a utils::split() function that splits a string for the purpose of
iterating over substrings. It returns an object of unspecified type that
can be used in range-based for loops.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
rkisp1 kernel driver was merged upstream with minor changes in the
topology from the original driver libcamera based it's first support to
rkisp1.
Adapt libcamera capture script to work with upstream driver.
* Remove subdevice dphy from the pipeline.
* Add resizer in the pipeline.
* Fix links.
* Update entity names.
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
rkisp1 kernel driver was merged upstream with minor changes in the
topology from the original driver libcamera based it's first support to
rkisp1.
Adapt libcamera pipeline to work with upstream driver.
* Remove subdevice dphy from the pipeline.
* Add resizer in the pipeline.
* Fix links.
* Update entity names.
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
We use array designators for array initialization, which is a C99
extension. clang-10 warns about it, causing a build failure.
As this is a useful extension, silence the warning. This needs to be
done only if the compiler supports the -Wno-c99-designator argument,
otherwise a -Wunknown-warning-option will be generated.
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>
|
|
Now that libcamera creates threads internally and doesn't rely on an
application-provided event loop, remove the thread from the Android
Camera HAL layer. The CameraProxy class becomes meaningless, remove it
and communicate directly from the CameraHalManager to the CameraDevice.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Now that libcamera creates threads internally and doesn't rely on an
application-provided event loop, remove the thread from the V4L2
compatibility layer. The split between the V4L2CameraProxy and
V4L2Camera classes is still kept to separate the V4L2 adaptation from
camera operation. This may be further refactored later.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Document the threading model of the PipelineHandler class (and all its
derived classes). The model is already enforced by the Camera class, so
no change in the implementation is required. As for the Camera class,
disconnection is currently left out.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Document the threading model of the Camera class and implement it.
Selected functions become thread-safe, and require a few functions of
the PipelineHandler class to be called through cross-thread invocation
as the pipeline handlers live in the camera manager thread, while the
Camera class is mostly accessed from the application thread. The
PipelineHandler is made to inherit from the Object class to support
this.
Disconnection is currently left out as it is not implemented in pipeline
handlers, and isn't fully supported in the Camera class either. This
will be revisited when implementing proper hotplug support.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Relying on the application event loop to process all our internal events
is a bad idea for multiple reasons. In many cases the user of libcamera
can't provide an event loop, for instance when running through one of
the adaptation layers. The Android camera HAL and V4L2 compatibility
layer create a thread for this reason, and the GStreamer element would
need to do so as well. Furthermore, relying on the application event
loop pushes libcamera's realtime constraints to the application, which
isn't manageable.
For these reasons it's desirable to always run the camera manager, the
pipeline handlers and the cameras in a separate thread. Doing so isn't
too complicated, it only involves creating the thread internally when
starting the camera manager, and synchronizing a few methods of the
Camera class. Do so as a first step towards defining the threading model
of libcamera.
The event dispatcher interface is still exposed to applications, to
enable cross-thread signal delivery if desired.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Make the signal connection and disconnection thread-safe, and document
them as such. This is required to make objects connectable from
different threads.
The connect(), disconnect() and emit() methods are now all protected by
a global mutex, which may generate a high lock contention. This could be
improved with finer-grained locks or with a pool of mutexes.
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>
|
|
Define the thread-safety attributes of the classes and methods that are
either thread-safe or thread-bound. The CameraManager, Camera and
PipelineHandler will be addressed separately.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Document the design of libcamera's threading support, and prepare to
document thread-safety of classes and functions with a doxygen alias
command.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
qcam currently only displays a standard viewfinder. As such set the
StreamRole parameter to Viewfinder so that the pipeline handlers can
setup the appropriate resolutions and formats.
Signed-off-by: Naushir Patuck <naush@raspberrypi.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>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Access the ELF types corresponding to the native word size using the
ElfW() macro instead of template types. This is the standard method and
simplifies the code.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|