Commit graph

21 commits

Author SHA1 Message Date
Javier Martinez Canillas
7ec3bfedbe meson: options: Disable pycamera by default
The libcamera Python bindings is still experimental and it relies on some
features in pybind11 that are not yet upstreamed, so a special branch has
to be downloaded as a subproject.

This conflicts with the build process used by most Linux distributions,
since there is expected that all the dependencies will be fulfilled by
-devel packages present in the build root.

To allow libcamera to be built by distros, let's disable the pycamera by
default. This can still be enabled with `meson build -Dpycamera=enabled`.

Suggested-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-06-23 19:49:24 +03:00
Tomi Valkeinen
8aa02271fd Add Python bindings
Add libcamera Python bindings. pybind11 is used to generate the C++ <->
Python layer.

We use pybind11 'smart_holder' version to avoid issues with private
destructors and shared_ptr. There is also an alternative solution here:

https://github.com/pybind/pybind11/pull/2067

Only a subset of libcamera classes are exposed. Implementing and testing
the wrapper classes is challenging, and as such only classes that I have
needed have been added so far.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-05-10 13:53:43 +02:00
Umang Jain
e8924f30f7 meson: Add a configuration option to build IPAs
There can be multiple IPAs per pipeline-handler or platform.
They can live in-tree or externally linked. It is up to the vendor
whether to use in-tree IPA for a platform or provide it externally.
In the case of IPAs being external, building in-tree IPAs might be
futile hence, provide a clear and explicit mechanism to choose whether
to build the in-tree IPA for the platform or not.

By default, all in-tree IPAs are built when a matching Pipeline handler
is also enabled.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-05-24 14:27:29 +03:00
Niklas Söderlund
02bc110857 lc-compliance: Add a libcamera compliance tool
Add a compliance tool to ease testing of cameras. In contrast to the
unit-tests under test/ that aims to test the internal components of
libcamera the compliance tool aims to test application use-cases and to
some extent the public API.

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

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

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

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
2021-04-12 10:48:56 +02:00
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
Jacopo Mondi
d8d6a78f22 android: Introduce Chromium OS buffer manager
Introduce the CameraBuffer backend for the Chromium OS operating system
and the associated meson option.

The Chromium OS CameraBuffer implementation uses the
cros::CameraBufferManager class to perform mapping of 1 plane and multiplane
buffers and to retrieve size information.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-03-03 09:50:44 +01:00
Jacopo Mondi
ad9eee2a7d meson: options: Add option to select the Android platform
The Android Camera3 HAL implementation requires platform
specific extensions, such as the selection of the memory backend
to use and additional constraints depending on the target device.

Define a combo option to select which platform to target and
define the currently existing implementation as 'generic'.

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-03-03 09:50:12 +01:00
Paul Elder
fcc6d4bd76 libcamera: tracing: Implement tracing infrastructure
Implement tracing infrastructure in libcamera. It takes .tp files, as
required by lttng, and generates a tracepoint header and C file, as lttng
requires. meson is updated accordingly to get it to compile with the
rest of libcamera. Update the documentation accordingly.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-11-03 11:07:21 +09:00
Ricardo Ribalda
aba567338b Documentation: Move all dependencies into features
This way if the user enables the documentation and the dependencies are
missing the configure fails.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Ricardo Ribalda <ricardo@ribalda.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-09-24 21:08:30 +03:00
Laurent Pinchart
d5ce2679c6 libcamera: Turn the android option into a feature
Allow disabling compilation of the Android HAL adaptation layer
automatically when a dependency is missing by turning the android option
into a feature. The default value is set to 'disabled' to match the
current behaviour.

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>
2020-09-16 18:15:28 +03:00
Niklas Söderlund
fc520719a9 meson: options: Add an option to control compilation of qcam
Add an option to control compilation of the qcam test application. The
default behavior is to compile qcam, no change in behavior without user
intervention.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-06-24 19:06:16 +02:00
Laurent Pinchart
7a653369cb licenses: License all meson files under CC0-1.0
In an attempt to clarify the license terms of all files in the libcamera
project, the build system files deserve particular attention. While they
describe how the binaries are created, they are not themselves
transformed into any part of binary distributions of the software, and
thus don't influence the copyright on the binary packages. They are
however subject to copyright, and thus influence the distribution terms
of the source packages.

Most of the meson.build files would not meet the threshold of
originality criteria required for copyright protection. Some of the more
complex meson.build files may be eligible for copyright protection. To
avoid any ambiguity and uncertainty, state our intent to not assert
copyrights on the build system files by putting them in the public
domain with the CC0-1.0 license.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Acked-by: Giulio Benetti <giulio.benetti@micronovasrl.com>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Acked-by: Naushir Patuck <naush@raspberrypi.com>
Acked-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Acked-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Acked-by: Paul Elder <paul.elder@ideasonboard.com>
Acked-by: Show Liu <show.liu@linaro.org>
2020-05-13 16:46:24 +03:00
Naushir Patuck
4bb5b1f602 libcamera: raspberrypi: Add components to meson build
Add the Raspberry Pi pipeline handler and IPA as targets in the
meson build system.

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>
2020-05-11 23:54:48 +03:00
Martijn Braam
a8964c28c8 libcamera: pipeline: Add a simple pipeline handler
This new pipeline handler aims at supporting any simple device without
requiring any device-specific code. Simple devices are currently defined
as a graph made of one or multiple camera sensors and a single video
node, with each sensor connected to the video node through a linear
pipeline.

The simple pipeline handler will automatically parse the media graph,
enumerate sensors, build supported stream configurations, and configure
the pipeline, without any device-specific knowledge. It doesn't support
configuration of any processing in the pipeline at the moment, but may
be extended to support simple processing such as format conversion or
scaling in the future.

The only device-specific information in the pipeline handler is the list
of supported drivers, required for device matching. We may be able to
remove this in the future by matching with the simple pipeline handler
as a last resort option, after all other pipeline handlers have been
tried.

Signed-off-by: Martijn Braam <martijn@brixit.nl>
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>
Reviewed-by: Andrey Konovalov <andrey.konovalov@linaro.org>
2020-05-10 23:58:36 +03:00
Laurent Pinchart
ee7e2c93df libcamera: Make pipeline handlers selectable at compile time
Add a 'pipelines' project option that specifies which pipeline handlers
to compile in. The corresponding IPA modules are automatically selected.
The default is to compile all pipeline handlers.

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>
2020-03-25 12:21:13 +02:00
Nicolas Dufresne
17cccc68a8 Add GStreamer plugin and element skeleton
This implements the GStreamer plugin interface and adds libcamerasrc
element feature to it. This is just enough to allow plugin
introspection.

gst-inspect-1.0 build/src/gstreamer/libgstlibcamera.so
Plugin Details:
  Name                     libcamera
  Description              libcamera capture plugin
  Filename                 build/src/gstreamer/libgstlibcamera.so
  Version                  0.0.0+1042-6c9f16d3-dirty
  License                  LGPL
  Source module            libcamera
  Binary package           libcamera
  Origin URL               https://libcamera.org

  libcamerasrc: libcamera Source

  1 features:

GST_PLUGIN_PATH=$(pwd)/build/src/gstreamer gst-inspect-1.0 libcamerasrc
Factory Details:
  Rank                     primary (256)
  Long-name                libcamera Source
  Klass                    Source/Video
  Description              Linux Camera source using libcamera
  Author                   Nicolas Dufresne <nicolas.dufresne@collabora.com

Plugin Details:
  Name                     libcamera
  Description              libcamera capture plugin
  Filename                 /home/nicolas/Sources/libcamera/build/src/gstreamer/libgstlibcamera.so
  Version                  0.0.0+1042-6c9f16d3-dirty
  License                  LGPL
  Source module            libcamera
  Binary package           libcamera
  Origin URL               https://libcamera.org

GObject
 +----GInitiallyUnowned
       +----GstObject
             +----GstElement
                   +----GstLibcameraSrc

Pad Templates:
  none

Element has no clocking capabilities.
Element has no URI handling capabilities.

Pads:
  none

Element Properties:
  name                : The name of the object
                        flags: accès en lecture, accès en écriture, 0x2000
                        String. Default: "libcamerasrc0"
  parent              : The parent of the object
                        flags: accès en lecture, accès en écriture, 0x2000
                        Object of type "GstObject"

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[Silence -Wunused-function warning for older GLib versions]
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-07 01:57:42 +02:00
Paul Elder
0ce8f2390b v4l2: v4l2_compat: Add V4L2 compatibility layer
Add libcamera V4L2 compatibility layer.

This initial implementation supports the minimal set of V4L2 operations,
which allows getting, setting, and enumerating formats, and streaming
frames from a video device. Some data about the wrapped V4L2 video
device are hardcoded.

Add a build option named 'v4l2' and adjust the build system to
selectively compile the V4L2 compatibility layer.

For now we match the V4L2 device node to a libcamera camera based on a
devnum that a pipeline handler may optionally map to a libcamera
camera.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-01-03 19:53:20 -05:00
Laurent Pinchart
8a92e6fc72 meson: Rename 'tests' option to 'test'
The 'tests' option enables compilation of tests. On Gentoo and Chrome
OS, the corresponding package USE flag is named 'test'. Rename the
option to 'test' to bring it in line.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-08-22 19:35:54 +03:00
Jacopo Mondi
667d8ea8fd android: hal: Add Camera3 HAL
Add libcamera Android Camera HALv3 implementation.

The initial camera HAL implementation supports the LIMITED hardware
level and uses statically defined metadata and camera characteristics.

Add a build option named 'android' and adjust the build system to
selectively compile the Android camera HAL and link it against the
required Android libraries.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-08-12 11:55:46 +02:00
Kieran Bingham
abda899fa9 meson: options: Document the options
Re-order the project options and add documentation which will be
presented by 'meson configure'.

This produces the following extra information:

Project options:
  Option        Current Value Possible Values Description
  ------        ------------- --------------- -----------
  documentation true          [true, false]   Generate the project documentation
  tests         true          [true, false]   Compile and include the tests

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-04-03 11:44:04 +07:00
Kieran Bingham
945478dbc0 meson: Provide options to disable test/docs
It can be desirable to disable the compilation and processing of both
the test suite and documentation for use cases such as packaging to an
embedded target.

Provide a new meson_options.txt file to allow disabling either or both
of the tests and documentation components of libcamera.

These options can be provided at the initial configuration time, for
example:

  meson build -Dtests=false -Ddocumentation=false

or by reconfiguring an existing build tree:

  cd build
  meson configure -Ddocumentation=false
  meson configure -Dtests=false

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-03-20 16:27:30 +00:00