summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/base/file.h4
-rw-r--r--include/libcamera/base/memfd.h34
-rw-r--r--include/libcamera/base/meson.build1
-rw-r--r--include/libcamera/control_ids.h.in42
-rw-r--r--include/libcamera/internal/camera_manager.h7
-rw-r--r--include/libcamera/internal/ipa_manager.h9
-rw-r--r--include/libcamera/internal/ipa_proxy.h3
-rw-r--r--include/libcamera/internal/meson.build18
-rw-r--r--include/libcamera/internal/pipeline_handler.h2
-rw-r--r--include/libcamera/internal/yaml_parser.h1
-rw-r--r--include/libcamera/ipa/ipa_interface.h3
-rw-r--r--include/libcamera/ipa/meson.build29
-rw-r--r--include/libcamera/meson.build38
-rw-r--r--include/libcamera/property_ids.h.in34
14 files changed, 136 insertions, 89 deletions
diff --git a/include/libcamera/base/file.h b/include/libcamera/base/file.h
index 5637934c..6d3f106d 100644
--- a/include/libcamera/base/file.h
+++ b/include/libcamera/base/file.h
@@ -7,10 +7,10 @@
#pragma once
-#include <sys/types.h>
-
#include <map>
+#include <stdint.h>
#include <string>
+#include <sys/types.h>
#include <libcamera/base/private.h>
diff --git a/include/libcamera/base/memfd.h b/include/libcamera/base/memfd.h
new file mode 100644
index 00000000..b0edd2de
--- /dev/null
+++ b/include/libcamera/base/memfd.h
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+/*
+ * Copyright (C) 2024, Ideas on Board Oy
+ *
+ * Anonymous file creation
+ */
+
+#pragma once
+
+#include <stddef.h>
+
+#include <libcamera/base/flags.h>
+#include <libcamera/base/unique_fd.h>
+
+namespace libcamera {
+
+class MemFd
+{
+public:
+ enum class Seal {
+ None = 0,
+ Shrink = (1 << 0),
+ Grow = (1 << 1),
+ };
+
+ using Seals = Flags<Seal>;
+
+ static UniqueFD create(const char *name, std::size_t size,
+ Seals seals = Seal::None);
+};
+
+LIBCAMERA_FLAGS_ENABLE_OPERATORS(MemFd::Seal)
+
+} /* namespace libcamera */
diff --git a/include/libcamera/base/meson.build b/include/libcamera/base/meson.build
index bace25d5..2a0cee31 100644
--- a/include/libcamera/base/meson.build
+++ b/include/libcamera/base/meson.build
@@ -21,6 +21,7 @@ libcamera_base_private_headers = files([
'event_notifier.h',
'file.h',
'log.h',
+ 'memfd.h',
'message.h',
'mutex.h',
'private.h',
diff --git a/include/libcamera/control_ids.h.in b/include/libcamera/control_ids.h.in
index 293ba966..858ef872 100644
--- a/include/libcamera/control_ids.h.in
+++ b/include/libcamera/control_ids.h.in
@@ -2,7 +2,7 @@
/*
* Copyright (C) 2019, Google Inc.
*
- * Control ID list
+ * {{mode|capitalize}} ID list
*
* This file is auto-generated. Do not edit.
*/
@@ -18,18 +18,42 @@
namespace libcamera {
-namespace controls {
+namespace {{mode}} {
-enum {
-${ids}
-};
+extern const ControlIdMap {{mode}};
+
+{%- for vendor, ctrls in controls -%}
-${controls}
+{% if vendor != 'libcamera' %}
+namespace {{vendor}} {
-extern const ControlIdMap controls;
+#define LIBCAMERA_HAS_{{vendor|upper}}_VENDOR_{{mode|upper}}
+{%- endif %}
-${vendor_controls}
+enum {
+{%- for ctrl in ctrls %}
+ {{ctrl.name|snake_case|upper}} = {{ctrl.id}},
+{%- endfor %}
+};
-} /* namespace controls */
+{% for ctrl in ctrls -%}
+{% if ctrl.is_enum -%}
+enum {{ctrl.name}}Enum {
+{%- for enum in ctrl.enum_values %}
+ {{enum.name}} = {{enum.value}},
+{%- endfor %}
+};
+extern const std::array<const ControlValue, {{ctrl.enum_values_count}}> {{ctrl.name}}Values;
+extern const std::map<std::string, {{ctrl.type}}> {{ctrl.name}}NameValueMap;
+{% endif -%}
+extern const Control<{{ctrl.type}}> {{ctrl.name}};
+{% endfor -%}
+
+{% if vendor != 'libcamera' %}
+} /* namespace {{vendor}} */
+{% endif -%}
+
+{% endfor %}
+} /* namespace {{mode}} */
} /* namespace libcamera */
diff --git a/include/libcamera/internal/camera_manager.h b/include/libcamera/internal/camera_manager.h
index af9ed60a..e098cb69 100644
--- a/include/libcamera/internal/camera_manager.h
+++ b/include/libcamera/internal/camera_manager.h
@@ -19,13 +19,14 @@
#include <libcamera/base/thread.h>
#include <libcamera/base/thread_annotations.h>
-#include "libcamera/internal/ipa_manager.h"
#include "libcamera/internal/process.h"
namespace libcamera {
class Camera;
class DeviceEnumerator;
+class IPAManager;
+class PipelineHandlerFactoryBase;
class CameraManager::Private : public Extensible::Private, public Thread
{
@@ -38,6 +39,8 @@ public:
void addCamera(std::shared_ptr<Camera> camera) LIBCAMERA_TSA_EXCLUDES(mutex_);
void removeCamera(std::shared_ptr<Camera> camera) LIBCAMERA_TSA_EXCLUDES(mutex_);
+ IPAManager *ipaManager() const { return ipaManager_.get(); }
+
protected:
void run() override;
@@ -62,7 +65,7 @@ private:
std::unique_ptr<DeviceEnumerator> enumerator_;
- IPAManager ipaManager_;
+ std::unique_ptr<IPAManager> ipaManager_;
ProcessManager processManager_;
};
diff --git a/include/libcamera/internal/ipa_manager.h b/include/libcamera/internal/ipa_manager.h
index c6f74e11..16dede0c 100644
--- a/include/libcamera/internal/ipa_manager.h
+++ b/include/libcamera/internal/ipa_manager.h
@@ -15,6 +15,7 @@
#include <libcamera/ipa/ipa_interface.h>
#include <libcamera/ipa/ipa_module_info.h>
+#include "libcamera/internal/camera_manager.h"
#include "libcamera/internal/ipa_module.h"
#include "libcamera/internal/pipeline_handler.h"
#include "libcamera/internal/pub_key.h"
@@ -34,11 +35,13 @@ public:
uint32_t minVersion,
uint32_t maxVersion)
{
- IPAModule *m = self_->module(pipe, minVersion, maxVersion);
+ CameraManager *cm = pipe->cameraManager();
+ IPAManager *self = cm->_d()->ipaManager();
+ IPAModule *m = self->module(pipe, minVersion, maxVersion);
if (!m)
return nullptr;
- std::unique_ptr<T> proxy = std::make_unique<T>(m, !self_->isSignatureValid(m));
+ std::unique_ptr<T> proxy = std::make_unique<T>(m, !self->isSignatureValid(m));
if (!proxy->isValid()) {
LOG(IPAManager, Error) << "Failed to load proxy";
return nullptr;
@@ -55,8 +58,6 @@ public:
#endif
private:
- static IPAManager *self_;
-
void parseDir(const char *libDir, unsigned int maxDepth,
std::vector<std::string> &files);
unsigned int addDir(const char *libDir, unsigned int maxDepth = 0);
diff --git a/include/libcamera/internal/ipa_proxy.h b/include/libcamera/internal/ipa_proxy.h
index ed6a5bcf..0f564d99 100644
--- a/include/libcamera/internal/ipa_proxy.h
+++ b/include/libcamera/internal/ipa_proxy.h
@@ -31,7 +31,8 @@ public:
bool isValid() const { return valid_; }
- std::string configurationFile(const std::string &file) const;
+ std::string configurationFile(const std::string &name,
+ const std::string &fallbackName = std::string()) const;
protected:
std::string resolvePath(const std::string &file) const;
diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build
index 9713ea1c..1c5eef9c 100644
--- a/include/libcamera/internal/meson.build
+++ b/include/libcamera/internal/meson.build
@@ -2,13 +2,6 @@
subdir('tracepoints')
-libcamera_tracepoint_header = custom_target(
- 'tp_header',
- input : ['tracepoints.h.in', tracepoint_files],
- output : 'tracepoints.h',
- command : [gen_tracepoints_header, include_build_dir, '@OUTPUT@', '@INPUT@'],
-)
-
libcamera_internal_headers = files([
'bayer_format.h',
'byte_stream_buffer.h',
@@ -28,9 +21,11 @@ libcamera_internal_headers = files([
'dma_buf_allocator.h',
'formats.h',
'framebuffer.h',
+ 'ipa_data_serializer.h',
'ipa_manager.h',
'ipa_module.h',
'ipa_proxy.h',
+ 'ipc_pipe.h',
'ipc_unixsocket.h',
'mapped_framebuffer.h',
'media_device.h',
@@ -49,5 +44,14 @@ libcamera_internal_headers = files([
'yaml_parser.h',
])
+tracepoints_h = custom_target(
+ 'tp_header',
+ input : ['tracepoints.h.in', tracepoint_files],
+ output : 'tracepoints.h',
+ command : [gen_tracepoints, include_build_dir, '@OUTPUT@', '@INPUT@'],
+)
+
+libcamera_internal_headers += tracepoints_h
+
subdir('converter')
subdir('software_isp')
diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h
index 746a34f8..cad5812f 100644
--- a/include/libcamera/internal/pipeline_handler.h
+++ b/include/libcamera/internal/pipeline_handler.h
@@ -70,6 +70,8 @@ public:
const char *name() const { return name_; }
+ CameraManager *cameraManager() const { return manager_; }
+
protected:
void registerCamera(std::shared_ptr<Camera> camera);
void hotplugMediaDevice(MediaDevice *media);
diff --git a/include/libcamera/internal/yaml_parser.h b/include/libcamera/internal/yaml_parser.h
index e38a2df9..16708e48 100644
--- a/include/libcamera/internal/yaml_parser.h
+++ b/include/libcamera/internal/yaml_parser.h
@@ -10,6 +10,7 @@
#include <iterator>
#include <map>
#include <optional>
+#include <stdint.h>
#include <string>
#include <vector>
diff --git a/include/libcamera/ipa/ipa_interface.h b/include/libcamera/ipa/ipa_interface.h
index 53cf5377..7c835e98 100644
--- a/include/libcamera/ipa/ipa_interface.h
+++ b/include/libcamera/ipa/ipa_interface.h
@@ -7,10 +7,9 @@
#pragma once
+#include <map>
#include <stddef.h>
#include <stdint.h>
-
-#include <map>
#include <vector>
#include <libcamera/base/flags.h>
diff --git a/include/libcamera/ipa/meson.build b/include/libcamera/ipa/meson.build
index 3352d08f..bf55e124 100644
--- a/include/libcamera/ipa/meson.build
+++ b/include/libcamera/ipa/meson.build
@@ -11,8 +11,6 @@ libcamera_ipa_headers = files([
install_headers(libcamera_ipa_headers,
subdir : libcamera_ipa_include_dir)
-libcamera_generated_ipa_headers = []
-
ipa_headers_install_dir = get_option('includedir') / libcamera_ipa_include_dir
#
@@ -28,10 +26,11 @@ ipa_mojom_core = custom_target(core_mojom_file.split('.')[0] + '_mojom_module',
'--output-root', meson.project_build_root(),
'--input-root', meson.project_source_root(),
'--mojoms', '@INPUT@'
- ])
+ ],
+ env : py_build_env)
# core_ipa_interface.h
-libcamera_generated_ipa_headers += custom_target('core_ipa_interface_h',
+libcamera_ipa_headers += custom_target('core_ipa_interface_h',
input : ipa_mojom_core,
output : 'core_ipa_interface.h',
depends : mojom_templates,
@@ -44,10 +43,11 @@ libcamera_generated_ipa_headers += custom_target('core_ipa_interface_h',
'--libcamera_generate_core_header',
'--libcamera_output_path=@OUTPUT@',
'./' +'@INPUT@'
- ])
+ ],
+ env : py_build_env)
# core_ipa_serializer.h
-libcamera_generated_ipa_headers += custom_target('core_ipa_serializer_h',
+libcamera_ipa_headers += custom_target('core_ipa_serializer_h',
input : ipa_mojom_core,
output : 'core_ipa_serializer.h',
depends : mojom_templates,
@@ -58,7 +58,8 @@ libcamera_generated_ipa_headers += custom_target('core_ipa_serializer_h',
'--libcamera_generate_core_serializer',
'--libcamera_output_path=@OUTPUT@',
'./' +'@INPUT@'
- ])
+ ],
+ env : py_build_env)
# Mapping from pipeline handler name to mojom file
pipeline_ipa_mojom_mapping = {
@@ -101,7 +102,8 @@ foreach pipeline, file : pipeline_ipa_mojom_mapping
'--output-root', meson.project_build_root(),
'--input-root', meson.project_source_root(),
'--mojoms', '@INPUT@'
- ])
+ ],
+ env : py_build_env)
# {interface}_ipa_interface.h
header = custom_target(name + '_ipa_interface_h',
@@ -117,7 +119,8 @@ foreach pipeline, file : pipeline_ipa_mojom_mapping
'--libcamera_generate_header',
'--libcamera_output_path=@OUTPUT@',
'./' +'@INPUT@'
- ])
+ ],
+ env : py_build_env)
# {interface}_ipa_serializer.h
serializer = custom_target(name + '_ipa_serializer_h',
@@ -131,7 +134,8 @@ foreach pipeline, file : pipeline_ipa_mojom_mapping
'--libcamera_generate_serializer',
'--libcamera_output_path=@OUTPUT@',
'./' +'@INPUT@'
- ])
+ ],
+ env : py_build_env)
# {interface}_ipa_proxy.h
proxy_header = custom_target(name + '_proxy_h',
@@ -145,14 +149,15 @@ foreach pipeline, file : pipeline_ipa_mojom_mapping
'--libcamera_generate_proxy_h',
'--libcamera_output_path=@OUTPUT@',
'./' +'@INPUT@'
- ])
+ ],
+ env : py_build_env)
ipa_mojoms += {
'name': name,
'mojom': mojom,
}
- libcamera_generated_ipa_headers += [header, serializer, proxy_header]
+ libcamera_ipa_headers += [header, serializer, proxy_header]
endforeach
ipa_mojom_files = []
diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build
index 84c6c4cb..a969a95d 100644
--- a/include/libcamera/meson.build
+++ b/include/libcamera/meson.build
@@ -47,7 +47,9 @@ controls_map = {
control_headers = []
controls_files = []
+controls_files_names = []
properties_files = []
+properties_files_names = []
foreach mode, entry : controls_map
files_list = []
@@ -70,13 +72,15 @@ foreach mode, entry : controls_map
outfile = ''
if mode == 'controls'
outfile = 'control_ids.h'
- controls_files += files_list
+ controls_files += input_files
+ controls_files_names += files_list
else
outfile = 'property_ids.h'
- properties_files += files_list
+ properties_files += input_files
+ properties_files_names += files_list
endif
- template_file = files(outfile + '.in')
+ template_file = files('control_ids.h.in')
ranges_file = files('../../src/libcamera/control_ranges.yaml')
control_headers += custom_target(header + '_h',
input : input_files,
@@ -84,6 +88,7 @@ foreach mode, entry : controls_map
command : [gen_controls, '-o', '@OUTPUT@',
'--mode', mode, '-t', template_file,
'-r', ranges_file, '@INPUT@'],
+ env : py_build_env,
install : true,
install_dir : libcamera_headers_install_dir)
endforeach
@@ -103,24 +108,25 @@ formats_h = custom_target('formats_h',
install_dir : libcamera_headers_install_dir)
libcamera_public_headers += formats_h
+# version.h
+version = libcamera_version.split('.')
+libcamera_version_config = configuration_data()
+libcamera_version_config.set('LIBCAMERA_VERSION_MAJOR', version[0])
+libcamera_version_config.set('LIBCAMERA_VERSION_MINOR', version[1])
+libcamera_version_config.set('LIBCAMERA_VERSION_PATCH', version[2])
+
+version_h = configure_file(input : 'version.h.in',
+ output : 'version.h',
+ configuration : libcamera_version_config,
+ install_dir : libcamera_headers_install_dir)
+libcamera_public_headers += version_h
+
# libcamera.h
libcamera_h = custom_target('gen-header',
input : 'meson.build',
output : 'libcamera.h',
- command : [gen_header, meson.current_source_dir(), '@OUTPUT@'],
+ command : [gen_header, '@OUTPUT@', libcamera_public_headers],
install : true,
install_dir : libcamera_headers_install_dir)
libcamera_public_headers += libcamera_h
-
-# version.h
-version = libcamera_version.split('.')
-libcamera_version_config = configuration_data()
-libcamera_version_config.set('LIBCAMERA_VERSION_MAJOR', version[0])
-libcamera_version_config.set('LIBCAMERA_VERSION_MINOR', version[1])
-libcamera_version_config.set('LIBCAMERA_VERSION_PATCH', version[2])
-
-configure_file(input : 'version.h.in',
- output : 'version.h',
- configuration : libcamera_version_config,
- install_dir : libcamera_headers_install_dir)
diff --git a/include/libcamera/property_ids.h.in b/include/libcamera/property_ids.h.in
deleted file mode 100644
index e6edabca..00000000
--- a/include/libcamera/property_ids.h.in
+++ /dev/null
@@ -1,34 +0,0 @@
-/* SPDX-License-Identifier: LGPL-2.1-or-later */
-/*
- * Copyright (C) 2019, Google Inc.
- *
- * Property ID list
- *
- * This file is auto-generated. Do not edit.
- */
-
-#pragma once
-
-#include <map>
-#include <stdint.h>
-#include <string>
-
-#include <libcamera/controls.h>
-
-namespace libcamera {
-
-namespace properties {
-
-enum {
-${ids}
-};
-
-${controls}
-
-extern const ControlIdMap properties;
-
-${vendor_controls}
-
-} /* namespace properties */
-
-} /* namespace libcamera */