Commit graph

898 commits

Author SHA1 Message Date
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
Laurent Pinchart
c98407bb2f Documentation: coding-style: Document usage of C compatibility headers
The C++ standard defines a set of C++ standard library headers, and for
some of them, defines C compatibility headers. The former have a name of
the form <cxxx> while the later are named <xxx.h>. The C++ headers
declare names in the std namespace, and may declare the same names in
the global namespace. The C compatibility headers declare names in the
global namespace, and may declare the same names in the std namespace.

We want to standardise on one set of headers through libcamera, and
don't want to rely on optional behaviour. We can thus either use the C++
headers with an explicit std:: namespace qualifier through the code, or
the C headers without the qualifier.

Both set of headers are defined by the C++ standard, and are thus valid
choices. After weighing pros and cons, we have decided to use the C
compatibility headers, as nobody wanted to write std::uint32_t. Document
this decision.

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:07:03 +03:00
Jacopo Mondi
408c98ea45 libcamera: controls: Remove rogue ';'
The ';' at the end of an inline method declaration is not required.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-10-23 09:59:24 +02:00
Kieran Bingham
3774f23f8e libcamera: pipeline_handler: Fix trivial spelling
Signaled is an American spelling.

  s/signaled/signalled/

Fixes: b2c06cf409 ("libcamera: Handle request completion explicitly in pipeline handlers")
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-10-22 17:12:57 +01:00
Laurent Pinchart
6b6c02e223 qcam: Support Qt versions earlier than 5.9
The QtEventDispatcher timers implementation depends on Qt 5.9 or newer
due to the use of QObject::startTimer(std::chrono::milliseconds).
Support earlier Qt versions by using the QObject::startTimer(int)
version instead.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-10-17 02:25:50 +03:00
Laurent Pinchart
ba9a62c836 libcamera: v4l2_controls: Remove V4L2ControlList class
The V4L2ControlList class only provides a convenience constructor for
the ControlList, which can easily be moved to the ControlList class and
may benefit it later (to construct a ControlList from controls supported
by a camera). Move the constructor and remove V4L2ControlList.

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-10-15 22:33:34 +03:00
Laurent Pinchart
319d6ae8e3 libcamera: controls: Merge ControlInfoMap and V4L2ControlInfoMap
The ControlInfoMap and V4L2ControlInfoMap classes are very similar, with
the latter adding convenience accessors based on numerical IDs for the
former, as well as a cached idmap. Both features can be useful for
ControlInfoMap in the context of serialisation, and merging the two
classes will further simplify the IPA API.

Import all the features of V4L2ControlInfoMap into ControlInfoMap,
turning the latter into a real class. A few new constructors and
assignment operators are added for completeness.

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-10-15 22:33:33 +03:00
Laurent Pinchart
c957c8580a libcamera: v4l2_controls: Derive V4L2ControlInfoMap from ControlInfoMap
Replace the std::map<> used as the base type for V4L2ControlInfoMap by
ControlInfoMap, which is an alias for an std::unsorted_map<> with the
same key and value types. This shortens the code.

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-10-15 22:33:32 +03:00
Laurent Pinchart
1bfed95c1e libcamera: v4l2_controls: Store a ControlRange in V4L2ControlInfoMap
V4L2ControlRange only offers a convenience constructor for a
ControlRange. Store the ControlRange instead of V4L2ControlRange in
V4L2ControlInfoMap to make the map less dependent on V4L2 types.

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-10-15 22:33:32 +03:00