Commit graph

856 commits

Author SHA1 Message Date
Laurent Pinchart
76b9923e55 libcamera: controls: Avoid exception in ControlInfoMap count() and find()
The ControlInfoMap count() and find() methods use at() to lookup the
control numerical ID in the idmap_. This causes an exception to be
thrown if the ID doesn't exist in the map. Fix it by using the find()
method instead in find(), and rely on idmap_.count() in count().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-11-20 21:47:26 +02:00
Laurent Pinchart
4034e45f0a test: controls: Add ControlInfoMap test
Add a test to exercise the ControlInfoMap API. This currently tests
at(), count(), find() and end().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-11-20 21:47:22 +02:00
Laurent Pinchart
fac471e812 test: Extract CameraTest class out of camera tests to libtest
Many tests other than the camera/ tests use a camera. To increase code
sharing, move the base CameraTest class to the test library. The class
becomes a helper that doesn't inherit from Test anymore (to avoid
diamond inheritance issues when more such helpers will exist).

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-11-20 21:47:20 +02:00
Niklas Söderlund
6b3308ba1b libcamera: pipeline: Drop forward declaration of BufferPool
There is no need to forward declare BufferPool, drop it.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-11-20 17:19:58 +01:00
Niklas Söderlund
1d32f21136 cam: Store camera as shared pointer everywhere
Do not store the camera raw pointer in the capture class, this will
prevent forwarding the shared pointer in the future.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-11-20 17:19:58 +01:00
Niklas Söderlund
bcf4299453 libcamera: pipeline_handler: Do not use argument as local variable
In completeRequest() the request argument is used as a local variable,
this is confusing. Add a separate local variable instead of reusing the
argument.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-11-20 00:36:27 +01:00
Niklas Söderlund
c360857c5d libcamera: v4l2_videodevice: Simplify error checking for requestBuffers()
There is no point in explicitly checking the same error in the only call
sites for the internal function, centralize the check and simplify the
code.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-11-20 00:35:00 +01:00
Niklas Söderlund
c1a287d4b4 cam: BufferWriter: Use the libcamera namespace
Other parts of the cam utility uses the libcamera namespace, do the same
in the buffer writer.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-11-20 00:33:41 +01:00
Niklas Söderlund
f7ddfd4517 libcamera: camera: Remove explicit stream to buffer map in requestCompleted signal
The stream to buffer map in the requestCompleted signal is taken
directly from the request which is part of the same signal. Remove the
map as it can be fetched directly from the request.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-11-19 18:30:26 +01:00
Niklas Söderlund
40888cfdce libcamera: buffer: Drop friend statement
The Buffer class do not need to friend PipelineHandler, drop it.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-11-19 17:52:31 +01:00
Niklas Söderlund
5e1cd213b3 libcamera: buffer: Plane: Drop friend statement
The Plane class do not need to friend Stream, drop it.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-11-19 17:49:44 +01:00
Niklas Söderlund
1de2e4bbdd libcamera: buffer: Drop forward declaration of BufferPool
There is no need to forward declare BufferPool, drop it.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-11-19 17:48:20 +01:00
Laurent Pinchart
b465ecb3e3 libcamera: Fix compilation with uClibc and uClibc-ng
Neither uClibc nor uClibc-ng support O_TMPFILE. Define it in utils.h if
not defined.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-11-18 02:33:53 +02:00
Ezequiel Garcia
97a5855f37 README: Simplify a bit the build instructions
Less typing for the same result.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-11-18 02:28:55 +02:00
Laurent Pinchart
918bfb3c3d libcamera: Remove space between empty curly brackets
Remove spaces between empty curly brackets (replacing { } with {}) to
comply with the coding style. Fix one other coding style violation on
the lines touched by those fixes.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-11-18 02:27:48 +02:00
Laurent Pinchart
d312d0ba10 libcamera: Remove unneeded semicolons
Comply with the coding style by removing lots of unneeded semicolons.
Fix a few other coding style violations on the lines touched by those
fixes.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-11-08 20:37:47 +02:00
Jacopo Mondi
53eab99680 android: Replace ThreadRPC with blocking method call
Use the newly introduced InvocationTypeBlocking message type to replace
the blocking message delivery implemented with the ThreadRPC class in the
Android camera HAL.

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-10-30 02:37:37 +02:00
Jacopo Mondi
1f1d27cc14 test: object-invoke: Invoke method in blocking mode
Change the object-invoke test to perform the second method invocation
operation in blocking mode.

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-10-29 18:46:33 +02:00
Jacopo Mondi
fb1a5c0416 libcamera: object: Add connection type parameter to invokeMethod()
Allow specifying a different connection type than ConnectionTypeQueued
for Object::invokeMethod().

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-10-29 16:44:46 +02:00
Laurent Pinchart
06008b9156 libcamera: object: Use bound method activePack() for invokeMethod()
The BoundMethodBase::activatePack() and the internal
Object::invokeMethod() are duplicate implementation of the same
mechanism. Use the former to replace the latter.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-10-29 16:44:45 +02:00
Laurent Pinchart
8524e62611 libcamera: signal: Specify connection type for signals
Add a connection type parameter to the Signal::connect() method to
control signal delivery.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-10-29 16:44:43 +02:00
Laurent Pinchart
3d75cc1bd2 libcamera: bound_method: Support connection types
Support all connection types in the BoundMethodBase::activePack()
method. To support this, add a semaphore to the InvokeMessage to signal
delivery.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-10-29 16:41:54 +02:00
Laurent Pinchart
df2518b2a3 libcamera: bound_method: Store connection type in BoundMethodBase
Store the connection type in the base BoundMethodBase class to make it
accessible to all bound methods. The default type is ConnectionTypeAuto.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-10-29 16:41:37 +02:00
Jacopo Mondi
1e2db0eee7 libcamera: bound_method: Define connection type for method invocation
Define an enumeration of connection types to describe the delivery
method of signals and method invocation.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-10-29 16:41:33 +02:00
Laurent Pinchart
66e7c5b774 libcamera: Add Semaphore class
Add a general-purpose counting semaphore class.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-10-28 17:11:40 +02:00
Jacopo Mondi
448716d8f7 libcamera: Switch PixelFormat to DRM FourCC values
Use DRM FourCC values for the newly defined PixelFormat.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-10-28 17:04:20 +02:00
Jacopo Mondi
2a8bf04227 libcamera: v4l2_videodevice: Add PixelFormat conversion
In preparation for switching PixelFormat to DRM pixel formats, add
helper methods to the V4L2VideoDevice class to translate between DRM
pixel formats and V4L2 pixel formats.

More work is needed to properly support the V4L2 multi-planar
(NV[0-9]*M) formats.

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-10-28 17:04:01 +02:00
Jacopo Mondi
c53f8fbbab libcamera: stream: Use the newly defined PixelFormat
Use the newly defined PixelFormat type to define the image format
contained in the StreamFormats and StreamConfiguration classes.

Update the classes documentation accordingly.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-10-28 13:08:08 +02:00
Jacopo Mondi
656d875734 libcamera: Define a PixelFormat type for application-facing formats
Define a PixelFormat type as a simple typedef to an uint32_t. The usage
of a dedicated type creates a cleaner and more self-described API.

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-10-28 13:07:50 +02:00
Jacopo Mondi
9db0ed5e20 include: drm_fourcc: Add Motion-JPEG FourCC
Add a FourCC for Motion-JPEG compressed format. This is a temporary
addition until the format gets merged in the upstream kernel.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-10-28 13:04:47 +02:00
Jacopo Mondi
5353b69ce5 include: linux: Import DRM/KMS headers from Linux v5.2
Import DRM/KMS header files from Linux kernel v5.2.

The DRM headers are used to prepare to use the DRM-defined pixel formats
(DRM_FORMAT_*) in place of the currently used V4L2 pixel formats
(V4L2_PIX_FMT_*).

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-10-28 13:04:47 +02:00
Jacopo Mondi
4984973679 include: linux: Update headers to Linux v5.2
Update headers to Linux v5.2. The Rockchip ISP1 formats that were added
manually in commit 97dce7a13f ("include: linux: Add rkisp1 kernel
header and format definitions") are kept. Otherwise the headers come
straight from the upstream kernel.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-10-28 13:04:47 +02:00
Laurent Pinchart
702dcb3105 libcamera: formats: Write libcamera in lowercase
The libcamera name should never be capitalized. Fix the two incorrect
occurrences.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-10-28 13:04:38 +02:00
Laurent Pinchart
9d66ffc085 libcamera: bound_method: Fix compiler warning due to unused arguments
The BoundStaticMethod::invoke() method is never used, but must still be
implemented as the base class defines it as pure virtual. As it doesn't
use its arguments, the compiler generates a warning. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-10-27 00:39:07 +03:00
Jacopo Mondi
6a832d114e include: libcamera: Install control_ids.h
Make the auto-generated control_ids.h file as part of the libcamera
installation.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-10-26 23:05:58 +02:00
Paul Elder
b1b0a48278 cam: capture: remove unused local variable
Remove unused local map variable.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-10-26 01:42:29 +02:00
Laurent Pinchart
429be98e4c libcamera: pipeline: vimc: Support format enumeration
Fill the StreamConfiguration with all supported formats. The list of
supported formats is currently hardcoded based on the limits of the vimc
driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-10-25 18:45:30 +03:00
Kieran Bingham
74208ea5d1 qcam: Don't ask for a camera when only one exists
If there is only one camera exposed by libcamera, there is little value
in asking the user to choose it.

Automatically select it, and remove the need to ask the user to select
'ok' from a Dialog box.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-10-25 12:20:29 +01:00
Laurent Pinchart
9d1c26588b Documentation: Add git clone information to Getting Started
As the Getting Started section is displayed on the website, it should
contain commands related to cloning the repository.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-10-24 02:24:35 +03:00
Laurent Pinchart
fb93dae7d3 Documentation: theme: css: Really hide toc trees
The toc trees are rendered as hidden but still take space due to their
margin and padding. Really hide them. While at it, don't handle overflow
with scrollbars in the content area, the whole page should be
scrollable.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-10-23 17:41:09 +03:00
Laurent Pinchart
09d7d00a0f Documentation: theme: css: Make text darker
The text is currently rendered as a 50% gray, which is a bit painful to
read in low light conditions. Make it darker.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-10-23 17:41:09 +03:00
Laurent Pinchart
cf596d8dfa Documentation: Hide the Getting Started information
The Getting Started information makes little sense on the generated
documentation, as a developer with documentation compiled from a local
libcamera source tree has already got started. We however want to keep
the information in the top-level README.rst as it is useful there.

In order to hide the Getting Started information from the front page
while keeping it in README.rst, add comments to delimitate sections of
README.rst, and include only a subset of the file in the front page.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-10-23 17:41:09 +03:00
Laurent Pinchart
0cca041cbd Documentation: Set the index TOC max depth to 1
We don't need more than one level in the main TOC tree, set the max
depth to 1.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-10-23 17:41:09 +03:00
Laurent Pinchart
33ae55c3cd Documentation: Generate local TOC on demand
All pages are generated with a local TOC, which is pointless on simple
pages such as the front page, or other pages containing little content.
Use the .. contents:: :local: directive instead to generate the local
TOC on demand, and remove the automatic local TOC generation. Only the
Docs page uses a local TOC.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-10-23 17:41:09 +03:00
Laurent Pinchart
dd84815d61 Documentation: Link to API section in Docs
The API belongs to the docs section. Link to it from docs.rst, and
remove the shortcut in the navigation bar as links to a placeholder
only.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-10-23 17:41:09 +03:00
Laurent Pinchart
bbc3be2fb5 Documentation: contributing: Remove Sphinx + Doxygen integration
Sphinx integration with Doxygen didn't produce the expected results, we
will not go that way. Don't mention it on the contributing page.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-10-23 17:41:09 +03:00
Laurent Pinchart
f353777fb8 Documentation: Move coding style under contributing
The coding style isn't so important that it has to be displayed on the
top contents bar. Move it to the contributing section.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-10-23 17:41:09 +03:00
Laurent Pinchart
ca260d2f53 libcamera: Standardise on C compatibility headers
Now that our usage of C compatibility header is documented, use them
consistently through the source code.

While at it, group the C and C++ include statements as defined in the
coding style, and fix a handful of #include ordering issues.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-10-23 17:39:39 +03:00
Laurent Pinchart
bb5f8cf495 utils: checkstyle.py: Add include checker
Add an include checker to verify usage of the C compatibility headers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-10-23 17:12:34 +03:00
Laurent Pinchart
73a11cbf78 Documentation: coding-style: Document order of includes
We follow the Google C++ Style Guide rule on include ordering with a few
tweaks. Document our rule explicitly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-10-23 17:12:30 +03:00