libcamera
v0.8.0
Supporting cameras in Linux since 2019
Toggle main menu visibility
Loading...
Searching...
No Matches
ipa_manager.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: LGPL-2.1-or-later */
2
/*
3
* Copyright (C) 2019, Google Inc.
4
*
5
* Image Processing Algorithm module manager
6
*/
7
8
#pragma once
9
10
#include <memory>
11
#include <stdint.h>
12
#include <vector>
13
14
#include <
libcamera/base/log.h
>
15
16
#include <
libcamera/ipa/ipa_interface.h
>
17
#include <
libcamera/ipa/ipa_module_info.h
>
18
19
#include "
libcamera/internal/pub_key.h
"
20
21
namespace
libcamera
{
22
23
LOG_DECLARE_CATEGORY
(
IPAManager
)
24
25
class
CameraManager
;
26
class
GlobalConfiguration
;
27
class
IPAModule
;
28
29
class
IPAManager
30
{
31
public
:
32
IPAManager
(
const
CameraManager
&cm);
33
~IPAManager
();
34
35
template
<
typename
T>
36
std::unique_ptr<T>
createIPA
(
const
char
*name, uint32_t minVersion,
37
uint32_t maxVersion)
38
{
39
IPAModule
*m = module(name, minVersion, maxVersion);
40
if
(!m)
41
return
nullptr
;
42
43
auto
proxy = [&]() -> std::unique_ptr<T> {
44
if
(isSignatureValid(m))
45
return
std::make_unique<typename T::Threaded>(m, cm_);
46
else
47
return
std::make_unique<typename T::Isolated>(m, cm_);
48
}();
49
50
if
(!proxy->isValid()) {
51
LOG
(
IPAManager
, Error) <<
"Failed to load proxy"
;
52
return
nullptr
;
53
}
54
55
return
proxy;
56
}
57
58
#if HAVE_IPA_PUBKEY
59
static
const
PubKey
&
pubKey
()
60
{
61
return
pubKey_;
62
}
63
#endif
64
65
private
:
66
void
parseDir(
const
char
*libDir,
unsigned
int
maxDepth,
67
std::vector<std::string> &files);
68
unsigned
int
addDir(
const
char
*libDir,
unsigned
int
maxDepth = 0);
69
70
IPAModule
*module(
const
char
*name, uint32_t minVersion,
71
uint32_t maxVersion);
72
73
bool
isSignatureValid(
IPAModule
*
ipa
)
const
;
74
75
const
CameraManager
&cm_;
76
std::vector<std::unique_ptr<IPAModule>> modules_;
77
78
#if HAVE_IPA_PUBKEY
79
static
const
uint8_t publicKeyData_[];
80
static
const
PubKey
pubKey_;
81
bool
forceIsolation_;
82
#endif
83
};
84
85
}
/* namespace libcamera */
libcamera::CameraManager
Provide access and manage all cameras in the system.
Definition
camera_manager.h:25
libcamera::GlobalConfiguration
Support for global libcamera configuration.
Definition
global_configuration.h:23
libcamera::IPAManager
Manager for IPA modules.
Definition
ipa_manager.h:30
libcamera::IPAManager::createIPA
std::unique_ptr< T > createIPA(const char *name, uint32_t minVersion, uint32_t maxVersion)
Create an IPA proxy that matches a given pipeline handler.
Definition
ipa_manager.h:36
libcamera::IPAManager::IPAManager
IPAManager(const CameraManager &cm)
Construct an IPAManager instance.
Definition
ipa_manager.cpp:107
libcamera::IPAManager::pubKey
static const PubKey & pubKey()
Retrieve the IPA module signing public key.
Definition
ipa_manager.h:59
libcamera::IPAModule
Wrapper around IPA module shared object.
Definition
ipa_module.h:22
libcamera::PubKey
Public key wrapper for signature verification.
Definition
pub_key.h:22
ipa_interface.h
Image Processing Algorithm interface.
ipa_module_info.h
Image Processing Algorithm module information.
log.h
Logging infrastructure.
LOG_DECLARE_CATEGORY
#define LOG_DECLARE_CATEGORY(name)
Declare a category of log messages.
Definition
log.h:51
LOG
#define LOG(category, severity)
Log a message.
Definition
log.h:155
libcamera::ipa
The IPA (Image Processing Algorithm) namespace.
Definition
af.cpp:58
libcamera
Top-level libcamera namespace.
Definition
backtrace.h:17
pub_key.h
Public key signature verification.
include
libcamera
internal
ipa_manager.h
Generated by
1.17.0