[libcamera-devel,v2,13/20] build: ipa: Fix bug in building multiple IPA interfaces with the same mojom file
diff mbox series

Message ID 20231013074841.16972-14-naush@raspberrypi.com
State Accepted
Headers show
Series
  • Raspberry Pi: Preliminary PiSP support
Related show

Commit Message

Naushir Patuck Oct. 13, 2023, 7:48 a.m. UTC
In the existing meson scripts, an IPA mojom interface file may not be
built if:

- There are duplicate entries for the mojom file shared by different
  pipeline handlers in pipeline_ipa_mojom_mapping, and
- The IPA is not listed first in pipeline_ipa_mojom_mapping, and
- The first listed IPA for the given mojom file is not selected in the
  build.

Fix this by using a separate list of already built mojom files
(mojoms_built) instead of overloading use of the existing
ipa_mojom_files list.  Now, ipa_mojom_files gets filled in outside of
the IPA list enumeration loop, this also guarantees the IPA
documentation gets built even if the pipeline is not selected.

Fixes: 312e9910ba2e ("meson: ipa: Add mapping for pipeline handler to mojom interface file")
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
---
 include/libcamera/ipa/meson.build | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

Comments

Jacopo Mondi Oct. 13, 2023, 7:58 a.m. UTC | #1
Hi Naush

On Fri, Oct 13, 2023 at 08:48:34AM +0100, Naushir Patuck via libcamera-devel wrote:
> In the existing meson scripts, an IPA mojom interface file may not be
> built if:
>
> - There are duplicate entries for the mojom file shared by different
>   pipeline handlers in pipeline_ipa_mojom_mapping, and
> - The IPA is not listed first in pipeline_ipa_mojom_mapping, and
> - The first listed IPA for the given mojom file is not selected in the
>   build.
>
> Fix this by using a separate list of already built mojom files
> (mojoms_built) instead of overloading use of the existing
> ipa_mojom_files list.  Now, ipa_mojom_files gets filled in outside of
> the IPA list enumeration loop, this also guarantees the IPA
> documentation gets built even if the pipeline is not selected.
>
> Fixes: 312e9910ba2e ("meson: ipa: Add mapping for pipeline handler to mojom interface file")
> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>

Thanks for the updated commit message

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

Thanks
  j

> ---
>  include/libcamera/ipa/meson.build | 19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/include/libcamera/ipa/meson.build b/include/libcamera/ipa/meson.build
> index e72803b4e243..f3b4881c9c91 100644
> --- a/include/libcamera/ipa/meson.build
> +++ b/include/libcamera/ipa/meson.build
> @@ -68,29 +68,28 @@ pipeline_ipa_mojom_mapping = {
>      'vimc': 'vimc.mojom',
>  }
>
> -ipa_mojom_files = []
> -ipa_mojoms = []
> -
>  #
>  # Generate headers from templates.
>  #
>
>  # TODO Define per-pipeline ControlInfoMap with yaml?
>
> +ipa_mojoms = []
> +mojoms_built = []
>  foreach pipeline, file : pipeline_ipa_mojom_mapping
>      name = file.split('.')[0]
>
> -    # Ensure we do not build duplicate mojom modules
> -    if file in ipa_mojom_files
> +    # Avoid building duplicate mojom interfaces with the same interface file
> +    if name in mojoms_built
>          continue
>      endif
>
> -    ipa_mojom_files += file
> -
>      if pipeline not in pipelines
>          continue
>      endif
>
> +    mojoms_built += name
> +
>      # {interface}.mojom-module
>      mojom = custom_target(name + '_mojom_module',
>                            input : file,
> @@ -155,6 +154,12 @@ foreach pipeline, file : pipeline_ipa_mojom_mapping
>      libcamera_generated_ipa_headers += [header, serializer, proxy_header]
>  endforeach
>
> +ipa_mojom_files = []
> +foreach pipeline, file : pipeline_ipa_mojom_mapping
> +    if file not in ipa_mojom_files
> +        ipa_mojom_files += file
> +    endif
> +endforeach
>  ipa_mojom_files = files(ipa_mojom_files)
>
>  # Pass this to the documentation generator in src/libcamera/ipa
> --
> 2.34.1
>

Patch
diff mbox series

diff --git a/include/libcamera/ipa/meson.build b/include/libcamera/ipa/meson.build
index e72803b4e243..f3b4881c9c91 100644
--- a/include/libcamera/ipa/meson.build
+++ b/include/libcamera/ipa/meson.build
@@ -68,29 +68,28 @@  pipeline_ipa_mojom_mapping = {
     'vimc': 'vimc.mojom',
 }
 
-ipa_mojom_files = []
-ipa_mojoms = []
-
 #
 # Generate headers from templates.
 #
 
 # TODO Define per-pipeline ControlInfoMap with yaml?
 
+ipa_mojoms = []
+mojoms_built = []
 foreach pipeline, file : pipeline_ipa_mojom_mapping
     name = file.split('.')[0]
 
-    # Ensure we do not build duplicate mojom modules
-    if file in ipa_mojom_files
+    # Avoid building duplicate mojom interfaces with the same interface file
+    if name in mojoms_built
         continue
     endif
 
-    ipa_mojom_files += file
-
     if pipeline not in pipelines
         continue
     endif
 
+    mojoms_built += name
+
     # {interface}.mojom-module
     mojom = custom_target(name + '_mojom_module',
                           input : file,
@@ -155,6 +154,12 @@  foreach pipeline, file : pipeline_ipa_mojom_mapping
     libcamera_generated_ipa_headers += [header, serializer, proxy_header]
 endforeach
 
+ipa_mojom_files = []
+foreach pipeline, file : pipeline_ipa_mojom_mapping
+    if file not in ipa_mojom_files
+        ipa_mojom_files += file
+    endif
+endforeach
 ipa_mojom_files = files(ipa_mojom_files)
 
 # Pass this to the documentation generator in src/libcamera/ipa