summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2023-11-08 11:09:51 +0000
committerNaushir Patuck <naush@raspberrypi.com>2023-11-29 09:05:37 +0000
commitbd6658943a97288b5673e65649a3a48dac7c78da (patch)
tree669e796221586b40d21639fa1f3c4de27fa15e08 /include
parent61f6b372421ad96e283220c2c7beb1cb298b1eaf (diff)
controls: Add vendor control/property support to generation scripts
Add support for vendor-specific controls and properties to libcamera. The controls/properties are defined by a "vendor" tag in the YAML control description file, for example: vendor: rpi controls: - MyExampleControl: type: string description: | Test for libcamera vendor-specific controls. This will now generate a control id in the libcamera::controls::rpi namespace, ensuring no id conflict between different vendors, core or draft libcamera controls. Similarly, a ControlIdMap control is generated in the libcamera::controls::rpi namespace. A #define LIBCAMERA_HAS_RPI_VENDOR_CONTROLS is also generated to allow applications to conditionally compile code if the specific vendor controls are present. For the python bindings, the control is available with libcamera.controls.rpi.MyExampleControl. The above controls example applies similarly to properties. Existing libcamera controls defined in control_ids.yaml are given the "libcamera" vendor tag. A new --mode flag is added to gen-controls.py to specify the mode of operation, either 'controls' or 'properties' to allow the code generator to correctly set the #define string. As a drive-by, sort and redefine the output command line argument in gen-controls.py and gen-py-controls.py to ('--output', '-o') for consistency. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/control_ids.h.in2
-rw-r--r--include/libcamera/meson.build15
-rw-r--r--include/libcamera/property_ids.h.in2
3 files changed, 12 insertions, 7 deletions
diff --git a/include/libcamera/control_ids.h.in b/include/libcamera/control_ids.h.in
index 0718a888..c97b09a8 100644
--- a/include/libcamera/control_ids.h.in
+++ b/include/libcamera/control_ids.h.in
@@ -32,6 +32,8 @@ ${draft_controls}
} /* namespace draft */
+${vendor_controls}
+
} /* namespace controls */
} /* namespace libcamera */
diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build
index a24c50d6..2c8c0258 100644
--- a/include/libcamera/meson.build
+++ b/include/libcamera/meson.build
@@ -32,20 +32,21 @@ install_headers(libcamera_public_headers,
libcamera_headers_install_dir = get_option('includedir') / libcamera_include_dir
-# control_ids.h and property_ids.h
-control_source_files = [
- 'control_ids',
- 'property_ids',
-]
+# control_ids.h and property_ids.h and associated modes
+control_source_files = {
+ 'control_ids': 'controls',
+ 'property_ids': 'properties',
+}
control_headers = []
-foreach header : control_source_files
+foreach header, mode : control_source_files
input_files = files('../../src/libcamera/' + header +'.yaml', header + '.h.in')
control_headers += custom_target(header + '_h',
input : input_files,
output : header + '.h',
- command : [gen_controls, '-o', '@OUTPUT@', '@INPUT@'],
+ command : [gen_controls, '-o', '@OUTPUT@', '@INPUT@',
+ '--mode', mode],
install : true,
install_dir : libcamera_headers_install_dir)
endforeach
diff --git a/include/libcamera/property_ids.h.in b/include/libcamera/property_ids.h.in
index ff019408..47c5d6bf 100644
--- a/include/libcamera/property_ids.h.in
+++ b/include/libcamera/property_ids.h.in
@@ -31,6 +31,8 @@ ${draft_controls}
extern const ControlIdMap properties;
+${vendor_controls}
+
} /* namespace properties */
} /* namespace libcamera */