Commit graph

2470 commits

Author SHA1 Message Date
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
Sebastian Fricke
1456efe7d5 ipa: rkisp1: Do not set controls during configure
Do not send events back to the pipeline handler, while the IPA thread
has not been started.

If information needs to be returned from configure it should be returned
directly.

Move the initial call to setControls() out of configure() and into the
start() method which is called after the IPA running_ state is updated.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-27 14:27:45 +00:00
Laurent Pinchart
92cad298fb libcamera: camera_manager: Document the CameraManager destructor
The destructor stops the camera manager if it is running. This is at the
moment an implementation detail, but makes sense to guarantee in the
API. Document it.

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>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-03-25 19:37:03 +02:00
Laurent Pinchart
02f56c5e5e Documentation: contributing: Add link to bugs.libcamera.org
Reference the issue tracker in the documentation, as relying on tribal
knowledge isn't a great option.

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>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-03-25 19:34:58 +02:00
Laurent Pinchart
c2943a6e32 android: meson: Remove unneeded android_enabled check
We return early with subdir_done() if android_enabled is false. There's
no need to check the variable later in the file.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-25 19:34:54 +02:00
Hirokazu Honda
82b8151aa7 android: CameraDevice: Mark getResultMetadata() const function
CameraDevice::getResultMetadata() doesn't change either
|descriptor| and member variables. It should be marked as a
const function and |descriptor| should be passed with const
lvalue reference.

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-03-25 19:34:54 +02:00
Hirokazu Honda
f101cc6878 android: CameraDevice: Manage requestTemplates_ with std::unique_ptr
CameraMetadata stored in requestTemplates_ in CameraDevice is
not necessary to be a raw pointer. This reduces the manual
new/delete code by changing the type to std::unique_ptr.

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-03-25 00:45:27 +02:00
Hirokazu Honda
dca709c44a android: CameraDevice: Manage staticMetadata_ with std::unique_ptr
staticMetadata_ in CameraDevice is not necessary to be a raw
pointer. This reduces the manual new/delete code by changing the
type to std::unique_ptr.

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-03-25 00:45:27 +02:00
Hirokazu Honda
17a6e78e00 android: Camera3RequestDescriptor: Manage buffers with std::vector
Camera3RequestDescriptor has a length and an allocated buffer
for camera_stream_buffer_t array. This replaces the variables
with std::vector.

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-03-25 00:45:27 +02:00
Hirokazu Honda
14b262dacf android: CameraDevice: Return const shared_ptr& by camera()
CameraDevice::camera() originally returns shared_ptr. It is
mandatory to make a copy by calling camera() in this way. There
is no need of copying if a caller needs the reference of the
camera like const shared_ptr<Camera> &cam = camera(). That is, it
is a caller that copying is required. This changes the return
type of camera() to const shared_ptr&, so that we are able to
reduce one redundant copy in the above case.

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-03-25 00:45:26 +02:00
Hirokazu Honda
9538ce4cc6 android: CameraDevice: Take shared_ptr in constructor
CameraDevice takes the ownership of Camera. Therefore,
shared_ptr would rather be used than const shared_ptr&.

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-03-25 00:45:26 +02:00
Hirokazu Honda
1636d4c438 android: CameraHalManager: Fix a function call of a moved Camera
libcamera::Camera::id() is called after std::move() in
cameraAdded(). This fixes the issue by not executing std::move().

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-03-25 00:45:26 +02:00
Hirokazu Honda
10518882f3 android: CameraHalManager: Hold CameraManager with std::unique_ptr
CameraManager is owned by CameraHalManager. The ownership of the
object is not shared with other classes. So CameraHalManager
should manage CameraManager with std::unique_ptr.

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-03-25 00:45:26 +02:00
Hirokazu Honda
212f410c7c android: CameraHalManager: Hold CameraDevice with std::unique_ptr
CameraDevice is owned by CameraHalManager. The ownership of the
object is not shared with other classes. So CameraHalManager
should manage CameraDevice with std::unique_ptr.

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-03-25 00:45:25 +02:00
Kieran Bingham
1d8cc0a3ec libcamera: v4l2_videodevice: Prevent queueing buffers without a cache
The V4l2 buffer cache allows us to map incoming buffers to an instance
of the V4L2 buffer required to actually queue.

If the cache_ is not available, then the buffers required to allow
queuing to a device have been released, and this indicates an issue at
the pipeline handler.

This could be a common mistake, as it could happen if a pipeline handler
always requeues buffers to the device after they complete, without
checking if they are cancelled.

Catch any invalid queueing of buffers to the V4L2 video device when
resources have been released by adding a Fatal log message to highlight
the error during development.

Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-24 22:20:06 +00:00
Kieran Bingham
500e99174a ipa: ipu3: Do not set controls during configure
The configure operation is synchronous and should not send events back
to the pipeline handler.

If information needs to be returned from configure it should be handled
through the interface directly.

Move the initial call to setControls() out of configure() and into the
start() method which is called after the IPA running_ state is updated.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-24 22:20:05 +00:00
Kieran Bingham
6bf86aa260 libcamera: pipeline: ipu3: frames: Associate buffers with the request
Ensure that the buffers are associated with the request even if they are
used internally to be able to correctly map back to the resources they
are being used to fulfil.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-24 22:20:05 +00:00
Kieran Bingham
552ac5cfec libcamera: pipeline: ipu3: frames: Group FrameBuffer operations
Ensure that checks on resource availability are handled first, and then
operate on the queues only after the resources are confirmed as
available.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-24 22:20:05 +00:00
Kieran Bingham
597c67120e libcamera: pipeline: ipu3: Do not mark metadata complete early
When the imguOutputBufferReady() detects a cancelled frame, it is
reporting that the metadata has been processed in order to be able to
complete the cancelled request.

This causes the FrameInfo to be completed and deleted early, but then an
active buffer on the IMGU can complete and be unable to find the
FrameInfo for it to complete correctly.

Do not mark metadataProcessed early on the event that a single buffer is
detected as cancelled. The stopping of the V4L2 devices will ensure
that all queued buffers are returned to us and we can follow the normal
and expected shutdown sequence.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-24 22:20:05 +00:00
Kieran Bingham
4ce1a33e4b libcamera: pipeline: ipu3: Stop IPA before stopping devices
The IPA should be stopped before the hardware devices to ensure that
all asynchronous actions have completed within the IPA before resources
are removed and released.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-24 22:20:05 +00:00
Laurent Pinchart
b50c12bf18 utils: ipc: proxy: Process pending messages
Events may be queued to the pipeline handler between the pipeline
handler entering the ::stop() function, and before the call to stop the
IPA has completed.

Handle these events by dispatching all pending messages at the proxy
after the IPA has fully stopped.

Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-24 09:24:06 +00:00
Laurent Pinchart
f041482add utils: ipc: proxy: Assert asynchronous calls execute in the running state
Signals and calls from the IPA should not occur after the IPA has been
put into the stopped state.

Add assertions to catch and prevent any messages being processed after
this.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-24 09:24:06 +00:00
Laurent Pinchart
c7dd9655e5 meson: Add configuration option to build the cam application
Building the cam application isn't always desired, for instance in a
production environment that only needs the libcamera library. Add a
meson option to disable it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-23 19:15:55 +02:00
Laurent Pinchart
976e01d59b meson: Use subdir_done() to reduce indentation
Reduce the indentation in the gstreamer and qcam meson.build with
subdir_done(). This follows similar patterns in cam and v4l2.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-23 19:15:44 +02:00
Naushir Patuck
787852a240 ipa: raspberrypi: Rationalise parameters to ipa::configure()
Rename ConfigInput to IPAConfig to be more consistent with the naming,
and remove ConfigInput::op, as it is never used.

Replace ConfigOutput with a ControlList type, as that is the only return
type from ipa::configure().

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-03-23 18:43:59 +02:00
Naushir Patuck
b876c64613 ipa: raspberrypi: Rationalise parameters to ipa::start()
Separate out the in and out parameters in ipa::start() as they are not
the same. This function now takes in a ControlList and returns out a
struct StartConfig which holds a ControlList and drop frame count for
the pipeline handler to action.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-03-23 18:43:59 +02:00
Naushir Patuck
8ccddecc94 ipa: raspberrypi: Remove unused member variable
The lastMode_ member variable is now unused, so remove it.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-03-23 18:43:59 +02:00
Naushir Patuck
256b1e0302 ipa: raspberrypi: Move the controller initialise to ipa::init()
The controller initialise is a one-off operation, so move it from
ipa::configure() to ipa::init().

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-03-23 18:43:59 +02:00
Naushir Patuck
90ac9849f4 pipeline: raspberrypi: Conditionally open the embedded data node
Conditionally open the embedded data node in pipeline_handler::match()
based on whether the ipa::init() result reports if the sensor supports
embedded data or not.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-03-23 18:43:59 +02:00
Naushir Patuck
eec070039d pipeline: ipa: raspberrypi: Open the CamHelper on ipa::init()
Move the opening of the CamHelper from ipa::configure() to ipa::init().
This allows the pipeline handler to get the sensor specific parameters
in pipeline_handler::match() where the ipa is initialised.

Having the sensor parameters available earlier will allow selective
use of the embedded data node in a future change.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-03-23 18:43:58 +02:00
Naushir Patuck
ff9f60ce3f ipa: Add sensor model string to IPASettings
Pass the sensor model string to the IPA init() method through the
IPASettings structure.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-03-23 18:43:58 +02:00
Paul Elder
500c9a1f98 android: Return -EUSERS when failed to open a Camera that's in use
The correct return value for the HAL for hal_dev_open() when trying to
open a camera that's already opened is EUSERS. Make hal_dev_open()
return -EUSERS, and plumb the logic for this through
CameraHalManager::open().

This allows the following CTS tests to pass:
- android.hardware.camera2.cts.CameraManagerTest#testCameraManagerOpenAllCameras
- android.hardware.camera2.cts.MultiViewTest#testDualCameraPreview

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-03-23 19:23:21 +09:00