.. SPDX-License-Identifier: CC-BY-SA-4.0 ========== Licenses ========== TL;DR summary: The libcamera core is covered by the LGPL-2.1-or-later license. IPA modules included in libcamera are covered by a free software license. Third-parties may develop IPA modules outside of libcamera and distribute them under a closed-source license, provided they do not include source code from the libcamera project. The libcamera project contains multiple libraries, applications and utilities. Licenses are expressed through SPDX tags in text-based files that support comments, and through the .reuse/dep5 file otherwise. A copy of all licenses is stored in the LICENSES directory. The following text summarizes the licenses covering the different components of the project to offer a quick overview for developers. The SPDX and DEP5 information are however authoritative and shall prevail in case of inconsistencies with the text below. The libcamera core source code, located under the include/libcamera/ and src/libcamera/ directories, is fully covered by the LGPL-2.1-or-later license, which thus covers distribution of the libcamera.so binary. Other files located in those directories, most notably the meson build files, and various related build scripts, may be covered by different licenses. None of their source code is incorporated in the in the libcamera.so binary, they thus don't affect the distribution terms of the binary. The IPA modules, located in src/ipa/, are covered by free software licenses chosen by the module authors. The LGPL-2.1-or-later license is recommended. Those modules are compiled as separate binaries and dynamically loaded by the libcamera core at runtime. The IPA module API is defined in headers located in include/libcamera/ipa/ and covered by the LGPL-2.1-or-later license. Using the data types (including classes, structures and enumerations) and macros defined in the IPA module and libcamera core API headers in IPA modules doesn't extend the LGPL license to the IPA modules. Third-party closed-source IPA modules are thus permitted, provided they comply with the licensing requirements of any software they include or link to. The libcamera Android camera HAL component is located in src/android/. The libcamera-specific source code is covered by the LGPL-2.1-or-later license. The component additionally contains header files and source code, located respectively in include/android/ and src/android/metadata/, copied verbatim from Android and covered by the Apache-2.0 license. The libcamera GStreamer and V4L2 adaptation source code, located respectively in src/gstreamer/ and src/v4l2/, is fully covered by the LGPL-2.1-or-later license. Those components are compiled to separate binaries and do not influence the license of the libcamera core. The cam and qcam sample applications, as well as the unit tests, located respectively in src/cam/, src/qcam/ and test/, are covered by the GPL-2.0-or-later license. qcam additionally includes an icon set covered by the MIT license. Those applications are compiled to separate binaries and do not influence the license of the libcamera core. Additional utilities are located in the utils/ directory and are covered by various licenses. They are not part of the libcamera core and do not influence its license. Finally, copies of various Linux kernel headers are included in include/linux/ to avoid depending on particular versions of those headers being installed in the system. The Linux kernel headers are covered by their respective license, including the Linux kernel license syscall exception. Using a copy of those headers doesn't affect libcamera licensing terms in any way compared to using the same headers installed in the system from kernel headers packages provided by Linux distributions. method='get' action='/libcamera/jmondi/libcamera.git/log/test/ipa/ipa_interface_test.cpp'>
path: root/test/ipa/ipa_interface_test.cpp
blob: 43562e60850604bb8431230f8e5c302e549f44fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * Copyright (C) 2019, Google Inc.
 *
 * ipa_interface_test.cpp - Test the IPA interface
 */

#include <fcntl.h>
#include <iostream>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>

#include <libcamera/ipa/vimc_ipa_proxy.h>

#include <libcamera/base/event_dispatcher.h>
#include <libcamera/base/event_notifier.h>
#include <libcamera/base/thread.h>
#include <libcamera/base/timer.h>

#include "libcamera/internal/device_enumerator.h"
#include "libcamera/internal/ipa_manager.h"
#include "libcamera/internal/ipa_module.h"
#include "libcamera/internal/pipeline_handler.h"
#include "libcamera/internal/process.h"

#include "test.h"

using namespace std;
using namespace libcamera;

class IPAInterfaceTest : public Test, public Object
{
public:
	IPAInterfaceTest()
		: trace_(ipa::vimc::IPAOperationNone), notifier_(nullptr), fd_(-1)
	{
	}

	~IPAInterfaceTest()
	{
		delete notifier_;
		ipa_.reset();
		ipaManager_.reset();
	}

protected:
	int init() override
	{
		ipaManager_ = make_unique<IPAManager>();

		/* Create a pipeline handler for vimc. */
		std::vector<PipelineHandlerFactory *> &factories =
			PipelineHandlerFactory::factories();
		for (PipelineHandlerFactory *factory : factories) {
			if (factory->name() == "PipelineHandlerVimc") {
				pipe_ = factory->create(nullptr);
				break;
			}
		}

		if (!pipe_) {
			cerr << "Vimc pipeline not found" << endl;
			return TestPass;
		}

		/* Create and open the communication FIFO. */
		int ret = mkfifo(ipa::vimc::VimcIPAFIFOPath.c_str(), S_IRUSR | S_IWUSR);
		if (ret) {
			ret = errno;
			cerr << "Failed to create IPA test FIFO at '"
			     << ipa::vimc::VimcIPAFIFOPath << "': " << strerror(ret)
			     << endl;
			return TestFail;
		}

		ret = open(ipa::vimc::VimcIPAFIFOPath.c_str(), O_RDONLY | O_NONBLOCK);
		if (ret < 0) {
			ret = errno;
			cerr << "Failed to open IPA test FIFO at '"
			     << ipa::vimc::VimcIPAFIFOPath << "': " << strerror(ret)
			     << endl;
			unlink(ipa::vimc::VimcIPAFIFOPath.c_str());
			return TestFail;
		}
		fd_ = ret;