summaryrefslogtreecommitdiff
path: root/src/libcamera
AgeCommit message (Collapse)Author
2020-04-30libcamera: v4l2_pixelformat: Fix V4L2_PIX_FMT_SBGGR10P formatLaurent Pinchart
The V4L2_PIX_FMT_SBGGR10P format was misspecified as V4L2_PIX_FMT_SBGGR10. Fix it. Fixes: 00d639d951e7 ("libcamera: formats: Add support for 8-, 10- and 12-bit Bayer formats") Reported-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-30libcamera: formats: Add additional data to PixelFormatInfoLaurent Pinchart
Add three additional fields to PixelFormatInfo to report the number of bits per pixel, the colour encoding, and the data packing. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-30libcamera: formats: Add support for 8-, 10- and 12-bit Bayer formatsLaurent Pinchart
Add the 8-, 10- and 12-but Bayer formats, in both unpacked and MIPI-packed variants, to the format tables in PixelFormatInfo and V4L2PixelFormat. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-30libcamera: formats: Expose PixelFormatInfo as an internal APILaurent Pinchart
To prepare for storing more information about pixel formats in PixelFormatInfo, move the class to formats.cpp and document it. The pixel formats database is moved to the same file, and a new static function is added to PixelFormatInfo to retrieve a PixelFormatInfo for a PixelFormat. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-30libcamera: v4l2_pixelformat: Use maps to convert between DRM and V4L2Laurent Pinchart
Replace the two big manual switch...case with maps. This should not just improve efficiency when we will have a larger number of formats, but also paves the way to storing more format information to create additional helpers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-30libcamera: v4l2_pixelformat: Move DRM/V4L2 format conversionLaurent Pinchart
Move the DRM/V4L2 format conversion code from V4L2VideoDevice to V4L2PixelFormat. This is a more natural home for the code. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-30libcamera: v4l2_pixelformat: Move V4L2PixelFormat to a new fileLaurent Pinchart
Move the V4L2PixelFormat class to a new file to prepare for additional changes that will make it grow. No functional modification is included. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-04-30libcamera: utils: Identify the 'real' build pathKieran Bingham
Call realpath() to strip out any levels of indirection required in referencing the root build directory. This simplifies the debug output when reporting and parsing paths. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-04-30libcamera: ipa_manager: Fix build path commentsKieran Bingham
The comments describe functionality before libcameraBuildPath() was adapted from libcameraPath() to return the root of the build, and described having to take a relative path. This is no longer the case, and the comment is inaccurate. Fix it. Fixes: 1b8ac8473c94 ("libcamera: utils: Adapt libcameraPath to match use cases") Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-04-30libcamera: ipa_module: Add log prefixLaurent Pinchart
Make the IPAModule class inherit from Loggable to log the IPA module name in all messages. Before: [14:19:55.743795676] [20250] ERROR IPAModule ipa_module.cpp:279 IPA module is not an ELF file After: [14:20:22.343795887] [20270] ERROR IPAModule ipa_module.cpp:279 ipa_vimc.so: IPA module is not an ELF file Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-04-30libcamera: pipeline: rkisp1: Don't fail if sensorInfo failsDafna Hirschfeld
When starting the streaming, it might be that the call to sensorInfo fails. This does not mean that the camera can't stream so set 'ret' to 0. Fixes: fd554f9dba31 ("libcamera: ipa: Add support for CameraSensorInfo") Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-04-29libcamera: controls: Add sensor black levels reporting through metadataDavid Plowman
The black levels will be used when saving RAW data in DNG containers. Four values are reported, one for each channel, in the order R, Gr, Gb and B. The values are reported as being out of a 16-bit pixel range (a fully saturated pixel would be 65535), so may need subsequent re-scaling, depending on use. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> 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>
2020-04-28libcamera: ipa: Add support for CameraSensorInfoJacopo Mondi
Add support for camera sensor information in the libcamera IPA protocol. Define a new 'struct ipa_sensor_info' structure in the IPA context and use it to perform translation between the C and the C++ API. Update the IPAInterface::configure() operation to accept a new CameraSensorInfo parameter and port all users of that function to the new interface. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-04-28libcamera: camera_sensor: Add method to get sensor infoJacopo Mondi
Add a method to retrieve the CameraSensorInfo to the CameraSensor class. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-04-28libcamera: v4l2_subdevice: Add format informationJacopo Mondi
Define a map of static information associated with a media bus code. Start by reporting the bits-per-pixel for each media bus code defined by the V4L2 kernel API, to later expand it when necessary. Add to the V4L2SubdeviceFormat class a method to return the bits per pixel, retrieved by inspecting the static map of format information. While at it, remove a rogue map inclusion from header file. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-04-28libcamera: camera_sensor: Define CameraSensorInfoJacopo Mondi
Define the CameraSensorInfo structure that reports the current image sensor configuration. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-04-28libcamera: v4l2_subdevice: Implement getSelection()Jacopo Mondi
Implement V4L2Subdevice::getSelection() to support retrieving selection rectangles from the V4L2 subdevice. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-04-28libcamera: v4l2_videodevice: Expose setSelection()Jacopo Mondi
Expose V4L2Videodevice::setSelection() method and drop V4L2Videodevice::setCrop() and V4L2Videodevice::setComopse() as wrapping each target with a single function does not provide any benefit. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-04-28libcamera: v4l2_subdevice: Expose setSelection()Jacopo Mondi
Expose V4L2Subdevice::setSelection() method and drop V4L2Subdevice::setCrop() and V4L2Subdevice::setComopse() as wrapping each target with a single function does not provide any benefit. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-04-28libcamera: pipeline: vimc: Name camera based on sensor modelLaurent Pinchart
Use the sensor model to create the camera name. The resulting name should still be "VIMC Sensor B", but prepares for support of Sensor A. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-04-28libcamera: camera_sensor: Add model() functionLaurent Pinchart
Add a new model() function to the CameraSensor class to report the camera sensor model. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-04-28libcamera: v4l2_device: Simplify usage of getControls()Laurent Pinchart
The V4L2Device::getControls() function takes a ControlList that needs to be pre-populated with dummy entries for the controls that need to be read. This is a cumbersome API, especially when reading a single control. Make it nicer by passing the list of V4L2 controls as a vector of control IDs, and returning a ControlList. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-04-28libcamera: controls: Add rectangle and size control typesLaurent Pinchart
Add two control types to store rectangles and sizes. These will be useful for the properties related to the pixel array. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-04-28libcamera: pipeline: vimc: Pass configuration file to IPA init()Laurent Pinchart
Pass the vimc IPA dummy configuration file to the IPA init() function. This will be used by the IPA to validate the init() call. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-28ipa: Pass IPA initialization settings to IPAInterface::init()Laurent Pinchart
Add a new IPASettings class to pass IPA initialization settings through the IPAInterface::init() method. The settings currently only contain the name of a configuration file, and are expected to be extended later. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-04-28libcamera: ipa_manager: Return an IPAProxy from createIPA()Laurent Pinchart
In order to provide pipeline handlers with IPA-related helpers on top of IPAInterface, return the IPAProxy instance from IPAManager::createIPA(). No change is required in the pipeline handlers as the IPAInterface that was previously returned is implemented by an IPAProxy instance already. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-28libcamera: ipa_proxy: Provide suport for IPA configuration filesLaurent Pinchart
IPA modules may require configuration files, which may be stored in different locations in the file system. To standardize file locations between all IPAs and pipeline handlers, provide a helper function to locate a configuration file by searching in the following directories: - All directories specified in the LIBCAMERA_IPA_CONFIG_PATH environment variable ; or - In the source tree if libcamera is not installed ; otherwise - In standard system locations (etc and share directories). When stored in the source tree, configuration files shall be located in a 'data' subdirectory of their respective IPA directory. More locations, or extensions to the mechanism, may be implemented later. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-28libcamera: ipa_proxy: Don't include <iostream>Laurent Pinchart
The iostream header isn't needed. Drop it. Fixes: c2a8217df54c ("libcamera: add IPA proxy") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-28libcamera: ipa_proxy: Add missing space in info messageLaurent Pinchart
The message printed when loading a proxy worker from the build directory is missing a space. Add it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-04-28libcamera: utils: Add a function to retrieve the libcamera source treeLaurent Pinchart
Similarly to libcameraBuildPath(), there's a need to locate resources within the source tree when running libcamera without installing it. Support this use case with a new utils::libcameraSourcePath() function. The implementation uses a symlink from the build root to the source root in order to avoid hardcoding the path to the source root in the libcamera.so binary. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-28ipa: Name IPA modules after their source directoryLaurent Pinchart
The IPAModuleInfo::name field is currently a free-formed string that has little use. Tighten its usage rules to make it suitable for building file system paths to IPA-specific resources by matching the directory name of the IPA module. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-27libcamera: controls: Add AWB related controlsNaushir Patuck
AwbMode is a new enum type to specify operating mode of the AWB algorithm. All modes may not be supported by all platforms. ColourGains is a new float array type used to specify manual red and blue (in that order) colour channel gains when AWB is disabled. ColourTemperature is a new control to return the current estimate of the colour temperature. 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>
2020-04-27libcamera: controls: Add AE related controlsNaushir Patuck
AeMeteringMode, AeConstraintMode, and AeExposureMode are new enum type controls used to specify operating modes in the AE algorithm. All modes may not be supported by all platforms. ExposureValue is a new control used to set the log2 exposure adjustment for the AE algorithm. Lux is a new control that returns the current lux estimate. 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>
2020-04-27libcamera: controls: Reorder and update description of existing controlsNaushir Patuck
Group AE, AWB, etc. controls together for accessibility. Update descriptions for Contrast, Brightness, and Saturation controls. Update the uvcvideo and vimc pipeline handlers to use the new brightness, contrast and saturation units. UVC has no explicit units for those controls, so map them with a best effort heuristic. For VIMC, hardcode the control range based on knowledge of the driver implementation for simplicity. 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>
2020-04-27libcamera: controls: Updates to gain and exposure controlsNaushir Patuck
Rename: ManualExposure -> ExposureTime ManualGain -> AnalogueGain Use micro-seconds units for ExposureTime. This is changed from milli- seconds. The latter would not allow very low exposure times. AnalogueGain switch to use a float to allow fractional gain adjustments. Update the uvcvideo pipeline handler to use the new exposure and gain units. For ExposureTime, UVC uses units of 100 micro-seconds, so map the values before setting V4L2_CID_EXPOSURE_ABSOLUTE. For AnalogueGain, UVC has no explicit gain units, so map the default gain value to 1.0 and linearly scale to the requested value. 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> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-04-27libcamera: control_ids: Add comment to specify control directionNaushir Patuck
Document that controls are bi-directional by default. If a control is only returned in metadata, this must be specified in the control's description. 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> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-04-27libcamera: pipeline: uvcvideo: Add support for AeEnableLaurent Pinchart
UVC devices support auto-exposure, expose the feature through the AeEnable control. Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-04-27libcamera: pipeline: uvcvideo: Refactor control handlingLaurent Pinchart
Move addition and processing of individual controls to separate functions, to prepare for more complex mappings of control values. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-04-26libcamera: v4l2_videodevice: Add support for frame start eventsLaurent Pinchart
Extend the V4L2VideoDevice to support notifying of frame start events. The events are received from the device through the V4L2 event API, and passed to users of the class through a signal. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-04-26libcamera: v4l2_device: Update documentationJacopo Mondi
Compound controls are now supported, but they're still listed as unsupported in some parts of the V4L2Device class documentation. Fix this by removing those parts. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-04-26libcamera: geometry: Rename Rectangle fieldsJacopo Mondi
The Rectangle class members that represents the rectangle horizontal and vertical sizes are named 'w' and 'h', in contrast with the Size and SizeRange classes which use 'width' and 'height', resulting in having to look at class definition every time to know which names to use. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-04-26libcamera: v4l2_videodevice: Rename fdEvent_ to fdBufferNotifier_Laurent Pinchart
To prepare for the addition of a second notifier for V4L2 events, rename the current fdEvent_ member to fdBufferNotifier_ to better reflect its usage. While at it, simplify allocation of the fdEvent_ notifier. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-04-20libcamera: device_enumerator_udev: Log the right number of missing depsLaurent Pinchart
Since commit e75ef59e028e ("libcamera: device_enumerator_udev: Update pending list in addUdevDevice") the populateMediaDevice() function returns 0 on success instead of the number of missing dependencies, resulting in a wrong number being logged. Fix it. Fixes: e75ef59e028e ("libcamera: device_enumerator_udev: Update pending list in addUdevDevice") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <email@uajain.com>
2020-04-17libcamera: v4l2_videodevice: Return correct format for metadataLaurent Pinchart
When setting format on a metadata video device, the returned format isn't updated with the actual set format due to a typo. Fix it. Reported-by: Coverity CID=279098 Fixes: 629e9301c518 ("libcamera: v4l2_device: Add META support in g/s_fmt") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-16libcamera: gen-ipa-pub-key.py: Wrap lines in generated fileLaurent Pinchart
To make the output more readable, break the publicKeyData_ array at 8 bytes boundaries. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-16libcamera: Make IPA module signing mandatory for the meantimeLaurent Pinchart
IPA module signing is optional, but when not available due to missing dependencies, we hit failures due to a non fully implemented IPA isolation. Make module signing mandatory until isolation is functional. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-16libcamera: Make IPA module signing optionalLaurent Pinchart
The IPA module signing mechanism relies on openssl to generate keys and sign the module. If openssl is not found on the system, the build will fail. Make the dependency optional by detecting openssl, and skip generation of signatures if openssl isn't found. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-15libcamera: v4l2_videodevice: Map V4L2_PIX_FMT_GREY to DRM FourCCLaurent Pinchart
DRM has a format for 8-bit greyscale data, DRM_FORMAT_R8. Despite the 'R' name, which comes from GL/Vulkan to mean single-channel data, the format maps to greyscale for display. We can thus map it to V4L2_PIX_FMT_GREY. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-04-15libcamera: v4l2_videodevice: Downgrade 4CC conversion errors to warningsLaurent Pinchart
Failing to convert between V4L2 and DRM 4CCs indicates something is likely wrong, but doesn't necessarily prevent the camera from being usable. It may for instance only limit the number of supported formats. Downgrade the related log messages from LogError to LogWarning. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-04-15libcamera: v4l2_videodevice: Expose the device capabilitiesLaurent Pinchart
Add a caps() function that exposes the V4L2 capabilities for the device. This is useful for generic code that can't hardcode any a priori knowledge of the device, such as in a simple pipeline handler. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>