Commit graph

2501 commits

Author SHA1 Message Date
Laurent Pinchart
c244d07286 test: span: Add tests for begin() and rbegin()
Verify that the begin() and rbegin() iterators (and their const version)
reference the correct values. The end() and rend() iterators can't be
tested the same way as they're not dereferenceable.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-15 22:23:02 +03:00
Jacopo Mondi
c3269524e4 libcamera: camera_sensor: Demote error message
The CameraSensor class is noisy enough in reporting the missing
sensor driver features.

Demote an error message about defaulting the active sensor area when
retrieving the camera sensor info to a warning.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-04-15 15:52:53 +02:00
Sebastian Fricke
47a159234f ipa: raspberrypi: cam_helper: Remove duplicate words
Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-04-15 01:52:54 +03:00
Laurent Pinchart
df1d955d24 libcamera: log: Use compiler builtins to retrieve file and line number
Replace the __FILE__ and __LINE__ values passed to the _log() function
with default parameters, taking their values from the __builtin_FILE()
and __builtin_LINE() functions. This moves handling of the file and line
from the preprocessor to the compiler, which is generally preferred as
it increases type safety.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Sebastian Fricke <sebastian.fricke@posteo.net>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-15 00:04:54 +03:00
Laurent Pinchart
93be96431a libcamera: log: De-duplicate _log() functions and LogMessage constructor
The _log() functions, as well as the LogMessage constructor, exist in
two versions, one that takes a log category, and one that doesn't. The
latter uses the default log category. This can be simplified by passing
a LogCategory pointer to _log(), which can then be null for the default
category, and moving the retrieval of the default log category from the
LogMessage constructor to the _log() function.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Sebastian Fricke <sebastian.fricke@posteo.net>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-15 00:04:54 +03:00
Laurent Pinchart
304ea65551 libcamera: pipeline_handler: Fix typo in documentation
There's no CameraConfiguration::valid(), the correct function is
CameraConfiguration::validate().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Sebastian Fricke <sebastian.fricke@posteo.net>
2021-04-15 00:04:54 +03:00
Nícolas F. R. A. Prado
e51926f07b libcamera: pipeline: rkisp1: Allow requests to be cancelled
Previously when a frame got cancelled, the frameInfo flags
metadataProcessed and paramDequeued wouldn't get set, meaning that the
request wasn't able to be completed and cancelled.

Make sure that these flags are set when the frame gets cancelled so that
the request can be cancelled.

This issue happened while running lc-compliance.

Suggested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2021-04-14 16:33:11 +02:00
Nícolas F. R. A. Prado
63dd6a8327 libcamera: pipeline: rkisp1: Assert empty queuedRequests before clearing frameInfo
Assert that there are no queued requests before clearing the frameInfo,
otherwise a SEGFAULT can occur.

This issue happened while running lc-compliance.

Suggested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2021-04-14 16:33:09 +02:00
Nícolas F. R. A. Prado
330ea9d946 libcamera: pipeline: rkisp1: Stop IPA before streams
The IPA should be stopped before stopping the streams in order to avoid
a "No BufferCache available to queue" issue.

This issue happened while running lc-compliance.

Suggested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2021-04-14 16:32:54 +02:00
Niklas Söderlund
58f558fdda lc-compliance: Drop return value from SimpleCapture::stop()
The return value is never checked and serves to real usage, drop it.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-04-14 16:13:18 +02:00
Niklas Söderlund
6c96861ea3 lc-compliance: Initialize the event loop pointer
The event loop pointer loop_ was not initialized. This has no effect on
the current code flow but could in the future lead to hard debug
problems.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-04-14 16:13:18 +02:00
Phi-Bang Nguyen
0373490ef6 pipeline: simple: Fix an issue in breadth-first search
When seting up the pipeline, the latest entity in the queue is
taken but the oldest one is poped. This is a mistake. Fix it.

Fixes: 4671911df0 ("pipeline: simple: Use breadth-first search to setup media pipeline")
Signed-off-by: Phi-Bang Nguyen <pnguyen@baylibre.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-04-14 02:14:41 +03:00
Kieran Bingham
c8cfa6650d libcamera: pipeline_handler: Document requestSequence_
The documentation for requestSequence_ was not added when the sequence
number was implemented.

Provide it.

Fixes: d874b3e341 ("libcamera: request: Provide a sequence number")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-13 20:55:40 +01:00
Kieran Bingham
1c9f2d7889 libcamera: ipa_proxy: Document ProxyState
The documentation for the ProxyState and tracking variable was not added
when the IPA was extended with a state machine.

Add it.

Fixes: 70238ceca5 ("utils: ipc: proxy: Track IPA with a state machine")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-13 20:55:40 +01:00
Kieran Bingham
296a903fe3 libcamera: ipa_proxy: Scope ProxyState to IPAProxy
The ProxyState is only used by the IPAProxy, so it should remain inside
that scope.  This helps clarify the usage, and improves the
documentation by bringing the (future) ProxyState documentation into the
class.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-13 20:52:19 +01:00
Laurent Pinchart
05b8022601 test: threads: Fix memory leak
The last instance of Thread allocated in the test is never deleted, nor
are other instances deleted in error paths. Use a std::unique_ptr<> to
ensure deletion.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Tested-by: Sebastian Fricke <sebastian.fricke@posteo.net>
2021-04-12 22:16:56 +03:00
Laurent Pinchart
9b2544d3df libcamera: bound_method: Fix type of pack for void methods
The BoundMethodPack used by the void BoundMethodArgs variant incorrectly
specified the template argument as void * instead of void. This causes
no functional problem, but results in space for an unused void * return
value being reserved. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Fricke <sebastian.fricke@posteo.net>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-12 22:16:52 +03:00
Niklas Söderlund
210b811047 lc-compliance: Add test stopping single stream with requests queued
Add a test which stops a camera while requests are still queued. This
intends to test cleanup paths where requests are dequeued from video
devices in an uncompleted state.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
2021-04-12 10:48:56 +02:00
Niklas Söderlund
02bc110857 lc-compliance: Add a libcamera compliance tool
Add a compliance tool to ease testing of cameras. In contrast to the
unit-tests under test/ that aims to test the internal components of
libcamera the compliance tool aims to test application use-cases and to
some extent the public API.

This change adds the boilerplate code of a simple framework for the
creation of tests. The tests aim both to demonstrate the tool and to
catch real problems. The tests added are:

 - Test that if one queues exactly N requests to a camera exactly N
   requests are eventually completed.

 - Test that a configured camera can be started and stopped multiple
   times in an attempt to exercise cleanup code paths otherwise not
   often tested with 'cam' for example.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
2021-04-12 10:48:56 +02:00
Umang Jain
43ab65df8d libcamera: camera_manager: Remove \todo on hotplug/unplug of cameras
Fixes: e9b47217b4 ("libcamera: camera_manager: Introduce signals when a camera is added or removed")
Signed-off-by: Umang Jain <email@uajain.com>
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>
2021-04-07 18:56:32 +03:00
Sebastian Fricke
41d7810436 libcamera: thread: Fix typo in comment
s/This method enter/This method enters/

Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-04-07 11:54:45 +03:00
Vedant Paranjape
76a5861f3e Add alternative meson install command
While installing meson using pip3 install --user meson, due to python
path issues, build.ninja can't be located by ninja. meson generates
ninja files fine, but then when you run ninja, it is unable to find
meson's build.ninja python module due to path issues.
It gives the following error on ninja -C build install:

ninja: Entering directory `build'
ninja: error: loading 'build.ninja': No such file or directory

After uninstalling meson using pip3 and installing it again using pip
without --user argument solved the issue.

Add a troubleshooting section to the readme to describe this issue and
suggest possible solutions.

Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
2021-04-05 13:42:49 +09:00
Hirokazu Honda
c85b6c849f android: CameraDevice: Deny non ROTATION_0 stream configuration
libcamera doesn't handle crop_rotate_scale_degrees. Therefore,
if it is requested, that is, crop_rotate_scale_degrees is not
CAMERA3_STREAM_ROTATION_0, the configuration should fail.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-04-04 04:02:18 +03:00
Hirokazu Honda
ac209efabf android: CameraDevice: Log rotation variables in camera3_stream
|rotation| and |crop_rotate_scale_degrees| are important info of
a configuration. They should be logged.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-04-04 04:02:18 +03:00
Hirokazu Honda
4ae2a75200 android: CameraDevice: Validate crop_rotate_scale_degrees in configuration
libcamera doesn't handle |crop_rotate_scale_degrees| in
camera3_stream at all. This adds the validation of the requested
|crop_rotate_scale_degrees| in configuration, but still not
handle the specified values.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-04-04 04:02:16 +03:00
Hirokazu Honda
185574b741 android: Define OS_CHROMEOS macro if android_platform=cros
Android Camera HAL 3 API used in ChromeOS has a ChromeOS own
extension, for example, crop_rotate_scale_degrees in
camera3_stream. As those extensions are not available on Android
platforms, introduce a OS_CHROMEOS macro that can be used to
compile CrOS-specific code conditionally. The macro is defined
if and only if android_platform is 'cros'.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-04-04 03:00:01 +03:00
Laurent Pinchart
cc0dc7f611 android: mm: cros: Fix compilation
Commit 7d78798338 ("android: mm: cros: Handle buffer registration
failure") mistakenly tried to initialize the CameraBuffer::Private
registered member variable instead of registered_. This reults in a
compilation failure. Fix it.

Fixes: 7d78798338 ("android: mm: cros: Handle buffer registration failure")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-04-04 03:00:01 +03:00
Hirokazu Honda
90a0430abc android: CameraDevice: Add more camera3_capture_request validation
This adds more validation to camera3_capture_request mainly
about buffer_handle values.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-04-04 01:47:32 +03:00
Hirokazu Honda
7633a2d24d android: cameraDevice: Factorize the code of validating camera3_capture_request
CameraDevice::processCaptureRequest() checks the validity of a
provided camera3_capture_request. This factorizes the code in
order to add more validation to the request later.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
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>
2021-04-04 01:47:09 +03:00
Hirokazu Honda
d13462f3d0 android: CameraDevice: Deny if the streams is empty
This checks if the number of streams is zero on configuration
and then returns -EINVAL.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-04-04 01:38:21 +03:00
Hirokazu Honda
7d78798338 android: mm: cros: Handle buffer registration failure
cros::CameraBufferManager::Register() fails if a buffer handle
is invalid. We should mark CameraBuffer as invalid on the failure
of Register().

While the cros::CameraBufferManager Unlock() and Deregister() functions
should be able to handle buffers that haven't been locked and
registered, this isn't an API guarantee, and errors will be logged.
Avoid this by skipping unlocking and unregistration of buffers that
haven't been locked or registered.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-04-04 01:18:49 +03:00
Hirokazu Honda
cbb580d5af libcamera: pipeline_handler: Make queueRequest() void function
PipelineHandler::queueRequest() is asynchronously invoked in
Camera::queueRequest(). Therefore the return value of
PipelineHandler::queueRequest() is useless. This changes the
function to a void function.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-04-03 04:05:57 +03:00
Laurent Pinchart
ef2213fdb6 Documentation: Add getting started section
Pull the "getting started" of README.rst in the documentation tree, as
done on libcamera.org, to ensure documentation build coverage of the
whole README.rst.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-03 04:03:37 +03:00
Phi-Bang Nguyen
8634c38675 android: camera_device: Add null check for ScalerCrop control
The ScalerCrop control does not contain the null check which can cause
the camera HAL crash at boot. Fix it.

Fixes: 31a1a628cd ("android: camera_device: Register MAX_DIGITAL_ZOOM")
Signed-off-by: Phi-Bang Nguyen <pnguyen@baylibre.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-03-29 23:49:33 +03:00
Laurent Pinchart
0e39510c05 libcamera: thread: Remove the unused setEventDispatcher() function
Custom event dispatchers for threads was an API meant to provide a way
to integrate libcamera in the application's event loop. This isn't used
anymore, as libcamera now creates internal threads. Drop the unused
Thread::setEventDispatcher() function, and update the documentation
accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-29 23:49:33 +03:00
Sebastian Fricke
6b98965877 ipa: raspberrypi: Fix typo and improve wording
s/Return the validated limits out though metadata./
  Return the validated limits via metadata./

Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-03-29 23:49:33 +03:00
Sebastian Fricke
e99fc4b0d5 pipeline: raspberrypi: Remove unused getFormat call
The comment states, that we get the device format to pass it to the IPA,
but the variable `sensorFormat` is not used again after it's assignment.
Remove it, together with the comment.

Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-03-29 23:49:33 +03:00
Kieran Bingham
6084217cd3 libcamera: pipeline: ipu3: frames: Use the request sequence
For all frame indexes, use the same sequence number as generated
by the Request object.

This allows clear matching of what operations occurred to which request.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-29 12:48:14 +01:00
Kieran Bingham
aa7d4ebf96 libcamera: camera: Extend with a Stopping state
When the camera is being stop()ped, active requests will complete. These
may trigger an application to re-queue those requests to the camera but
that is not permitted, and is an error in the application.

Extend the camera state to include a stopping state which is entered as
soon as a call to stop() is made. At this point, any request queued will
be rejected with a warning, while any pending requests are either
successfully completed or cancelled.

When the pipeline handler has finished stopping, the camera state will
transition to the CameraConfigured state where it can begin to accept
requests again, and be restarted.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-29 12:33:51 +01:00
Kieran Bingham
651e3fab63 libcamera: camera: Report function which fails access control
The camera object has a state machine to ensure calls are only made
when in the correct state. It isn't easy to identify where things happen
when assertions fail so add extra information to make this clearer.

The error level of the isAccessAllowed is raised from Debug to Error as
this is important information for applications to know if they have made
a request in an invalid state.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-29 12:33:50 +01:00
Kieran Bingham
5718b4d5b7 libcamera: camera: Validate requests are completed in Running state
All requests must have completed before the Camera has fully stopped.

Requests completing when the camera is not running represent an internal
pipeline handler bug.

Trap this event with a fatal error.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-29 12:33:50 +01:00
Kieran Bingham
1dfb8d45dc libcamera: request: Add a toString()
Provide a toString helper to assist in printing Request state
for debug and logging contexts.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-29 12:18:02 +01:00
Kieran Bingham
d874b3e341 libcamera: request: Provide a sequence number
Provide a sequence number on Requests which are added by the pipeline
handler.

Each pipeline handler keeps a requestSequence per CameraData and
increments everytime a request is queued on that camera.

The sequence number is associated with the Request and can be utilised
for assisting with debugging, and printing the queueing sequence of in
flight requests.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-29 12:18:02 +01:00
Kieran Bingham
dcc024760a libcamera: buffer: Break friendship with Request
The FrameBuffer class is only friends with Request so that the request
can be associated with the buffers.

FrameBuffer already has a helper to setRequest(), so let's use that
directly instead.

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-29 12:18:02 +01:00
Kieran Bingham
70238ceca5 utils: ipc: proxy: Track IPA with a state machine
Asynchronous tasks can only be submitted while the IPA is running.

Further more, the shutdown sequence can not be tracked with a simple
running flag. We can also be in the state 'Stopping' where we have not
yet completed all events, but we must not commence anything new.

Refactor the running_ boolean into a stateful enum to track this.

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-29 12:18:02 +01:00
Laurent Pinchart
e7d367bf65 libcamera: pipeline: ipu3: Fix typos
Fix two simple typos.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Fricke <sebastian.fricke@posteo.net>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2021-03-29 07:09:13 +03:00
Khem Raj
299e8ef563 pipeline: uvcvideo: Avoid reference to temporary object
A range-based for loop whose range expression is an array of char
pointers and range variable declaration is a const reference to a
std::string creates a temporary string from the char pointer and binds
the range variable reference to it. This creates a const reference to a
temporary, which is valid in C++, and extends the lifetime of the
temporary to the lifetime of the reference.

However, lifetime extension in range-based for loops is considered as a
sign of a potential issue, as a temporary is created for every
iteration, which can be costly, and the usage of a reference in the
range declaration doesn't make it obvious that the code isn't simply
binding a reference to an existing object. gcc 11, with the
-Wrange-loop-construct option, flags this:

uvcvideo.cpp:432:33: error: loop variable 'name' of type 'const string&' {aka 'const std::__cxx11::basic_string<cha
r>&'} binds to a temporary constructed from type 'const char* const' [-Werror=range-loop-construct]
|   432 |         for (const std::string &name : { "idVendor", "idProduct" }) {
|       |                                 ^~~~

To please the compiler, make the range variable a const char *. This may
bring a tiny performance improvement, as the name is only used once, in
a location where the compiler can use

	operator+(const std::string &, const char *)

instead of

	operator+(const std::string &, const std::string &)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Use a const char * type instead of auto, and update the commit message
accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-03-28 22:56:31 +03:00
Sebastian Fricke
3d3e6fcdb9 pipeline: raspberryPi: Fix typo in comment
s/Will need to/We'll need to/

Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-03-28 19:53:12 +03:00
Sebastian Fricke
6a84c56346 ipa: raspberrrypi: Remove duplicate comment
The exact same comment is used two times within 5 lines.
Remove one of them as it is redundant.

Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-03-28 19:53:12 +03:00
Laurent Pinchart
b68721608a meson: Summarize which applications and adaptation layers are built
Add the application and adaptation layers being built to the meson
summary. The summary now prints

libcamera 0.0.0

  Configuration
         Enabled pipelines: ipu3
                            raspberrypi
                            rkisp1
                            simple
                            uvcvideo
                            vimc

           Android support: True
         GStreamer support: True
    V4L2 emulation support: True
           cam application: True
          qcam application: True
                Unit tests: True

  Subprojects
                    libyuv: YES

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
2021-03-28 01:47:26 +02:00