Age | Commit message (Collapse) | Author |
|
Check for a hot cache hit before updating which buffer is best to evict
in case no hot hit is found. This doesn't change the behaviour, but
follows a more logical flow.
Suggested-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Instead of looking up the index in the storage vector use the reference
to it created at the beginning of the loop.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The comparison operator does not change any state, mark it as const.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The BufferSource class can be used by other tests other then the camera
buffer importer test, move it to libtest. The only changes to
BufferSource is for it to be allowed to be split in a header and source
file.
This change makes it necessary for libtest to have access to internal
libcamera headers. As the internal headers already are accessible to all
test cases this does not increase the exposure of libcamera internals to
the test cases.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The error message for when a device name can't be resolved to a video
device is wrong and applies to the next operation below it. Move it to
its correct location and add a new error message to highlight the
resolution failure.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add the '-p'|'--list-properties' option to the cam application to list
the properties of a camera.
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>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Add tests to ControlValueTest to cover array controls of all supported
types.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The ControlValueTest hasn't been updated for a long time and is
outdated. Improve it to support all control types, and test the type(),
isArray() and toString() methods.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Add support for serializing and deserializing control values that store
arrays of values. The serialized format is extended to explicitly handle
arrays.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Use the zero-copy variant of ByteStreamBuffer::read() to read packet
headers and control entries. This enhances the performance of
ControlList and ControlInfoMap deserialization.
Deserialization of the actual ControlValue is untouched for now and will
be optimized later.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.binghm@ideasonboard.com>
|
|
Use the ControlValue::data() function to access raw data stored in the
control value and simplify serialization.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.binghm@ideasonboard.com>
|
|
Replace the default case with an explicit ControlTypeNone case in
ControlSerializer::load() to catch omissions when adding new control
types.
A return statement needs to be added to the end of the function to avoid
gcc incorrectly reporting that some exit paths don't contain a return
statement. The compiler will still warn that not all cases are handled
when adding a new control type.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Add a read() function to ByteStreamBuffer that returns a pointer to the
data instead of copying it. Overflow check is still handled by the
class, but the caller must check the returned pointer explicitly.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Add support to write and read a Span<> to and from the ByteStreamBuffer
class.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The documentation of the read() and write() functions refer to non
existent 'size' and 'data' parameters in their brief. Fix them.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Report in a new field of the ipa_control_value_entry structure if the
value contains an array. Reorganize the other fields of the structure to
avoid increasing its size.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The C++ boolean types are lower case, and std::ostream::operator<<(bool)
produces a lowercase string (when std::boolalpha is in effect, otherwise
it produces 0 or 1). Switch ControlValue::toString() to produce
lowercase "true" and "false" strings too for consistency.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Add support for byte values to the control framework and to the control
serializer.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Add support for float values in Control<> and ControlValue classes.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Add a 'size' property to the control yaml description, to convey the
size constraints of array controls. The semantics of the property
contents is currently unspecified, but its presence triggers the
generation of an array control (Control<Span<const T>>).
Example:
- BayerGains:
type: float
description: Gains to apply to the four Bayer colour components for white balance
size: [4]
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
For array controls, the ControlList::set() function takes a value as a
type convertible to Span<T>. This allows passing an std::array or an
std::vector in addition to an explicit Span, but doesn't accept an
std::initializer list as Span has no constructor that takes an
initializer list. Callers are thus forced to create temporary objects
explicitly, which isn't nice.
Fix the issue by providing a ControlList::set() function that takes an
std::initializer_list, and convert it to a Span internally.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Add array controls support to the ControlValue class. The polymorphic
class can now store more than a single element and supports access and
creation through the use of Span<>.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Add a data() function to the ControlValue class to expose the raw data
stored by the class as a Span<const uint8_t>. This will be useful to
simplify the serialization of ControlValue instances.
The size computation for the raw data is moved from the
ControlSerializer, which is updated accordingly to use the data()
function in order to access the size. Simplification of the
ControlSerializer will happen in a subsequent change.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
To avoid defining all specializations of the Control constructor
manually, move the definition of those functions to controls.h and turn
them into a single template function.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
To avoid defining all specializations of the ControlValue constructor
manually, move the definition of those functions to controls.h and turn
them into a single template function. The default constructor is still
kept in controls.cpp.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
To avoid defining all specializations of ControlValue::get() and
ControlValue::set() manually, move the definition of those functions to
controls.h and turn them into single template functions.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
These will be used to implement ControlValue::get() and set() as
template functions.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The ControlList::get() and ControlValue::get() methods return the
control value by reference. This requires the ControlValue class to
store the control value in the same form as the one returned by those
functions. For the array controls that are soon to be added, the
ControlValue class would need to store a span<> instance in addition to
the control value itself, which would increase the required storage
space.
Prepare for support of array controls by returning from get() by value.
As all control values are 8 bytes at most, this doesn't affect
efficiency negatively.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The ControlList::set() method takes a reference to a Control<T>, and
requires the value to be a reference to T. This prevents the set()
method from being used with value types that are convertible to T, and
in particular with std::array or std::vector value types when the
Control type is a Span<> to support array controls.
Fix this by decoupling the control type and value type in the template
parameters. The compiler will still catch invalid conversions, including
cases where the constructor of type T from the value type is explicit.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The ControlValue::get<T>() method verifies that the T type corresponds
to the ControlValue type. It however accepts int32_t as a return type
for 64-bit integer controls, and int64_t as a return type for 32-bit
integer controls. There's no reason to do so anymore, make the type
check stricter.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Reorder functions in ControlValue class to group const methods together.
Cosmetic change only.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The control-related structures ipa_controls_header,
ipa_control_value_entry and ipa_control_range_entry define the IPA
protocol and are thus part of the ABI. To avoid breaking it
inadvertently, use static_assert() to check the size of the structures.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The <ipa/ipa_controls.h> header makes use of uint*_t types, but doesn't
include stdint.h. Fix it, and include ipa_controls.h in ipa_controls.cpp
to test compilation of the header on its own.
While at it, fix the comment as the top of ipa_controls.cpp to refer to
the correct file name.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The ipa_control_range_data structure is only used to document the IPA
control serialization format, but isn't used in code at all as the
ControlRange entries are directly serialized to a byte stream buffer.
This applies to the ipa_control_value_data structure that is solely used
by ipa_control_range_data.
Expand the documentation of the IPA control serialization format to
describe the layout of the control range data in words and diagrams
instead of through a C structure. Remove the unused structures as a
result.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Doxygen fails to parse entries with multiple << signs as, in example,
\var extern const Control<Span<int32_t>>
Remove the type from the control documentation as unique control and
property names should not need any additional information specified for
Doxygen to correctly identify them.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Add a compile-only test that exercises the whole Span API, as template
functions are not fully compile-tested when the file is parsed.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
C++20 will contain a std::span<> class that provides view over a
contiguous sequence of objects, the storage of which is owned by some
other object.
Add a compatible implementation to the utils namespace. This will be
used to implement array controls.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
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>
|