Commit graph

898 commits

Author SHA1 Message Date
Laurent Pinchart
6f0c4d0742 utils: checkstyle.py: Add meson.build checker
Add a meson.build checker that warns when tabs are used.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-07-01 02:24:21 +03:00
Laurent Pinchart
bc6b758c71 utils: checkstyle.py: Refactor formatters and checkers support
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>
2019-07-01 02:24:21 +03:00
Niklas Söderlund
0116a940ba libcamera: v4l2_device: Fix variable-sized object initialization
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: eb068f4e67 ("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>
2019-06-30 13:49:52 +02:00
Jacopo Mondi
6948ec44c7 libcamera: v4l2_device: Fix control enumeration bug
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: 030ce6491e ("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>
2019-06-27 10:16:10 +02:00
Kieran Bingham
caf25dc5cf libcamera: event_dispatcher_poll: Remove struct keyword from for-range
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: 8356f8a6ab ("libcamera: Add a poll-based event dispatcher")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-06-25 21:35:23 +01:00
Helen Koike
059ed93beb cam: capture: Stop stream when queueRequest() fails
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>
2019-06-25 20:40:41 +01:00
Jacopo Mondi
cb21bb3311 libcamera: ipu3: Set pipe_mode based on stream configuration
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>
2019-06-25 14:03:49 +02:00
Jacopo Mondi
3ef81b7f7f libcamera: camera_sensor: Add V4L2 control operations
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>
2019-06-25 14:01:47 +02:00
Jacopo Mondi
eb068f4e67 libcamera: v4l2_device: Implement get and set controls
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>
2019-06-25 14:01:37 +02:00
Jacopo Mondi
030ce6491e libcamera: v4l2_device: List valid controls at open
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>
2019-06-25 14:01:35 +02:00
Jacopo Mondi
bab8b01895 libcamera: Add V4L2Controls
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>
2019-06-25 14:01:17 +02:00
Laurent Pinchart
8b7a24e20f meson: Link against libc++ with compiling with clang
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>
2019-06-19 18:47:56 +03:00
Jacopo Mondi
d78fbdba87 libcamera: formats: Add missing include
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: 1cf709b1d2 ("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>
2019-06-19 17:25:17 +02:00
Laurent Pinchart
329b38d254 libcamera: stream: Include missing array header
The file uses the std::array class but doesn't include the corresponding
header. This breaks compilation with clang and libc++. Fix it.

Fixes: 63c578ed99 ("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>
2019-06-19 17:51:12 +03:00
Jacopo Mondi
e32d82e655 libcamera: v4l2_videodevice: Update documentation
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>
2019-06-19 15:46:44 +02:00
Jacopo Mondi
d6bb56a90a libcamera: Introduce V4L2Device base class
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>
2019-06-19 15:46:44 +02:00
Jacopo Mondi
3a6c4bd146 libcamera: Rename V4L2Device to V4L2VideoDevice
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>
2019-06-19 15:46:44 +02:00
Laurent Pinchart
20807a8c17 cam: Support base 16 and base 8 when parsing integer options
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>
2019-06-19 16:04:35 +03:00
Niklas Söderlund
b4f3fc1d56 libcamera: pipeline: uvcvideo: Add format information and validation
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>
2019-06-19 12:25:12 +02:00
Niklas Söderlund
802d47068b cam: Add --info option to print information about stream(s)
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>
2019-06-19 12:25:12 +02:00
Niklas Söderlund
7c856201c7 cam: Validate camera configuration
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>
2019-06-19 12:25:12 +02:00
Niklas Söderlund
afef18d35a cam: Move camera configuration preparation to CamApp
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>
2019-06-19 12:25:12 +02:00
Niklas Söderlund
5ed3a89480 test: stream: Add test for StreamFormat
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>
2019-06-19 12:25:12 +02:00
Niklas Söderlund
a502896429 libcamera: stream: StreamConfiguration: Add StreamFormats information
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>
2019-06-19 12:24:23 +02:00
Niklas Söderlund
63c578ed99 libcamera: stream: Add StreamFormats
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>
2019-06-19 12:14:37 +02:00
Niklas Söderlund
87e46f7f59 libcamera: v4l2_device: Add enumeration of pixelformats and frame sizes
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>
2019-06-19 11:54:30 +02:00
Niklas Söderlund
ce02ea29cd libcamera: v4l2_subdevice: Replace FormatEnum with ImageFormats
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>
2019-06-19 03:06:33 +02:00
Niklas Söderlund
be78ffbe9a libcamera: v4l2_subdevice: Rework enumPadSizes()
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>
2019-06-19 02:47:06 +02:00
Niklas Söderlund
3e51cc30bf libcamera: v4l2_subdevice: Breakout mbus code enumeration
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>
2019-06-19 02:44:04 +02:00
Niklas Söderlund
1cf709b1d2 libcamera: formats: Add ImageFormats
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>
2019-06-19 02:42:56 +02:00
Niklas Söderlund
22e0005fdd libcamera: geometry: SizeRange: Add contains()
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>
2019-06-19 02:23:01 +02:00
Niklas Söderlund
6bd094ad68 libcamera: geometry: SizeRange: Add toString()
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>
2019-06-19 02:20:11 +02:00
Niklas Söderlund
ed56f16c4b libcamera: geometry: SizeRange: Extend with step information
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>
2019-06-19 02:17:54 +02:00
Niklas Söderlund
85a9b66134 libcamera: geometry: SizeRange: Add constructor for a single size
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>
2019-06-19 01:44:51 +02:00
Laurent Pinchart
c6090542cd cam: Allow selecting cameras by index
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>
2019-06-18 23:34:03 +03:00
Laurent Pinchart
b2b3599b5b tests: Add CameraSensor class test
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>
2019-06-12 15:10:38 +03:00
Mickael Guene
846d4c7d3e libcamera: Fix CameraSensor::getFormat() search order
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>
2019-06-11 17:04:09 +03:00
Niklas Söderlund
cefe067c5b libcamera: ipa_manager: Fix handling of unset LIBCAMERA_IPA_MODULE_PATH
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>
2019-06-11 15:56:36 +02:00
Niklas Söderlund
d9a468aaac test: camera: Increase runtime for capture test
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>
2019-06-11 15:56:36 +02:00
Kieran Bingham
c544506e1a libcamera: geometry: Fix SizeRange constructor style
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>
2019-06-11 09:29:13 +01:00
Kieran Bingham
4232b60612 libcamera: pipeline: ipu3: Fix spelling
Fix trivial spelling of queueing.

Acked-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-06-11 09:29:00 +01:00
Kieran Bingham
a0f869f4ed libcamera: pipeline: Fix 'request' grammar
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>
2019-06-11 09:28:39 +01:00
Niklas Söderlund
238919be59 cam: Fix cam --help crash
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>
2019-06-10 23:05:04 +02:00
Laurent Pinchart
3353400027 libcamera: pipeline_handler: Optimise factory implementation
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>
2019-06-10 17:29:27 +03:00
Kieran Bingham
339e9b2d97 test: camera: Fix initialisation
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>
2019-06-10 12:29:40 +01:00
Laurent Pinchart
255e583857 Documentation: Use absolute paths for Doxygen EXCLUDE files
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>
2019-06-09 13:22:17 +03:00
Laurent Pinchart
a87c63c7e9 libcamera: Use dependency instead of link_args to link against libdl
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>
2019-06-08 13:43:32 +03:00
Paul Elder
5733879864 libcamera: pipeline: vimc: add dummy IPA
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>
2019-06-05 10:44:52 -04:00
Paul Elder
87a93e17f8 libcamera: test: remove test IPA and use dummy IPA instead
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>
2019-06-05 10:44:52 -04:00
Paul Elder
dd5b899c5b libcamera: ipa: add dummy IPA implementation
Add a dummy IPA module.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-05 10:44:52 -04:00