summaryrefslogtreecommitdiff
path: root/.reuse
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2021-03-13 10:27:41 +0000
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-03-13 22:21:01 +0200
commit4f4f8bb8bc994b209e86633764066ef8c665a437 (patch)
treea06c0692aba0469a7013b25485424e528156de09 /.reuse
parentcd3f70a14c69d2cc86dd483249d1943a80947be1 (diff)
pipeline: raspberrypi: Use a default format for ISP::Output0
If the ISP::Output0 stream has not been configured, we must enable it with a default format and resolution for internal use. This is to allow the pipeline handler data flow to be consistent, and allow the IPA to receive statistics for the frame. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to '.reuse')
0 files changed, 0 insertions, 0 deletions
8 109 110 111 112 113 114 115 116 117
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
 * Copyright (C) 2019, Google Inc.
 *
 * camera3_hal.cpp - Android Camera HALv3 module
 */

#include <hardware/camera_common.h>

#include "libcamera/internal/log.h"

#include "camera_device.h"
#include "camera_hal_manager.h"

using namespace libcamera;

LOG_DEFINE_CATEGORY(HAL)

static CameraHalManager cameraManager;

/*------------------------------------------------------------------------------
 * Android Camera HAL callbacks
 */

static int hal_get_number_of_cameras()
{
	return cameraManager.numCameras();
}

static int hal_get_camera_info(int id, struct camera_info *info)
{
	return cameraManager.getCameraInfo(id, info);
}

static int hal_set_callbacks(const camera_module_callbacks_t *callbacks)
{
	cameraManager.setCallbacks(callbacks);

	return 0;
}

static int hal_open_legacy([[maybe_unused]] const struct hw_module_t *module,
			   [[maybe_unused]] const char *id,
			   [[maybe_unused]] uint32_t halVersion,
			   [[maybe_unused]] struct hw_device_t **device)
{
	return -ENOSYS;
}

static int hal_set_torch_mode([[maybe_unused]] const char *camera_id,
			      [[maybe_unused]] bool enabled)
{
	return -ENOSYS;
}

/*
 * First entry point of the camera HAL module.
 *
 * Initialize the HAL but does not open any camera device yet (see hal_dev_open)
 */
static int hal_init()
{
	LOG(HAL, Info) << "Initialising Android camera HAL";

	cameraManager.init();

	return 0;
}

/*------------------------------------------------------------------------------
 * Android Camera Device
 */

static int hal_dev_open(const hw_module_t *module, const char *name,
			hw_device_t **device)
{
	LOG(HAL, Debug) << "Open camera " << name;

	int id = atoi(name);
	CameraDevice *camera = cameraManager.open(id, module);
	if (!camera) {
		LOG(HAL, Error)
			<< "Failed to open camera module '" << id << "'";
		return -ENODEV;
	}

	*device = &camera->camera3Device()->common;

	return 0;
}

static struct hw_module_methods_t hal_module_methods = {
	.open = hal_dev_open,
};

camera_module_t HAL_MODULE_INFO_SYM = {
	.common = {
		.tag = HARDWARE_MODULE_TAG,
		.module_api_version = CAMERA_MODULE_API_VERSION_2_4,
		.hal_api_version = HARDWARE_HAL_API_VERSION,
		.id = CAMERA_HARDWARE_MODULE_ID,
		.name = "libcamera camera HALv3 module",
		.author = "libcamera",
		.methods = &hal_module_methods,
		.dso = nullptr,
		.reserved = {},
	},

	.get_number_of_cameras = hal_get_number_of_cameras,
	.get_camera_info = hal_get_camera_info,
	.set_callbacks = hal_set_callbacks,
	.get_vendor_tag_ops = nullptr,
	.open_legacy = hal_open_legacy,
	.set_torch_mode = hal_set_torch_mode,
	.init = hal_init,
	.reserved = {},
};