[v2] libcamera: controls: Generate macro for each control
diff mbox series

Message ID 20250325134231.1394418-1-barnabas.pocze@ideasonboard.com
State New
Headers show
Series
  • [v2] libcamera: controls: Generate macro for each control
Related show

Commit Message

Barnabás Pőcze March 25, 2025, 1:42 p.m. UTC
Generate a macro in the form of LIBCAMERA_HAS_$VENDOR_VENDOR_$MODE_$NAME
for each control so that its existence can be checked easily and without
extra version checks.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
changes in v2:
  * rename macro from `LIBCAMERA_HAS_$VENDOR_$MODE_$NAME` to
    `LIBCAMERA_HAS_$VENDOR_VENDOR_$MODE_$NAME` so that has the
                          ^^^^^^^
    name of the macro already generated for the control namespaces
    as prefix

v1: https://patchwork.libcamera.org/patch/22972/
---
 include/libcamera/control_ids.h.in | 1 +
 1 file changed, 1 insertion(+)

--
2.49.0

Comments

Kieran Bingham June 27, 2025, 9:41 a.m. UTC | #1
Quoting Barnabás Pőcze (2025-03-25 13:42:31)
> Generate a macro in the form of LIBCAMERA_HAS_$VENDOR_VENDOR_$MODE_$NAME
> for each control so that its existence can be checked easily and without
> extra version checks.
> 
> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

This has two tags ... but is still in my inbox/reported as 'New' in
patchwork. Is it ready to merge?

--
Kieran

> ---
> changes in v2:
>   * rename macro from `LIBCAMERA_HAS_$VENDOR_$MODE_$NAME` to
>     `LIBCAMERA_HAS_$VENDOR_VENDOR_$MODE_$NAME` so that has the
>                           ^^^^^^^
>     name of the macro already generated for the control namespaces
>     as prefix
> 
> v1: https://patchwork.libcamera.org/patch/22972/
> ---
>  include/libcamera/control_ids.h.in | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/libcamera/control_ids.h.in b/include/libcamera/control_ids.h.in
> index 5d0594c68..6b5712339 100644
> --- a/include/libcamera/control_ids.h.in
> +++ b/include/libcamera/control_ids.h.in
> @@ -49,6 +49,7 @@ extern const std::array<const ControlValue, {{ctrl.enum_values_count}}> {{ctrl.n
>  extern const std::map<std::string, {{ctrl.type}}> {{ctrl.name}}NameValueMap;
>  {% endif -%}
>  extern const Control<{{ctrl.type}}> {{ctrl.name}};
> +#define LIBCAMERA_HAS_{{vendor|upper}}_VENDOR_{{mode|upper}}_{{ctrl.name|snake_case|upper}}
>  {% endfor -%}
> 
>  {% if vendor != 'libcamera' %}
> --
> 2.49.0
Barnabás Pőcze June 27, 2025, 10:06 a.m. UTC | #2
2025. 06. 27. 11:41 keltezéssel, Kieran Bingham írta:
> Quoting Barnabás Pőcze (2025-03-25 13:42:31)
>> Generate a macro in the form of LIBCAMERA_HAS_$VENDOR_VENDOR_$MODE_$NAME
>> for each control so that its existence can be checked easily and without
>> extra version checks.
>>
>> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
>> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
>> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> This has two tags ... but is still in my inbox/reported as 'New' in
> patchwork. Is it ready to merge?

I think so.

> 
> --
> Kieran
> 
>> ---
>> changes in v2:
>>    * rename macro from `LIBCAMERA_HAS_$VENDOR_$MODE_$NAME` to
>>      `LIBCAMERA_HAS_$VENDOR_VENDOR_$MODE_$NAME` so that has the
>>                            ^^^^^^^
>>      name of the macro already generated for the control namespaces
>>      as prefix
>>
>> v1: https://patchwork.libcamera.org/patch/22972/
>> ---
>>   include/libcamera/control_ids.h.in | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/include/libcamera/control_ids.h.in b/include/libcamera/control_ids.h.in
>> index 5d0594c68..6b5712339 100644
>> --- a/include/libcamera/control_ids.h.in
>> +++ b/include/libcamera/control_ids.h.in
>> @@ -49,6 +49,7 @@ extern const std::array<const ControlValue, {{ctrl.enum_values_count}}> {{ctrl.n
>>   extern const std::map<std::string, {{ctrl.type}}> {{ctrl.name}}NameValueMap;
>>   {% endif -%}
>>   extern const Control<{{ctrl.type}}> {{ctrl.name}};
>> +#define LIBCAMERA_HAS_{{vendor|upper}}_VENDOR_{{mode|upper}}_{{ctrl.name|snake_case|upper}}
>>   {% endfor -%}
>>
>>   {% if vendor != 'libcamera' %}
>> --
>> 2.49.0

Patch
diff mbox series

diff --git a/include/libcamera/control_ids.h.in b/include/libcamera/control_ids.h.in
index 5d0594c68..6b5712339 100644
--- a/include/libcamera/control_ids.h.in
+++ b/include/libcamera/control_ids.h.in
@@ -49,6 +49,7 @@  extern const std::array<const ControlValue, {{ctrl.enum_values_count}}> {{ctrl.n
 extern const std::map<std::string, {{ctrl.type}}> {{ctrl.name}}NameValueMap;
 {% endif -%}
 extern const Control<{{ctrl.type}}> {{ctrl.name}};
+#define LIBCAMERA_HAS_{{vendor|upper}}_VENDOR_{{mode|upper}}_{{ctrl.name|snake_case|upper}}
 {% endfor -%}

 {% if vendor != 'libcamera' %}