[libcamera-devel,1/2] libcamera: ipa_manager: Only parse IPA modules
diff mbox series

Message ID 20230501155507.116039-2-kieran.bingham@ideasonboard.com
State Superseded
Headers show
Series
  • V4L2 Compatibility installation directory
Related show

Commit Message

Kieran Bingham May 1, 2023, 3:55 p.m. UTC
Ensure that when we iterate the libcamera libdir we only select shared
objects which are expected to be IPA modules, with an ipa_ prefix.

Any shared object not matching this filter is ignored and not processed
by the IPA Manager.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 src/libcamera/ipa_manager.cpp | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Javier Martinez Canillas May 3, 2023, 12:55 p.m. UTC | #1
On 5/1/23 17:55, Kieran Bingham wrote:
> Ensure that when we iterate the libcamera libdir we only select shared
> objects which are expected to be IPA modules, with an ipa_ prefix.
> 
> Any shared object not matching this filter is ignored and not processed
> by the IPA Manager.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> ---

Was this only needed for patch #2 that was adding the v4l2-compat.so in
the same directory where the IPA modules are installed? I guess that it
makes sense in general to have this filter, but maybe another option is
to move all the IPA modules to a $libdir/libcamera/ipa sub-directory ?
Kieran Bingham May 3, 2023, 2:04 p.m. UTC | #2
Quoting Javier Martinez Canillas (2023-05-03 13:55:02)
> On 5/1/23 17:55, Kieran Bingham wrote:
> > Ensure that when we iterate the libcamera libdir we only select shared
> > objects which are expected to be IPA modules, with an ipa_ prefix.
> > 
> > Any shared object not matching this filter is ignored and not processed
> > by the IPA Manager.
> > 
> > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> > ---
> 
> Was this only needed for patch #2 that was adding the v4l2-compat.so in
> the same directory where the IPA modules are installed? I guess that it

Yes. ... 

> makes sense in general to have this filter, but maybe another option is

Yes I think it still makes sense as an extra check...

> to move all the IPA modules to a $libdir/libcamera/ipa sub-directory ?

And yes, I think this also makes sense too!

--
Kieran


> 
> -- 
> Best regards,
> 
> Javier Martinez Canillas
> Core Platforms
> Red Hat
>
Javier Martinez Canillas May 3, 2023, 4:15 p.m. UTC | #3
Kieran Bingham <kieran.bingham@ideasonboard.com> writes:

> Quoting Javier Martinez Canillas (2023-05-03 13:55:02)
>> On 5/1/23 17:55, Kieran Bingham wrote:
>> > Ensure that when we iterate the libcamera libdir we only select shared
>> > objects which are expected to be IPA modules, with an ipa_ prefix.
>> > 
>> > Any shared object not matching this filter is ignored and not processed
>> > by the IPA Manager.
>> > 
>> > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
>> > ---
>> 
>> Was this only needed for patch #2 that was adding the v4l2-compat.so in
>> the same directory where the IPA modules are installed? I guess that it
>
> Yes. ... 
>
>> makes sense in general to have this filter, but maybe another option is
>
> Yes I think it still makes sense as an extra check...
>

Ok, if you want to have it anyways as en extra check, makes sense to me.

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

Patch
diff mbox series

diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp
index 030ef43fb994..c0c2f027e902 100644
--- a/src/libcamera/ipa_manager.cpp
+++ b/src/libcamera/ipa_manager.cpp
@@ -206,6 +206,10 @@  void IPAManager::parseDir(const char *libDir, unsigned int maxDepth,
 		if (strcmp(&ent->d_name[offset], ".so"))
 			continue;
 
+		/* Ignore any modules which are not IPAs. */
+		if (strncmp(ent->d_name, "ipa_", 4) != 0)
+			continue;
+
 		files.push_back(std::string(libDir) + "/" + ent->d_name);
 	}