summaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/Doxyfile-common.in (renamed from Documentation/Doxyfile.in)23
-rw-r--r--Documentation/Doxyfile-internal.in31
-rw-r--r--Documentation/Doxyfile-public.in20
-rw-r--r--Documentation/coding-style.rst2
-rw-r--r--Documentation/environment_variables.rst10
-rwxr-xr-xDocumentation/gen-doxyfile.py46
-rw-r--r--Documentation/guides/pipeline-handler.rst5
-rw-r--r--Documentation/mainpage.dox33
-rw-r--r--Documentation/meson.build82
-rw-r--r--Documentation/thread-safety.dox44
10 files changed, 259 insertions, 37 deletions
diff --git a/Documentation/Doxyfile.in b/Documentation/Doxyfile-common.in
index abafcf6c..a70aee43 100644
--- a/Documentation/Doxyfile.in
+++ b/Documentation/Doxyfile-common.in
@@ -22,32 +22,13 @@ CASE_SENSE_NAMES = YES
QUIET = YES
WARN_AS_ERROR = @WARN_AS_ERROR@
-INPUT = "@TOP_SRCDIR@/include/libcamera" \
- "@TOP_SRCDIR@/src/ipa/ipu3" \
- "@TOP_SRCDIR@/src/ipa/libipa" \
- "@TOP_SRCDIR@/src/libcamera" \
- "@TOP_BUILDDIR@/include/libcamera" \
- "@TOP_BUILDDIR@/src/libcamera"
-
FILE_PATTERNS = *.c \
*.cpp \
+ *.dox \
*.h
RECURSIVE = YES
-EXCLUDE = @TOP_SRCDIR@/include/libcamera/base/span.h \
- @TOP_SRCDIR@/include/libcamera/internal/device_enumerator_sysfs.h \
- @TOP_SRCDIR@/include/libcamera/internal/device_enumerator_udev.h \
- @TOP_SRCDIR@/include/libcamera/internal/ipc_pipe_unixsocket.h \
- @TOP_SRCDIR@/src/libcamera/device_enumerator_sysfs.cpp \
- @TOP_SRCDIR@/src/libcamera/device_enumerator_udev.cpp \
- @TOP_SRCDIR@/src/libcamera/ipc_pipe_unixsocket.cpp \
- @TOP_SRCDIR@/src/libcamera/pipeline/ \
- @TOP_SRCDIR@/src/libcamera/tracepoints.cpp \
- @TOP_BUILDDIR@/include/libcamera/internal/tracepoints.h \
- @TOP_BUILDDIR@/include/libcamera/ipa/soft_ipa_interface.h \
- @TOP_BUILDDIR@/src/libcamera/proxy/
-
EXCLUDE_PATTERNS = @TOP_BUILDDIR@/include/libcamera/ipa/*_serializer.h \
@TOP_BUILDDIR@/include/libcamera/ipa/*_proxy.h \
@TOP_BUILDDIR@/include/libcamera/ipa/ipu3_*.h \
@@ -70,8 +51,6 @@ EXCLUDE_SYMBOLS = libcamera::BoundMethodArgs \
EXCLUDE_SYMLINKS = YES
-HTML_OUTPUT = api-html
-
GENERATE_LATEX = NO
MACRO_EXPANSION = YES
diff --git a/Documentation/Doxyfile-internal.in b/Documentation/Doxyfile-internal.in
new file mode 100644
index 00000000..cf982553
--- /dev/null
+++ b/Documentation/Doxyfile-internal.in
@@ -0,0 +1,31 @@
+# SPDX-License-Identifier: CC-BY-SA-4.0
+
+@INCLUDE_PATH = @TOP_BUILDDIR@/Documentation
+@INCLUDE = Doxyfile-common
+
+HIDE_UNDOC_CLASSES = NO
+HIDE_UNDOC_MEMBERS = NO
+HTML_OUTPUT = internal-api-html
+INTERNAL_DOCS = YES
+ENABLED_SECTIONS = internal
+
+INPUT = "@TOP_SRCDIR@/Documentation" \
+ "@TOP_SRCDIR@/include/libcamera" \
+ "@TOP_SRCDIR@/src/ipa/ipu3" \
+ "@TOP_SRCDIR@/src/ipa/libipa" \
+ "@TOP_SRCDIR@/src/libcamera" \
+ "@TOP_BUILDDIR@/include/libcamera" \
+ "@TOP_BUILDDIR@/src/libcamera"
+
+EXCLUDE = @TOP_SRCDIR@/include/libcamera/base/span.h \
+ @TOP_SRCDIR@/include/libcamera/internal/device_enumerator_sysfs.h \
+ @TOP_SRCDIR@/include/libcamera/internal/device_enumerator_udev.h \
+ @TOP_SRCDIR@/include/libcamera/internal/ipc_pipe_unixsocket.h \
+ @TOP_SRCDIR@/src/libcamera/device_enumerator_sysfs.cpp \
+ @TOP_SRCDIR@/src/libcamera/device_enumerator_udev.cpp \
+ @TOP_SRCDIR@/src/libcamera/ipc_pipe_unixsocket.cpp \
+ @TOP_SRCDIR@/src/libcamera/pipeline/ \
+ @TOP_SRCDIR@/src/libcamera/tracepoints.cpp \
+ @TOP_BUILDDIR@/include/libcamera/internal/tracepoints.h \
+ @TOP_BUILDDIR@/include/libcamera/ipa/soft_ipa_interface.h \
+ @TOP_BUILDDIR@/src/libcamera/proxy/
diff --git a/Documentation/Doxyfile-public.in b/Documentation/Doxyfile-public.in
new file mode 100644
index 00000000..36bb5758
--- /dev/null
+++ b/Documentation/Doxyfile-public.in
@@ -0,0 +1,20 @@
+# SPDX-License-Identifier: CC-BY-SA-4.0
+
+@INCLUDE_PATH = @TOP_BUILDDIR@/Documentation
+@INCLUDE = Doxyfile-common
+
+HIDE_UNDOC_CLASSES = YES
+HIDE_UNDOC_MEMBERS = YES
+HTML_OUTPUT = api-html
+INTERNAL_DOCS = NO
+
+INPUT = "@TOP_SRCDIR@/Documentation" \
+ ${inputs}
+
+EXCLUDE = @TOP_SRCDIR@/include/libcamera/base/class.h \
+ @TOP_SRCDIR@/include/libcamera/base/object.h \
+ @TOP_SRCDIR@/include/libcamera/base/span.h \
+ @TOP_SRCDIR@/src/libcamera/base/class.cpp \
+ @TOP_SRCDIR@/src/libcamera/base/object.cpp
+
+PREDEFINED += __DOXYGEN_PUBLIC__
diff --git a/Documentation/coding-style.rst b/Documentation/coding-style.rst
index 72cb28d2..3352b75c 100644
--- a/Documentation/coding-style.rst
+++ b/Documentation/coding-style.rst
@@ -215,7 +215,7 @@ shall be avoided when possible, but are allowed when required (for instance to
implement factories with auto-registration). They shall not depend on any other
global variable, should run a minimal amount of code in the constructor and
destructor, and code that contains dependencies should be moved to a later
-point in time.
+point in time.
Error Handling
~~~~~~~~~~~~~~
diff --git a/Documentation/environment_variables.rst b/Documentation/environment_variables.rst
index 4e9fbb27..de434c38 100644
--- a/Documentation/environment_variables.rst
+++ b/Documentation/environment_variables.rst
@@ -37,6 +37,11 @@ LIBCAMERA_IPA_MODULE_PATH
Example value: ``${HOME}/.libcamera/lib:/opt/libcamera/vendor/lib``
+LIBCAMERA_IPA_PROXY_PATH
+ Define custom full path for a proxy worker for a given executable name.
+
+ Example value: ``${HOME}/.libcamera/proxy/worker:/opt/libcamera/vendor/proxy/worker``
+
LIBCAMERA_PIPELINES_MATCH_LIST
Define an ordered list of pipeline names to be used to match the media
devices in the system. The pipeline handler names used to populate the
@@ -50,6 +55,11 @@ LIBCAMERA_RPI_CONFIG_FILE
Example value: ``/usr/local/share/libcamera/pipeline/rpi/vc4/minimal_mem.yaml``
+LIBCAMERA_RPI_TUNING_FILE
+ Define a custom JSON tuning file to use in the Raspberry Pi.
+
+ Example value: ``/usr/local/share/libcamera/ipa/rpi/vc4/custom_sensor.json``
+
Further details
---------------
diff --git a/Documentation/gen-doxyfile.py b/Documentation/gen-doxyfile.py
new file mode 100755
index 00000000..c265bc2f
--- /dev/null
+++ b/Documentation/gen-doxyfile.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2024, Google Inc.
+#
+# Author: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+#
+# Generate Doxyfile from a template
+
+import argparse
+import os
+import string
+import sys
+
+
+def fill_template(template, data):
+
+ template = open(template, 'rb').read()
+ template = template.decode('utf-8')
+ template = string.Template(template)
+
+ return template.substitute(data)
+
+
+def main(argv):
+
+ parser = argparse.ArgumentParser()
+ parser.add_argument('-o', dest='output', metavar='file',
+ type=argparse.FileType('w', encoding='utf-8'),
+ default=sys.stdout,
+ help='Output file name (default: standard output)')
+ parser.add_argument('template', metavar='doxyfile.tmpl', type=str,
+ help='Doxyfile template')
+ parser.add_argument('inputs', type=str, nargs='*',
+ help='Input files')
+
+ args = parser.parse_args(argv[1:])
+
+ inputs = [f'"{os.path.realpath(input)}"' for input in args.inputs]
+ data = fill_template(args.template, {'inputs': (' \\\n' + ' ' * 25).join(inputs)})
+ args.output.write(data)
+
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
diff --git a/Documentation/guides/pipeline-handler.rst b/Documentation/guides/pipeline-handler.rst
index 7e45cdb8..5aa09e90 100644
--- a/Documentation/guides/pipeline-handler.rst
+++ b/Documentation/guides/pipeline-handler.rst
@@ -151,13 +151,14 @@ integrates with the libcamera build system, and a *vivid.cpp* file that matches
the name of the pipeline.
In the *meson.build* file, add the *vivid.cpp* file as a build source for
-libcamera by adding it to the global meson ``libcamera_sources`` variable:
+libcamera by adding it to the global meson ``libcamera_internal_sources``
+variable:
.. code-block:: none
# SPDX-License-Identifier: CC0-1.0
- libcamera_sources += files([
+ libcamera_internal_sources += files([
'vivid.cpp',
])
diff --git a/Documentation/mainpage.dox b/Documentation/mainpage.dox
new file mode 100644
index 00000000..d5a57653
--- /dev/null
+++ b/Documentation/mainpage.dox
@@ -0,0 +1,33 @@
+/**
+\mainpage libcamera API reference
+
+Welcome to the API reference for <a href="https://libcamera.org/">libcamera</a>,
+a complex camera support library for Linux, Android and ChromeOS. These pages
+are automatically generated from the libcamera source code and describe the API
+in detail - if this is your first interaction with libcamera then you may find
+it useful to visit the [developer's guide](../html/guides/introduction.html) in
+the first instance, which can provide a more generic introduction to the
+library's concepts.
+
+\if internal
+
+As a follow-on to the developer's guide, to assist you in adding support for
+your platform the [pipeline handler writer's guide](../html/guides/pipeline-handler.html)
+and the [ipa module writer's guide](../html/guides/ipa.html) should be helpful.
+
+The full libcamera API is documented here. If you wish to see only the public
+part of the API you can use [these pages](../api-html/index.html) instead.
+
+\else
+
+As a follow-on to the developer's guide, to assist you in using libcamera within
+your project the [application developer's guide](../html/guides/application-developer.html)
+gives an overview on how to achieve that.
+
+Only the public part of the libcamera API is documented here; if you are a
+developer seeking to add support for your hardware to the library or make other
+improvements, you should switch to the internal API
+[reference pages](../internal-api-html/index.html) instead.
+
+\endif
+*/
diff --git a/Documentation/meson.build b/Documentation/meson.build
index 30d39523..1ba40fdf 100644
--- a/Documentation/meson.build
+++ b/Documentation/meson.build
@@ -24,34 +24,92 @@ if doxygen.found() and dot.found()
cdata.set('PREDEFINED', ' \\\n\t\t\t '.join(doxygen_predefined))
- doxyfile = configure_file(input : 'Doxyfile.in',
- output : 'Doxyfile',
- configuration : cdata)
+ doxyfile_common = configure_file(input : 'Doxyfile-common.in',
+ output : 'Doxyfile-common',
+ configuration : cdata)
+
+ doxygen_public_input = [
+ libcamera_base_public_headers,
+ libcamera_base_public_sources,
+ libcamera_public_headers,
+ libcamera_public_sources,
+ ]
- doxygen_input = [
- doxyfile,
- libcamera_base_headers,
- libcamera_base_sources,
+ doxygen_internal_input = [
+ libcamera_base_private_headers,
+ libcamera_base_internal_sources,
libcamera_internal_headers,
+ libcamera_internal_sources,
libcamera_ipa_headers,
libcamera_ipa_interfaces,
- libcamera_public_headers,
- libcamera_sources,
libipa_headers,
libipa_sources,
]
if is_variable('ipu3_ipa_sources')
- doxygen_input += [ipu3_ipa_sources]
+ doxygen_internal_input += [ipu3_ipa_sources]
endif
- custom_target('doxygen',
- input : doxygen_input,
+ # We run doxygen twice - the first run excludes internal API objects as it
+ # is intended to document the public API only. A second run covers all of
+ # the library's objects for libcamera developers. Common configuration is
+ # set in an initially generated Doxyfile, which is then included by the two
+ # final Doxyfiles.
+
+ # This is the "public" run of doxygen generating an abridged version of the
+ # API's documentation.
+
+ doxyfile_tmpl = configure_file(input : 'Doxyfile-public.in',
+ output : 'Doxyfile-public.tmpl',
+ configuration : cdata)
+
+ # The set of public input files stored in the doxygen_public_input array
+ # needs to be set in Doxyfile public. We can't pass them through cdata
+ # cdata, as some of the array members are custom_tgt instances, which
+ # configuration_data.set() doesn't support. Using a separate script invoked
+ # through custom_target(), which supports custom_tgt instances as inputs.
+
+ doxyfile = custom_target('doxyfile-public',
+ input : [
+ doxygen_public_input,
+ ],
+ output : 'Doxyfile-public',
+ command : [
+ 'gen-doxyfile.py',
+ '-o', '@OUTPUT@',
+ doxyfile_tmpl,
+ '@INPUT@',
+ ])
+
+ custom_target('doxygen-public',
+ input : [
+ doxyfile,
+ doxyfile_common,
+ ],
output : 'api-html',
command : [doxygen, doxyfile],
install : true,
install_dir : doc_install_dir,
install_tag : 'doc')
+
+ # This is the internal documentation, which hard-codes a list of directories
+ # to parse in its doxyfile.
+
+ doxyfile = configure_file(input : 'Doxyfile-internal.in',
+ output : 'Doxyfile-internal',
+ configuration : cdata)
+
+ custom_target('doxygen-internal',
+ input : [
+ doxyfile,
+ doxyfile_common,
+ doxygen_internal_input,
+ ],
+ output : 'internal-api-html',
+ command : [doxygen, doxyfile],
+ install : true,
+ install_dir : doc_install_dir,
+ install_tag : 'doc-internal')
endif
#
diff --git a/Documentation/thread-safety.dox b/Documentation/thread-safety.dox
new file mode 100644
index 00000000..df4c457c
--- /dev/null
+++ b/Documentation/thread-safety.dox
@@ -0,0 +1,44 @@
+/**
+ * \page thread-safety Reentrancy and Thread-Safety
+ *
+ * Through the documentation, several terms are used to define how classes and
+ * their member functions can be used from multiple threads.
+ *
+ * - A **reentrant** function may be called simultaneously from multiple
+ * threads if and only if each invocation uses a different instance of the
+ * class. This is the default for all member functions not explictly marked
+ * otherwise.
+ *
+ * - \anchor thread-safe A **thread-safe** function may be called
+ * simultaneously from multiple threads on the same instance of a class. A
+ * thread-safe function is thus reentrant. Thread-safe functions may also be
+ * called simultaneously with any other reentrant function of the same class
+ * on the same instance.
+ *
+ * \internal
+ * - \anchor thread-bound A **thread-bound** function may be called only from
+ * the thread that the class instances lives in (see section \ref
+ * thread-objects). For instances of classes that do not derive from the
+ * Object class, this is the thread in which the instance was created. A
+ * thread-bound function is not thread-safe, and may or may not be reentrant.
+ * \endinternal
+ *
+ * Neither reentrancy nor thread-safety, in this context, mean that a function
+ * may be called simultaneously from the same thread, for instance from a
+ * callback invoked by the function. This may deadlock and isn't allowed unless
+ * separately documented.
+ *
+ * \if internal
+ * A class is defined as reentrant, thread-safe or thread-bound if all its
+ * member functions are reentrant, thread-safe or thread-bound respectively.
+ * \else
+ * A class is defined as reentrant or thread-safe if all its member functions
+ * are reentrant or thread-safe respectively.
+ * \endif
+ * Some member functions may additionally be documented as having additional
+ * thread-related attributes.
+ *
+ * Most classes are reentrant but not thread-safe, as making them fully
+ * thread-safe would incur locking costs considered prohibitive for the
+ * expected use cases.
+ */