summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2022-08-21ipa: rkisp1: Add enable field for AWB algorithm in IPA contextFlorian Sylvestre
Add an enable variable in the awb struct in IPASessionConfiguration which indicates if the AWB hardware module is enabled. This will allow other algorithms to retrieve this information. Signed-off-by: Florian Sylvestre <fsylvestre@baylibre.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-08-21libcamera: yaml_parser: De-duplicate common code in YamlObject::get()Laurent Pinchart
The specializations of the YamlObject::get() function template for integer types duplicate code that doesn't directly depend on the template type argument. Move it to separate helper functions to reduce the object size. While at it, rephrase the comment about unsigned integer parsing. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-08-21libcamera: yaml_parser: Enable YamlObject::get() for int8_t and uint8_tLaurent Pinchart
The YamlObject::get() function template is implemented for 16-bit and 32-bit integers. Add an 8-bit specialization that will be used in the rkisp1 IPA module, and extend the unit tests accordingly. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-08-21libcamera: yaml_parser: Fix bounds checking for 16-bit YamlObject::get()Laurent Pinchart
The YamlObject::get() function specializations for 16-bit integers cast the return value of strto(u)l() to a 16-bit integer, rendering the bounds checking useless. Fix them. Fixes: c7d260c03abd ("libcamera: yaml_parser: Add get() specializations for 16-bit integers") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-08-21libcamera: pipeline: rkisp1: Remove unused assignmentChristian Rauch
The variable 'ret' is assigned but not read until after the next assignment. Signed-off-by: Christian Rauch <Rauch.Christian@gmx.de> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-08-21libcamera: Remove unused headersChristian Rauch
These headers are not used as reported by clangd. Signed-off-by: Christian Rauch <Rauch.Christian@gmx.de> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-08-20libcamera: v4l2: Set colorspace flagsUmang Jain
The colorspace fields are read-only from an application point of view, both on video devices and on subdevs, unless the V4L2_PIX_FMT_FLAG_SET_CSC or V4L2_MBUS_FRAMEFMT_SET_CSC flags (respectively) are set when calling the S_FMT ioctl. Set the flags accordingly within the V4L2SubDevice and V4L2Device when a colorspace is being set by the application. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-08-19ipa: rkisp1: Add manual color gainsPaul Elder
Add support for manually controlling the color gains on the rkisp1 IPA. To that end, add and plumb the AwbEnable and ColourGains controls. As per-frame controls aren't supported yet in the rkisp1 IPA, simply apply and perform checks on the controls immediately. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-08-19py: Switch to non-blocking eventfdTomi Valkeinen
Blocking wait can be easily implemented on top in Python, so rather than supporting only blocking reads, or supporting both non-blocking and blocking reads, let's support only non-blocking reads. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-08-19py: Use libcamera's Mutex classesTomi Valkeinen
Use libcamera's Mutex and MutexLocker instead of the std versions to get thread safety annotations. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-08-19py: Set EFD_CLOEXEC on eventfd to avoid fd leakingTomi Valkeinen
Set EFD_CLOEXEC on eventfd to avoid fd leaking. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-08-19py: Use UniqueFDTomi Valkeinen
Use UniqueFD to automate the eventfd lifetime management. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-08-19py: Create PyCameraManagerTomi Valkeinen
Wrap the CameraManager with a PyCameraManager class and move the related code inside the new class. This helps understanding the life times of the used-to-be global variables, gets rid of static handleRequestCompleted function, and allows us to simplify the binding code as the more complex pieces are inside the class. There should be no user visible functional changes. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-08-19py: meson: Use libcamera_private dependencyTomi Valkeinen
We define -DLIBCAMERA_BASE_PRIVATE to get access to libcamera private headers, but the correct way to do this is to have a meson dependency to libcamera_private. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-08-18py: cam.py: Remove todo commentTomi Valkeinen
The comment is no longer valid. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-08-18py: Move ControlValue helpers to py_helpers.cppTomi Valkeinen
Clean up the py_main.cpp a bit by moving the ControlValue helpers to a separate file. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-08-18py: Add Python logging categoryTomi Valkeinen
Add Python logging category, and use it in handleRequestCompleted(). Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-08-18py: cam.py: Fix multi camera capture without -CTomi Valkeinen
-C flag is supposed to affect only the camera that was previously defined in the arguments. That's not the case, and, e.g.: cam.py -c2 -C -c3 causes camera 3 to start capturing, but it stops after the initial Requests have been completed. Fix the issue by filtering out camera contexts that do not have -C defined. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-08-16libcamera: base: Make message.h and mutex.h privateLaurent Pinchart
The message.h and mutex.h headers are not used in the libcamera public API. Make them private to avoid there usage in applications, and to prevent having to maintain them with a stable ABI. As mutex.h is used by libcamerasrc, the GStreamer element must switch from the libcamera_public to the libcamera_private dependency. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-08-16meson: Use dependency() instead of find_library() where possibleLaurent Pinchart
Usage of find_library() to find dependencies that libcamera needs to compile against can lead to the library being found even if the corresponding headers are not installed. This will then result in a compilation failure. Switch to dependency() for libdw, libunwind and lttng-ust to fix this, all three libraries come with a pkgconfig file that is usually installed by the distribution package that contains the library headers. Reported-by: Christian Rauch <Rauch.Christian@gmx.de> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-08-10libcamera: Allow concurrent use of cameras from same pipeline handlerLaurent Pinchart
libcamera implements a pipeline handler locking mechanism based on advisory locks on media devices, to prevent concurrent access to cameras from the same pipeline handler from different processes (this only works between multiple libcamera instances, as other processes won't use advisory locks on media devices). A side effect of the implementation prevents multiple cameras created by the same pipeline handler from being used concurrently. Fix this by turning the PipelineHandler lock() and unlock() functions into acquire() and release(), with a use count to replace the boolean lock flag. The Camera class is updated accordingly. As a consequence of this change, the IPU3 pipeline handler will fail to operate properly when the cameras it exposes are operated concurrently. The android.hardware.camera2.cts.MultiViewTest#testDualCameraPreview test fails as a result. This should be fixed in the IPU3 pipeline handler to implement mutual exclusion between cameras. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: David Plowman <david.plowman@raspberrypi.com>
2022-08-10libcamera: formats: Fix warning for unknown V4L2 pixfmtJacopo Mondi
Commit f25ad4a2b16b ("libcamera: formats: Reimplement V4L2 PixelFormatInfo::info()") changed the PixelFormatInfo::info(const V4L2PixelFormat &format) function overload to: return info(format.toPixelFormat()); As part of the series that contains such commit, the PixelFormatInfo for the pixel format applied to a video device is now retrieved at V4L2VideoDevice::open() time. Some video devices register formats not available to applications, for example metadata formats or, in the case of ISP devices, formats to describe the ISP statistics and parameters. This causes the format.toPixelFormat() call to output a WARN message, which spams the log and unnecessarily alerts the users. Augment V4L2PixelFormat::toPixelFormat() with an optional argument to suppress warnings in the case a V4L2 pixel format is not known, to restore the behaviour preceding commit f25ad4a2b16b and returns an invalid PixelFormatInfo without outputting any unnecessary warning message. Fixes: f25ad4a2b16b ("libcamera: formats: Reimplement V4L2 PixelFormatInfo::info()") Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-08-09ipa: ipu3: Add YAML tuning file supportLaurent Pinchart
Replace the manual instantiation of algorithms with an automatic mechanism based on a tuning data file, provided by the Module base class. This brings the IPU3 IPA module in line with the RkISP1 IPA module. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-08-09ipa: ipu3: Register algorithmsLaurent Pinchart
To prepare for dynamic instantiation of algorithms from the tuning file, register the algorithms with the Module class. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-08-09ipa: ipu3: Add an uncalibrated.yaml tuning data fileLaurent Pinchart
Add a tuning data file for uncalibrated sensors, picked by the pipeline handler when no sensor-specific tuning file is available. The file lists the 5 algorithms currently instantiated by the IPA module. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-08-09pipeline: ipu3: Support IPA tuning fileLaurent Pinchart
Pass the path name of the YAML IPA tuning file to the IPA module. The file name is derived from the sensor name ("${sensor_name}.yaml"), with a fallback to "uncalibrated.yaml". Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-08-09libcamera: yaml_parser: Return nullopt on error from YamlObject::get()Laurent Pinchart
The YamlParser::get<>() function returns an std::optional<> to indicate when YAML parsing failed. The current implementation returns a default constructed std::optional in case of errors with return {}; This has been reported as generating compiler warnings with a gcc 9.3.0 arm64 cross-compiler: ../src/libcamera/yaml_parser.cpp:184:11: error: ‘<anonymous>’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 184 | return {}; | ^ Replace this with an explicit return std::nullopt; which fixes the warnings and conveys the purpose more explicitly. Reported-by: Christian Rauch <Rauch.Christian@gmx.de> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-08-09cam: sdl_texture: Rename 'pitch' to 'stride'Laurent Pinchart
The libcamera public API uses 'stride' to refer to the line stride. Rename the SDLTexture::pitch_ member variable for consistency. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Eric Curtin <ecurtin@redhat.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-08-09ipa: rkisp1: Remove unused algorithms includes from rkisp1.cppDaniel Semkowicz
Algorithms are now created dynamically basing on tuning file, so there is no longer dependency on specific algorithms. Signed-off-by: Daniel Semkowicz <dse@thaumatec.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-08-09libcamera: Make IPA module signing recommended instead of mandatoryLaurent Pinchart
Commit b382f67c833d ("libcamera: Make IPA module signing mandatory for the meantime") made openssl and gnutls dependencies mandatory to work around the lack of proper IPA module isolation support, which broke operation without module signatures. This has now been fixed, so IPA module isolation isn't strictly required anymore. There are few use cases for disabling module signing completely, given that the openssl or gnutls dependencies are available on the vast majority of systems and the overheard introduced by isolating all IPA modules when signatures are not available is better avoided. Nonetheless, libcamera should operate properly with forced IPA module isolation, so we can support those use cases. Adopt a middle-ground approach to avoid unintentional isolation by documenting the dependencies as recommended, and warn at meson setup time if they are not found. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Eric Curtin <ecurtin@redhat.com> Reviewed-by: Eric Curtin <ecurtin@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-08-09libcamera: pub_key: Support openssl as an alternative to gnutlsLaurent Pinchart
Support verify IPA signatures with openssl as an alternative to gnutls, to offer more flexibility in the selection of dependencies. Use gnutls by default, for no specific reason as both are equally well supported. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Eric Curtin <ecurtin@redhat.com> Reviewed-by: Eric Curtin <ecurtin@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-08-09libcamera: pub_key: Gracefully handle failures to load public keyLaurent Pinchart
If the public key fails to load, PubKey::isValid() function returns false. The only user of the PubKey class, the IPAManager class, doesn't check that condition, and still calls the PubKey::verify() function, which leads to a crash. Fix this by returning false from PubKey::verify() if the key isn't valid, and log a warning in the IPAManager constructor to report the issue. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Eric Curtin <ecurtin@redhat.com> Reviewed-by: Eric Curtin <ecurtin@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-08-09libcamera: meson: Use dependency() to find gnutlsLaurent Pinchart
The gnutls library ships a pkgconfig .pc file. Use the standard dependency() method to locate it, instead of cc.find_library(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Eric Curtin <ecurtin@redhat.com> Reviewed-by: Eric Curtin <ecurtin@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-08-09libcamera: controls: Generate and use fixed-sized Span typesChristian Rauch
Define Span types explicitly as either variable- or fixed-sized. This introduces a new convention for defining Span dimensions in the property and control value definitions and generates Span types as variable-sized Span<T> or as fixed-sized Span<T,N>. Signed-off-by: Christian Rauch <Rauch.Christian@gmx.de> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-08-09cam: kms_sink: Scale the frame buffer to full screen if supportedLaurent Pinchart
The KMS sink currently displays the frame buffer on the top-left corner of the screen, resulting in either a black area on the bottom and right sides (if the frame buffer is smaller than the display resolution) of in a restricted field of view (if the frame buffer is larger than the display resolution). Improve this by scaling the frame buffer to full screen if supported, and aligning the crop rectangle to the frame buffer center if the field of view needs to be restricted. The implementation test for possible composition options, from best to worst. The tests are performed when the camera is started, as testing atomic commits requires access to frame buffer objects, which are not available at configure time. Changing this would require either a large refactoring of the cam application to provide frame buffers earlier, or extending the KMS API to support testing commits with dummy buffer objects. Both are candidates for later development. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Eric Curtin <ecurtin@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-08-09cam: kms_sink: Make lifetime management of DRM request saferLaurent Pinchart
The drmRequest is KMSSink::processRequest() is created as a naked pointer, passed to the constructor of the KMSSink::Request object that stores it in a std::unique_ptr<>, and used later in the function. The current implementation is safe, but could be prone to both memory leaks and use-after-free bugs if modified. Improve it by replacing the naked pointer with a std::unique_ptr<>. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Eric Curtin <ecurtin@redhat.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-08-09cam: drm: Add support for test-only commitsLaurent Pinchart
Test-only commits are used to test a commit without applying any modification to the device. This will be used by the KMS sink to test feature support. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Eric Curtin <ecurtin@redhat.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-08-08cam: sdl_sink: Fix compilation with SDL2 <2.0.16Laurent Pinchart
The SDL_UpdateNVTexture() function, used for NV12 texture support, has been introduced in SDL2 2.0.16. Compiling against older SDL versions fails with ../src/cam/sdl_texture_yuv.cpp: In member function ‘virtual void SDLTextureNV12::update(const std::vector<libcamera::Span<const unsigned char> >&)’: ../src/cam/sdl_texture_yuv.cpp:19:2: error: ‘SDL_UpdateNVTexture’ was not declared in this scope; did you mean ‘SDL_UpdateYUVTexture’? 19 | SDL_UpdateNVTexture(ptr_, &rect_, data[0].data(), pitch_, | ^~~~~~~~~~~~~~~~~~~ | SDL_UpdateYUVTexture Fix it with conditional compilation based on the SDL version. Fixes: 7b8df9fe6b3e ("cam: sdl_sink: Add NV12 texture support") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Eric Curtin <ecurtin@redhat.com>
2022-08-08cam: sdl_sink: Add NV12 texture supportLaurent Pinchart
Extend the SDL sink with support for NV12 textures, useful on platforms that don't support packed YUYV formats. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Eric Curtin <ecurtin@redhat.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-08-08cam: sdl_sink: Support multi-planar formatsLaurent Pinchart
In order to prepare for NV12 support, implement support for multi-planar formats in the SDL sink. This mainly consists in passing a vector of plane data to the SDLTexture::update() function instead of a single value. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Eric Curtin <ecurtin@redhat.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-08-08cam: Rename sdl_texture_yuyv.{cpp,h} to sdl_texture_yuv.{cpp,h}Laurent Pinchart
In preparation for the addition of NV12 support in the SDL sink, rename the sdl_texture_yuyv.{cpp,h} files to just "yuv". Separate sdl_texture_nv12.{cpp,h} files could be added instead, but given how short the implementation will be, grouping all YUV formats in a single file is better. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Eric Curtin <ecurtin@redhat.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-08-08cam: sdl_texture_yuyv: Make line stride configurableLaurent Pinchart
The line stride of the texture is currently hardcoded based on the image width, which may not match the real stride. Use the stride value from the stream configuration instead. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Eric Curtin <ecurtin@redhat.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-08-04libcamera: Correct typos and omissions for packed 10-bit raw monochrome formatDavid Plowman
One typo is corrected, and this format is added to one further table where it was missing entirely. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-08-04libcamera: Switch internal YAML files to YAML 1.1Laurent Pinchart
The python3-yaml package (containing the PyYAML Python package) shipped by Debian stable is documented as a YAML 1.1 parser: Python3-yaml is a complete YAML 1.1 parser and emitter for Python3. PyYAML doesn't implement YAML 1.2 support, but ignores the minor number of the YAML directive, and thus doesn't choke on the libcamera internal files used to generate format- and control-related source code that explicitly state conformance with YAML 1.2. Still, given that we don't use any feature of YAML 1.2, and that the tuning data files now use YAML 1.1, switch the internal YAML files to version 1.1 as well for consistency. The main drawback of YAML 1.1 is that the unquoted literal strings Yes, No, On and Off will be parsed as booleans. We need to be careful to avoid those values in YAML files, until libcamera can switch to YAML 1.2 once more recent versions of libyaml get shipped by the distributions we want to support. This is however not an issue introduced by this change, as the existing YAML 1.2 files were parsed with the YAML 1.1 string literal parsing rules anyway. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Florian Sylvestre <fsylvestre@baylibre.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-08-04ipa: rkisp1: Use YAML 1.1 for tuning data filesLaurent Pinchart
YAML 1.2 support has been added in libyaml in version 0.2.3. Debian stable ships version 0.2.2 of libyaml, which causes parse errors of the tuning tuning data files due to the YAML 1.2 directive at the beginning. As we don't use any feature of YAML 1.2, downgrade the data files to YAML 1.1. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Florian Sylvestre <fsylvestre@baylibre.com> Reviewed-by: Florian Sylvestre <fsylvestre@baylibre.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-08-04pipeline: rkisp1: Move ControlInfoMap to IPA moduleLaurent Pinchart
Currently the pipeline handler advertises controls handled by the IPA from a ControlInfoMap it manually constructs. This is wrong, as the IPA module is the component that knows what controls it supports. Fix this by moving the ControlInfoMap construction to the IPA module, and pass it to the pipeline handler as a return value from the IPA init() function. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Florian Sylvestre <fsylvestre@baylibre.com>
2022-08-03libcamera: pipeline: simple: Add support for NXP ISILaurent Pinchart
Several NXP i.MX8 SoCs (such as the i.MX8MN and i.MX8MP) contain a camera pipeline made of sensor interfaces (with parallel and/or CSI-2 receivers) and an image processing engine named ISI. The ISI contains an input crossbar switch and one or more processing pipelines capable of format conversion and scaling. This is a good candidate for the simple pipeline handler as a first step. The i.MX8MP should eventually graduate to having its own pipeline handler as it also contains two ISP instances (supported by the rkisp1 driver). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Tested-by: Jacopo Mondi <jacopo@jmondi.org>
2022-08-03libcamera: pipeline: simple: Don't disable links carrying other streamsLaurent Pinchart
If a subdev supports the internal routing API, pads unrelated to the pipeline for a given camera sensor may carry streams for other cameras. The link setup logic is updated to take this into account, by avoiding disabling links to unrelated pads. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-08-03libcamera: pipeline: simple: Walk pipeline using subdev internal routingPhi-Bang Nguyen
When traversing the media graph to discover a pipeline from the camera sensor to a video node, all sink-to-source paths inside subdevs are considered. This can lead to invalid paths being followed, when a subdev has restrictions on its internal routing. The V4L2 API supports exposing subdev internal routing to userspace. Make use of this feature, when implemented by a subdev, to restrict the internal paths to the currently active routes. If a subdev doesn't implement the internal routing operations, all source pads are considered, as done today. This change is needed to properly support multiple sensors with devices such as the NXP i.MX8 ISI or the MediaTek i350 and i500 SENINF. Support for changing routes dynamically will be added later when required. Signed-off-by: Phi-Bang Nguyen <pnguyen@baylibre.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Tested-by: Jacopo Mondi <jacopo@jmondi.org>
2022-08-03libcamera: pipeline: simple: Setup links in the context of sink entitiesLaurent Pinchart
To setup links the pipeline handler iterates over all entities in the pipeline and disables all links but the ones we want to enable. Some entities don't allow multiple sink links to be enabled, so the iteration needs to be based on sink entities, disabling all their links first and then enabling the sink link that is part of the pipeline. The loop implementation iterates over all Entity instances, and uses their source link to locate the MediaEntity for the connected sink. The sink entity is then processed in the context of the source's loop iteration. This prevents the code from being able to access extra information about the sink entity, as we only have access to the MediaEntity, not the Entity. To prepare for subdev routing support that will require accessing additional entity information, refactor the loop to process the sink entity in the context of its Entity instance. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Tested-by: Jacopo Mondi <jacopo@jmondi.org>