summaryrefslogtreecommitdiff
path: root/utils/gen-ipa-priv-key.sh
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-06-09 00:27:14 +0300
committerUmang Jain <umang.jain@ideasonboard.com>2021-06-09 10:47:27 +0530
commit529a3c4e43f68576ba4a09d0d8a8e271a211a200 (patch)
tree8870d121a0769e66497ada32b1e5571e6cc6eda6 /utils/gen-ipa-priv-key.sh
parent6914fc487f6a861fcce295f37ffe8a5079921b0d (diff)
ipa: ipu3: Fix struct/class mismatch in forward declaration
The ipu3_agc.h forward-declares the IPACameraSensorInfo structure, but incorrectly declares it as a class. This causes a compilation error with clang: include/libcamera/ipa/core_ipa_interface.h:24:1: error: 'IPACameraSensorInfo' defined as a struct here but previously declared as a class; this is valid, but may result in linker errors under the Microsoft C++ ABI [-Werror,-Wmismatched-tags] struct IPACameraSensorInfo ^ ../../src/ipa/ipu3/ipu3_agc.h:21:1: note: did you mean struct here? class IPACameraSensorInfo; ^~~~~ struct Fix it. Fixes: 384a53d3cdf7 ("ipa: ipu3: Calculate line duration from IPACameraSensorInfo") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Tested-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Diffstat (limited to 'utils/gen-ipa-priv-key.sh')
0 files changed, 0 insertions, 0 deletions
f='#n174'>174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
 * Copyright (C) 2018, Google Inc.
 *
 * camera_manager.h - Camera management
 */

#include <libcamera/camera_manager.h>

#include <condition_variable>
#include <map>

#include <libcamera/camera.h>
#include <libcamera/event_dispatcher.h>

#include "libcamera/internal/device_enumerator.h"
#include "libcamera/internal/event_dispatcher_poll.h"
#include "libcamera/internal/log.h"
#include "libcamera/internal/pipeline_handler.h"
#include "libcamera/internal/thread.h"
#include "libcamera/internal/utils.h"

/**
 * \file camera_manager.h
 * \brief The camera manager
 */

namespace libcamera {

LOG_DEFINE_CATEGORY(Camera)

class CameraManager::Private : public Thread
{
public:
	Private(CameraManager *cm);

	int start();
	void addCamera(std::shared_ptr<Camera> &camera, dev_t devnum);
	void removeCamera(Camera *camera);

	/*
	 * This mutex protects
	 *
	 * - initialized_ and status_ during initialization
	 * - cameras_ and camerasByDevnum_ after initialization
	 */
	Mutex mutex_;
	std::vector<std::shared_ptr<Camera>> cameras_;
	std::map<dev_t, std::weak_ptr<Camera>> camerasByDevnum_;

protected:
	void run() override;

private:
	int init();
	void cleanup();

	CameraManager *cm_;

	std::condition_variable cv_;
	bool initialized_;
	int status_;

	std::vector<std::shared_ptr<PipelineHandler>> pipes_;
	std::unique_ptr<DeviceEnumerator> enumerator_;
};

CameraManager::Private::Private(CameraManager *cm)
	: cm_(cm), initialized_(false)
{
}

int CameraManager::Private::start()
{
	int status;

	/* Start the thread and wait for initialization to complete. */
	Thread::start();

	{
		MutexLocker locker(mutex_);
		cv_.wait(locker, [&] { return initialized_; });
		status = status_;
	}

	/* If a failure happened during initialization, stop the thread. */
	if (status < 0) {
		exit();
		wait();
		return status;
	}