Age | Commit message (Collapse) | Author |
|
The files() function generates a variable with the location of the
referenced files.
This is shorter than joining the current_source_dir() of which use is
somewhat frowned upon.
Fixes: 90de3690c456 ("libcamera: Auto-generate libcamera.h")
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add a meson.build checker that warns when tabs are used.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Introduce two new base classes for the code formatters and style
checkers, with an auto-registration mechanism that automatically uses
all derived classes. This will allow easier addition of new formatters
and checkers.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Compiling with clang renders errors as a variable-sized arrays are not
allowed to be initialized. Solve this by using memset() for v4l2Ctrls
which is the only one of the two arrays that needs to be zeroed.
../../src/libcamera/v4l2_device.cpp:155:37: error: variable-sized object may not be initialized
const V4L2ControlInfo *controlInfo[count] = {};
^~~~~
../../src/libcamera/v4l2_device.cpp:156:36: error: variable-sized object may not be initialized
struct v4l2_ext_control v4l2Ctrls[count] = {};
^~~~~
../../src/libcamera/v4l2_device.cpp:227:37: error: variable-sized object may not be initialized
const V4L2ControlInfo *controlInfo[count] = {};
^~~~~
../../src/libcamera/v4l2_device.cpp:228:36: error: variable-sized object may not be initialized
struct v4l2_ext_control v4l2Ctrls[count] = {};
^~~~~
Fixes: eb068f4e67eedacd ("libcamera: v4l2_device: Implement get and set controls")
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
When enumerating the available V4L2 controls at video device open
time set the V4L2_CTRL_FLAG_NEXT_CTRL flag if an unsupported control
type is encountered to prevent infinite loops.
While at it, downgrade the message reporting the unsupported control
type to Debug, as it is not an error worth being reported unconditionally.
Fixes: 030ce6491ed3 ("libcamera: v4l2_device: List valid controls at open")
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
When using -std=c++11, GCC versions 6.2 and 6.3 take objection to
declaring a struct type when using a range based iterator:
event_dispatcher_poll.cpp:231:13: error: types may not be defined
in a for-range-declaration [-Werror]
for (const struct pollfd &pfd : pollfds) {
^~~~~~
cc1plus: all warnings being treated as errors
Removing the keyword 'struct' ensures that the compiler does not try to
declare the type, and instead uses the type as already defined by the
relevant poll.h header.
This issue does not affect later compiler versions.
Reported-by: [autobuild.buildroot.net] Thomas Petazzoni <thomas.petazzoni@bootlin.com>
http://autobuild.buildroot.net/results/f6dd4c60c04892c8b1669e6000fce7edb2b6349e/
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>
|
|
queueRequest() is called after starting the stream.
If it fails, the stream should be stopped, otherwise it can get a
"Device or resource busy" error, due to VIDIOC_REQBUFS ioctls being
called after VIDIOC_STREAMON without VIDIOC_STREAMOFF in-between.
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Set the ImgU pipe_mode control based on the active stream configuration.
Use 'Video' pipe mode unless the viewfinder stream is not active.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Add operations to get and set control and to retrieve the informations
on a V4L2 control. For simple camera sensors, the operations are
directly called on the underlying V4L2 subdevice.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Implement getControls() and setControls() operations in V4L2Device class.
Both operations take a V4L2Controls instance and read or write the V4L2
controls on the V4L2 device.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Enumerate all the valid controls a device supports at open() time.
A control is valid only if its type is supported.
Store the control information in a map inside the device to save
querying the control when setting or getting its value from the device
and provide an operation to retrieve information by control ID.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add libcamera V4L2 control support, implemented using the V4L2 Extended
Control APIs. This patch defines the types used to create and manage
controls.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
libc++ is used by Chrome OS, and likely as well by other environments
based on clang. Using it by default if available when compiling with
clang will help extending the compile-testing coverage. The drawback is
that issues specific to clang with libstdc++ will not be caught as
easily, but based on the experience with clang so far, code compiling
correctly with gcc/libstdc++ has failed with clang due to either
clang-specific or libc++-specific behaviour, never due only to the
combination of clang with libstdc++.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Include errno.h header to fix missing definition of -EEXIST error code:
src/libcamera/formats.cpp:43:11: error: use of undeclared identifier 'EEXIST'
Fixes: 1cf709b1d2bb ("libcamera: formats: Add ImageFormats")
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
The file uses the std::array class but doesn't include the corresponding
header. This breaks compilation with clang and libc++. Fix it.
Fixes: 63c578ed9993 ("libcamera: stream: Add StreamFormats")
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 we have V4L2Device and V4L2VideoDevice update the documentation
of the latter to use "video device" every time the term "device" was
used in the V4L2 context.
While at it clean up by removing a stale todo entry.
Documentation only change, no functional changes intended.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The V4L2 devices and subdevices share a few common operations,like
opening and closing a device node, and perform IOCTLs on the device.
With the forthcoming introduction of support for V4L2 controls, the
quantity of shared code will increase, as the control support
implementation is identical for the two derived classes.
To maximize code re-use and avoid duplications, provide a V4L2Device
base class which groups the common operations and members.
The newly introduced base class provides methods to open/close a device
node, access the file descriptor, and perform IOCTLs on the device.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
In preparation of creating a new V4L2Device base class, rename
V4L2Device to V4L2VideoDevice.
This is a project wide rename without any intended functional change.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.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>
|
|
Integer options have to use base 10. This isn't user-friendly when
specifying pixel formats. Detect the base automatically to support base
16. As a side effect, integer values starting with 0 will be interpreted
in base 8.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Extend the uvcvideo pipeline with format information and validation. The
format information is gathered by enumerating the v4l2 device. This
enumeration approach is valid for UVC as it has a static and simple
media graph.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add a new option to the cam tool that prints information about the
configuration supplied by the user. If the option is specified,
information about the configuration is printed after the configuration
has been verified and possibly adjusted by the camera.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Use CameraConfiguration::validate() to validate and possibly update the
camera configuration when its prepared.
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>
|
|
Most of the camera configuration preparation that is done in the
Capture module is not specific to capturing and could be useful for
other modules. Extract the generic parts to CamApp and do basic
preparation of the configuration before passing it to modules.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Test that both discrete and range based stream format descriptions
result in good discrete frame sizes. The range based stream formats
needs to be fitted with a table of resolutions inside libcamera so if
that table is updated this test might need to be updated.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Allow StreamFormats to be associated to a StreamConfiguration. The
intention is that pipeline handlers should associate formats to a
StreamConfiguration when it's created in generateConfiguration().
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add a StreamFormats class which describes all the formats supported by a
stream. The object does not collect any information itself but can
simplify user interactions with formats as it's able to translate a
stream format range into a discrete list and a discrete list to a range.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add methods to enumerate pixelformats and frame sizes from a V4L2
device. The interface is similar to how V4L2Subdevice enumerates mbus
codes and frame sizes.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Replace all usage of FormatEnum with ImageFormats and completely
remove FormatEnum which is no longer needed.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Align the enumPadSizes() interface and implementation with that of
enumPadCodes(). There is no functional change.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Simplify frame size enumeration by breaking out mbus code enumeration in
a helper, making the code easier to read while also preparing for
enhancing the frame size enumeration. There is no functional change.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add a new class to hold format information for V4L2 devices and
subdevices. The object describes the relationship between either pixel
formats (V4L2 devices) or media bus codes (V4L2 subdevice) and a list of
image sizes which can be produced with that format.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add a method to check if a Size can fit inside a SizeRange. When
determining if a size is containable take step values into account if
they are not set to 0.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
It's useful to be able to print a string representation of a SizeRange
to the log or console, add a toString() method. While at it turn the
structure into a class as it contains functions as well as data.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The size range described might be subject to certain step
limitations. Make it possible to record this information.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The SizeRange can describe a single size where min == max. Add a
constructor to help create such a description.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
As camera names can be cumbersome to type, selection of cameras by index
from a list can be useful. Print the list of detected cameras with an
index for each item, and interpret the camera name as an index if it is
a numerical value in the range from 1 to the number of cameras.
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 test to verify media bus codes, sizes and resolution retrieval
through the CameraSensor API based on the Sensor A in the vimc pipeline.
Also check that the getFormat() method returns the expected media bus
code and size.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
According to the documentation, the CameraSensor::getFormat() method
should select the first media bus code from the mbusCodes parameter that
is supported by the sensor. However, the current implementation wrongly
selects the first media bus code from the codes supported by the sensor
that is listed in the mbusCodes parameter. This results in the
preference order specified by the caller being ignored. Fix it.
Signed-off-by: Mickael Guene <mickael.guene@st.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
If the environment variable LIBCAMERA_IPA_MODULE_PATH is not set
utils::secure_getenv() will return a nullptr. Assigning a nullptr to a
std::string is not valid and results in a crash,
terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_M_construct null not valid
Fix this by operating directly on the returned char array instead of
turning it into a std::string.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Upstream commit 2978a505aaa981b2 ("media: vimc: stream: fix thread state
before sleep") changes the frame rate when capturing from the vimc raw
capture video nodes. The commit changes the frame rate from thousands of
frames per second to to roughly fifty.
The libcamera capture test was written with the assumption that vimc
would keep providing this fast frame rate and ran for a very short time
to decrease the overall run time of tests. This is no longer possible
and the test fails as it can't capture enough frames in its runtime,
increase the runtime to match the new vimc frame rate.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Match the style of the SizeRange() which specifies the hStep and vStep,
and wrap the lines in pairs of min and max values.
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Fix trivial spelling of queueing.
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The PipelineHandler::completeBuffer documentation repeats the word
'request'.
Remove the duplication and reformat the lines to fit.
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The cam utility does not terminate correctly if invoked with only
--help. It prints the help information and then segfaults due to the
application incorrectly handling the return value. Fix this by moving
the return code check of the option parsing to main().
Reported-by: Emmanuel Arias <eamanu@eamanu.com>
Suggested-by: Jacopo Mondi <jacopo@jmondi.org>
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 REGISTER_PIPELINE_HANDLER() macro defines and instantiates a
subclass of the PipelineHandlerFactory class that specialises the
virtual create() method. Now that create() does more than just creating
an instance, boilerplate code gets duplicated between different
factories.
Factor out the instance creation code to a new virtual createInstance()
method, and turn create() into a non-virtual method of the base class
that can then be defined in the .cpp file.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Three tests {capture,configuration_set,statemachine} override the
CameraTest::init() function, and call it as the first action.
However they were not checking the return value, and each of the tests
will segfault if the VIMC camera is not obtained.
Check the return value of the CameraTest base class initialisation and
return any errors to the test suite if initialisation fails.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
To avoid hardcoding a dependency between the source and build
directories, use absolute paths for the Doxygen EXCLUDE files. The build
directory can now be placed in any location, not just a direct
subdirectory of the source directory.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Instead of specifying the link arguments directly, which may be
compiler-specific, use a dependency object provided by find_library().
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Tested-by: Paul Elder <paul.elder@ideasonboard.com>
|
|
Make the vimc pipeline handler get the dummy IPA, to show how an IPA can
be acquired by a pipeline handler.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Use the dummy IPA for testing/sample IPA instead of the earlier test
IPA. Remove the test IPA, and update tests and meson accordingly.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|