Commit graph

2984 commits

Author SHA1 Message Date
Laurent Pinchart
c71691e66c cam: options: Disable copy for parsers
Copying the OptionsParser class would result in the optionsMap_ entries
pointing to Option entries of the original instance. As there's no use
case for copying the class, disable copying.

Disable copying of KeyValueParser as well for consistency as there's no
use case either.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-07-22 17:13:21 +03:00
Laurent Pinchart
a8f3a68ec9 cam: options: Slit OptionsParser::usage() in two functions
To prepare for code reuse, split the printing of options out of
OptionsParser::usage() to a separate function.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-07-22 17:13:20 +03:00
Laurent Pinchart
7c205c79d9 cam: options: Add optionName() function to Option structure
Add an Option::optionName() function that returns a string describing
the option name, with leading dashes. As a result,
OptionsParser::parseValueError() function becomes a single-line function
and can be inlined in its caller.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-07-22 17:13:18 +03:00
Laurent Pinchart
539820f5d6 cam: options: Move OptionValue class after OptionsParser
To prepare for usage of the OptionsParser::Options class in OptionValue,
move the definition of the OptionValue class after OptionsParser. There
is no functional change.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-07-22 17:13:16 +03:00
Laurent Pinchart
b938911884 cam: options: Document the options parser API
Before extending the option parser, document its existing API.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-07-22 17:13:13 +03:00
Laurent Pinchart
aeb6390418 cam: options: Move Option struct to options.cpp
The Option structure is an internal implementation detail and shouldn't
be exposed in the API. Move it to options.cpp. This requires moving the
inline constructors and destructors for the KeyValueParser and
OptionsParser classes to options.cpp as well, as they need a full
definition of the Option structure.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-07-22 17:13:11 +03:00
Laurent Pinchart
12cb9293fa cam: options: Make KeyValueParser::usage() private
The KeyValueParser::usage() function is meant to be called from an
OptionsParser or another KeyValueParser only. Make it private, and set
the OptionsParser class as a friend of the KeyValueParser class.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-07-22 17:13:07 +03:00
Heiko Stuebner
ab4932f87d ipa: rkisp1: Add support for V12 isp blocks
Some values for array sizes differ between v10 and v12, so set them
in init() and adjust the auto exposure algorithm to the ae value
from there.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-07-22 14:38:44 +02:00
Paul Elder
5468048b68 Documentation: guides: application-developer: update pkgconfig name
The pkgconfig name was changed from camera to libcamera, but the
application developer guide wasn't updated. Update it to refer to the
new name.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=65
Fixes: ec7afef6 ("libcamera: Rename libcamera pkg-config generation")
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-07-21 19:35:55 +09:00
Umang Jain
ab09913acb libcamera: v4l2_videodevice: Avoid extra construction of Framebuffer
While populating the V4L2BufferCache, avoid the extra construction of
FrameBuffer, which is currently done by passing the vector of
FrameBuffer::Planes. It is not wrong per se, but futile to have another
construction of FrameBuffer from a copy of buffer->planes() for the
corresponding Entry.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-07-19 18:41:08 +05:30
Laurent Pinchart
c73170388e libcamera: ipa_manager: Allow forcing IPA module isolation
For test purpose it's useful to run open-source IPA modules in
isolation. This can already be done by deleting the corresponding
signature file, but that method can be inconvenient. Add a way to force
IPA module isolation through a new LIBCAMERA_IPA_FORCE_ISOLATION
environment variable.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-07-19 08:20:37 +03:00
Laurent Pinchart
a5c81fc945 libcamera: ipa_manager: Split common code out of createIPA()
The createIPA() template function starts with code that doesn't depend
on the template parameters. Split it to a non-template function to avoid
code duplication in the binary.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-07-19 08:20:34 +03:00
Laurent Pinchart
8847715ccd libcamera: ipa_manager: Fix IPA module min/max version check
The IPAManager::createIPA() function has its minVersion and maxVersion
parameters inverted. This doesn't cause any issue at the moment as both
the minimum and maximum version are set to 1 by all callers, but it's
still a bug. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-07-19 08:20:13 +03:00
Jacopo Mondi
e8a28b4b9b libcamera: controls: Fix minor error in documentation
Fix a small spelling mistake in the ControlInfoMap documentation.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-07-16 12:50:54 +02:00
Vedant Paranjape
4889464fd8 libcamera: Add pixel format BGRX8888
This patch adds pixel format BGRX8888 to libcamera. Additionally adds
mapping of V4L2 pixel format (V4L2_PIX_FMT_XRGB32) to BGRX8888.

Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-07-16 00:16:08 +03:00
Vedant Paranjape
3715d1b21d libcamera: Fix the V4L2 pixel format for formats::XBGR8888
This patch fixes V4L2 pixel format for formats::XBGR8888 by updating
the existing matching to V4L2_PIX_FMT_RGBX32

Fixes: 4fd6bb33 ("libcamera: Add support for XRGB8888 and XBGR8888")
Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-07-16 00:15:53 +03:00
Jean-Michel Hautbois
ea0b199da7 libipa: Correct OV5670 CameraSensorHelper gain values
The datasheet states that the low 7 bits are fraction bits.
real_gain = GainCode/128
For example, 0x080 is 1x gain, 0x100 is 2x gain.

It means that we should have m0=1 and c1=128.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-07-15 17:27:33 +02:00
Jean-Michel Hautbois
bda10cae5e libipa: Add CameraSensorHelper for OV13858
Extend the CameraSensorHelper factory with support for an
OV13858 sensor as found in the Soraka Chromebook.

The datasheet states that low 7 bits are fraction bits, so the gain is
calculated as gainCode=128*gain.
According to the formula, it means m0=1 and c1=128.
m1 then has to be 0, and c0=0.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-07-15 17:27:23 +02:00
Jean-Michel Hautbois
35e23837fa ipa: raspberrypi: Remove unused MetadataPtr
The Metadata class defines a shared_ptr named MetadataPtr.  It is not
used anywhere in the source code, so remove it.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
2021-07-14 15:15:32 +02:00
David Plowman
eb9a539938 libcamera: raspberrypi: Allow the tuning file to be set by an environment variable
The configuration (camera tuning) file used by the Raspberry Pi comes
by default from the sensor name. However, we now allow this to be
overridden by the LIBCAMERA_RPI_TUNING_FILE environment variable.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Sebastian Fricke <sebastian.fricke@posteo.net>
Reviewed-by: Naushir Patuck <naush@raspberrypi.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-07-12 20:45:42 +03:00
Laurent Pinchart
d6d4710d04 libcamera: framebuffer: Make FrameBuffer class Extensible
Implement the D-Pointer design pattern in the FrameBuffer class to allow
changing internal data without affecting the public ABI.

Move the request_ field and the setRequest() function to the
FrameBuffer::Private class. This allows hiding the setRequest() function
from the public API, removing one todo item. More fields may be moved
later.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-07-12 19:59:22 +03:00
Laurent Pinchart
689811d87a libcamera: Drop the LIBCAMERA_D_PTR macro in favour of the _d() function
Now that all Extensible classes expose a _d() function that performs
appropriate casts, the LIBCAMERA_D_PTR brings no real additional value.
Replace it with direct calls to the _d() function.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-07-12 19:59:20 +03:00
Laurent Pinchart
a81ccba6a2 libcamera: base: class: Expose Extensible private data to other classes
Despite sharing the same name, the private data class created by the
Extensible design pattern and the C++ private access specifier have
different goals. The latter specifies class members private to the
class, while the former stores data not visible to the application.

There are use cases for accessing the private data class from other
classes inside libcamera. Make this possible by exposing public _d()
functions in the class deriving from Extensible. This won't allow access
to the private data by applications as the definition of the Private
class isn't visible outside of libcamera.

The _d() functions need to be defined as template functions to delay
their evaluation, as the static_cast() operator in the Extensible::_d()
functions needs the Private class to be fully defined. The template
argument is defaulted and ignored, as only its presence is required to
delay evaluation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-07-12 19:59:19 +03:00
Naushir Patuck
37e31b2c6b ipa: raspberrypi: Make variable names consistent
s/DefaultAnalogueGain/defaultAnalogueGain/
s/DefaultExposureTime/defaultExposureTime/

Change these for consistency with the other static const variables.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-07-12 15:57:17 +03:00
Naushir Patuck
523236e4ac ipa: raspberrypi: Increase the default max frame duration to 250s
With the recent change to allow long exposures on the imx477, the existing 100s
limit was not adequate.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-07-12 15:57:15 +03:00
Naushir Patuck
9c0f6a22a2 pipeline: raspberrypi: Use priority write for vblank when writing sensor ctrls
When directly writing controls to the sensor device, ensure that VBLANK is
written ahead of and before the EXPOSURE control. This is the same priority
write mechanism used in DelayedControls.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.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>
2021-07-12 15:57:12 +03:00
Naushir Patuck
6d89e33814 ipa: raspberrypi: Allow long exposure modes for imx477.
Update the imx477 CamHelper to use long exposure modes if needed.
This is done by overloading the CamHelper::GetVBlanking function to return a
frame length (and vblank value) computed using a scaling factor when the value
would be larger than what the sensor register could otherwise hold.

CamHelperImx477::Prepare is also overloaded to ensure that the "device.status"
metadata returns the right value if the long exposure scaling factor is used.
The scaling factor is unfortunately not returned back in metadata.

With the current imx477 driver, we can achieve a maximum exposure time of approx
127 seconds since the HBLANK control is read-only.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.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-07-12 15:57:10 +03:00
Naushir Patuck
2d6a9b3592 ipa: raspberrypi: Add frame_length to DeviceStatus
Store the frame length into the DeviceStatus struct. The value is extracted
from embedded data when available, or calculated from the VBLANK value passed
from DelayedControls otherwise.

Update imx477 and imx219 CamHelper classes to extract the frame length from the
embedded data buffer.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.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>
2021-07-12 15:57:07 +03:00
Naushir Patuck
f24d83720f ipa: raspberrypi: Add an operator<< to struct DeviceStatus
Add an operator<< overload to log all fields in DeviceStatus, and remove the
manual logging statements in the IPA and CamHelper.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
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-07-12 15:57:05 +03:00
Naushir Patuck
df8cafaf87 ipa: raspberrypi: Add a constructor struct DeviceStatus
The constructor sets all fields to 0. This replaces the memset(0) and default
value initialisation usage in the agc and lux controllers respectively.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.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>
2021-07-12 15:57:02 +03:00
Naushir Patuck
ace5e21feb ipa: raspberrypi: Make device_status.h C++ only header, and update comments
This header file is no longer C compatible, so remove the extern "C"
declaration.

Replace C++ style comments with C style based on libcamera guidelines.

There are no functional changes in this commit.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.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>
2021-07-12 15:56:57 +03:00
Laurent Pinchart
6a31a8d8e2 libcamera: buffer: Rename buffer.h to framebuffer.h
libcamera names header files based on the classes they define. The
buffer.h file is an exception. Rename it to framebuffer.h.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-07-11 17:42:02 +03:00
Laurent Pinchart
da9b6bb196 base: thread: Fix recursive calls to dispatchMessages()
There are use cases for calling the dispatchMessages() function
recursively, from within a message handler. This can be used, for
instance, to force delivery of messages posted to a thread concurrently
to stopping the thread. This currently causes access, in the outer
dispatchMessages() call, to iterators that have been invalidated by
erasing list elements in the recursive call, leading to undefined
behaviour (most likely double-free or other crashes).

Fix it by only erasing messages from the list at the end of the outer
call, identified using a recursion counter.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=26
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-07-11 17:42:02 +03:00
Laurent Pinchart
1f7f7a72ed test: message: Test recursive Thread::dispatchMessages() calls
The Thread::dispatchMessages() function needs to support recursive
calls, for instance to allow flushing delivery of invoked methods. Add a
corresponding test, which currently fails with a double free.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-07-11 17:41:59 +03:00
Laurent Pinchart
4c63bb4938 base: thread: Document the postMessage() function as thread-safe
The Thread::postMessage() function is thread-safe, document it as such.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-07-11 17:22:49 +03:00
Jean-Michel Hautbois
f23f3922b3 ipa: libipa: Fixups in CameraSensorHelpers
A few lines needed to be wrapped under 80 lines.
Remove some unneeded documentation and minor typos.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-07-09 21:20:22 +02:00
Umang Jain
89219aea93 utils: ipc: proxy: Reset ControlSerializer during IPA configure
ControlSerializer should be reset during IPA (re)configuration,
so that it doesn't look up stale deserialized cache built from
consecutive previous runs. This is already recommended in
ControlSerializer docs but the implementation seems missing.

The stale cache lookup seems to the core issue with Bug #58.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=58
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-07-09 22:56:27 +05:30
Laurent Pinchart
fb970d9cde libcamera: transform: Document Transform enumerators as such
Due to a bug in Doxygen that didn't properly handle enum class
enumerators when defined in a namespace, the Transform enumerators were
documented with free-formed text.

The issue has been fixed in Doxygen commit 309b397be106 ("issue #8281:
Out-of-line documentation of scoped enums in the same namespace"). We
can now fix the documentation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
2021-07-06 19:58:36 +03:00
Laurent Pinchart
fb37998816 libcamera: device_enumerator: Drop inclusion of linux/media.h
device_enumerator.h doesn't need to include linux/media.h. Drop
inclusion of the header.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Tested-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-07-06 19:58:36 +03:00
Laurent Pinchart
fcccd7991f libcamera: media_device: Rename valid() function to isValid()
We use isValid() instead of valid() through the code base, make
MediaDevice consistent.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2021-07-06 19:58:36 +03:00
Laurent Pinchart
fe70472e9b android: Disable copy and move for CameraDevice
Instances of the CameraDevice class should never be copied or moved, as
they represent resources, Disable copying and moving for the class.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2021-07-06 19:58:36 +03:00
Laurent Pinchart
2c661f360b android: Disable copy and move for CameraHalManager
The CameraHalManager should be instantiated once only, and never copied
or moved. Disable copying and moving.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2021-07-06 19:58:36 +03:00
Nícolas F. R. A. Prado
143b252462 lc-compliance: Add list and filter parameters
Add a --list parameter that lists all current tests (by mapping to
googletest's --gtest_list_tests).

Add a --filter 'filterString' parameter that filters the tests to run
(by mapping to googletest's --gtest_filter).

While at it, add to the help message that further googletest options can
be passed through the environment.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-07-06 12:41:03 +02:00
Nícolas F. R. A. Prado
bc87163779 lc-compliance: Refactor using Googletest
Refactor lc-compliance using Googletest as the test framework.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-07-06 12:40:58 +02:00
Nícolas F. R. A. Prado
e5c51e1fcf lc-compliance: Add Environment singleton
Add a singleton Environment class in order to make the camera available
inside all tests. This is needed for the Googletest refactor, otherwise
the tests, which are statically declared, won't be able to access the
camera.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-07-06 12:40:53 +02:00
Nícolas F. R. A. Prado
034e0e81a2 lc-compliance: Make SimpleCapture::stop() idempotent
Make SimpleCapture::stop() be able to be called multiple times and at
any point so that it can be called from the destructor and an assert
failure can return immediately.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-07-06 12:40:47 +02:00
Nícolas F. R. A. Prado
b0bf6b0aa9 libcamera: camera: Make stop() idempotent
Make Camera::stop() idempotent so that it can be called in any state and
consecutive times. When called in any state other than CameraRunning, it
is a no-op. This simplifies the cleanup path for applications.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-07-06 12:40:41 +02:00
Laurent Pinchart
d7415bc4e4 ipa: raspberrypi: Drop unneeded [[maybe_unused]]
The [[maybe_unused]] in the IMX477 camera helper isn't needed. This had
been pointed out by Naush during review, but I failed to update the code
before pushing.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
2021-07-02 16:30:06 +03:00
Naushir Patuck
579f55b108 ipa: raspberrypi: Generalise the SMIA metadata parser
Instead of having each CamHelper subclass the MdParserSmia, change the
implementation of MdParserSmia to be more generic. The MdParserSmia now gets
given a list of registers to search for and helper functions are used to compute
exposure lines and gain codes from these registers.

Update the imx219 and imx477 CamHelpers by using this new mechanism.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-06-30 23:16:18 +03:00
Naushir Patuck
d3ea8e7885 ipa: raspberrypi: Use a unique_ptr for the metadata parser
The derived CamHelper class now allocates a metadata parser object through a
unique_ptr that is passed to the base class constructor. This automates the
lifetime management of the parser object.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.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-06-30 23:16:18 +03:00