summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline
AgeCommit message (Collapse)Author
2022-04-02ipa: vimc: Rename processControls() to queueRequest()Umang Jain
Synchronise with other IPA interfaces (for e.g. IPU3, RkISP1) that uses queueRequest() to pass in the request controls to IPA. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-04-02ipa: rkisp1: Split queuing of request and parameter fillingUmang Jain
Queuing of request (i.e. passing of controls to the IPA) and filling of the parameters buffer are two separate operations. Treat them as such by splitting them into two functions in the rkisp1 IPA interface. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-03-28pipeline: raspberrypi: Repurpose RPi::Stream::reset()Naushir Patuck
The original use of RPi::Stream::reset() was to clear the external flag state and free/clear out the framebuffers for the stream. However, the latter is now done through PipelineHandlerRPi::configure(). Rework PipelineHandlerRPi::configure() to call RPi::Stream::setExternal() instead of RPi::Stream::reset() to achieve the same thing. Repurpose RPi::Stream::reset() to instead reset the state of the buffer handling logic, where all internally allocated buffers are put back into the queue of available buffers. As such, rename the function to RPi::Stream::resetbuffers(). This resetbuffers() is now called from PipelineHandlerRPi::start(), allowing the pipeline handler to correctly deal with start()/stop()/start() sequences and reusing the buffers allocated on the first start(). Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Tested-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-03-28pipeline: raspberrypi: Free buffers in the RPiCamera destructor and re-configureNaushir Patuck
Currently, all framebuffer allocations get freed and cleared on a stop in PipelineHandlerRPi::stopDevice(). If PipelineHandlerRPi::start() is then called without an intermediate PipelineHandlerRPi::configure(), it will re-allocate and prepare all the buffers again, which is unnecessary. Fix this by not freeing the buffer in PipelineHandlerRPi::stopDevice(), but insted doing it in PipelineHandlerRPi::configure(), as the buffers might have to be resized. Add a flag to indicate that buffer allocations need to be done on the next call to PipelineHandlerRPi::start(). Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Tested-by: David Plowman <david.plowman@raspberrypi.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-03-28pipeline: raspberrypi: Move freeBuffers() to the RPiCameraData classNaushir Patuck
This function used to clear the camera buffers does not belong in the PipelineHandlerRPi class as it only access members of the RPiCameraData, so move it. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Tested-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-03-28pipeline: raspberrypi: Avoid over-allocation for ISP Output 1Naushir Patuck
The V4L2DeviceFormat structure for the ISP Output 1 node was a copy of what is used ISP Output 0 node, but with the size changed. However, the plane size and stride values were not updated. So there is a possibility that the buffer might be over-sized for the requested resolution. Fix this by only copying the relevant fields from the ISP Output 0 V4L2DeviceFormat structure, and let the device driver size the planes as needed. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Tested-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-03-25pipeline: rkisp1: Match sensor aspect ratio when generating configurationsLaurent Pinchart
The RkISP1Path::generateConfiguration() function limits the maximum resolution to the sensor resolution, to avoid upscaling. It however doesn't take the sensor aspect ratio into account, which leads to a maximum (and default) resolution of 1920x1920 when using the self path with a sensor that has a higher resolution. Fix it by constraining the minimum and maximum resolutions to match the sensor's aspect ratio. 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-03-23ipa: rkisp1: Replace event-based ops with dedicated functionsUmang Jain
The IPARkISP1Interface currently uses event-type based structures in order to communicate with the pipeline-handler (and vice-versa). Replace the event based structures with dedicated functions associated to each operation. The translated naming scheme of operations to dedicated functions: ActionV4L2Set => setSensorControls ActionParamFilled => paramsBufferReady ActionMetadata => metdataReady EventSignalStatBuffer => processStatsBuffer() EventQueueRequest => queueRequest() The lexical of IPARkISP1::metadataReady() will now conflict with the metadataReady Signal being introduced in this patch as part of the interface change. Hence, rename IPARkISP1::metadataReady() to IPARkISP1::prepareReady() to prevent the conflict. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Tested-by: Paul Elder <paul.elder@ideasonboard.com>
2022-03-15libcamera: ipu3: Pass lens controls to config infoDaniel Scally
When configuring the pipeline we want to share the controls for any VCM device against the sensor too - pass them to the lensControls member of configInfo Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Daniel Scally <djrscally@gmail.com> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-03-11libcamera: Fix typo in a function name for camera lens classJean-Michel Hautbois
The CameraLens class implements a function named "setFocusPostion". There is a typo here, fix it. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-03-04libcamera: pipeline: raspberrypi: Fix scaler crop when sensor is configuredDavid Plowman
We must calculate the initial scaler crop when the camera is configured, otherwise the metadata will report this rectangle as being all zeroes. Because the calculation is identical to that performed later in handling the scaler crop control, we factor it into a small helper function, RPiCameraData::scaleIspCrop. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-02-10pipeline: raspberrypi: Simplify image/embedded buffer matching logicNaushir Patuck
Simplify the image and embedded buffer matching logic by removing the assumption that we require a buffer match between the two streams. Instead, if an image buffer does not match with an embedded data buffer, simply use the ControlList provided by DelayedControls for the sensor parameters. 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>
2022-02-10pipeline: raspberrypi: Allow Stream::returnBuffer() to handle internal buffersNaushir Patuck
If Stream::returnBuffer() gets passed an internally allocated buffer, it now simply re-queues it back to the device. With this change, the pipeline handler code can be simplified slightly as it does not need multiple code paths for internally allocated and non-internally allocated buffers. 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>
2022-02-03libcamera: pipeline: raspberrypi: Do not mark the Embedded Data stream as ↵Naushir Patuck
external Remove the code that marks the Embedded Data stream as external with the Unicam Image (RAW) stream. This was needed for legacy reasons when matching image and embedded buffers, but is not needed any more. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Tested-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-02-01pipeline: raspberrypi: Fix the buffer count calculation for the ISP input streamNaushir Patuck
The ISP input stream currently only allocates a single slot in the V4L2VideoDevice cache as it follows the number of buffers allocated for use. However, this is wrong as the ISP input stream imports buffers from Unicam image stream. As a consequence of this, only one cache slot was used during runtime for the ISP input stream, and if multiple buffers were to be queued simultaneously, the queue operation would return a failure. Fix this by passing the same number of RAW buffers available from the Unicam image stream. Additionally, double this count in the cases where buffers could be allocated externally from the application. Bug: https://github.com/raspberrypi/libcamera-apps/issues/236 Bug: https://github.com/raspberrypi/libcamera-apps/issues/238 Bug: https://github.com/raspberrypi/libcamera-apps/issues/240 Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-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-02-01pipeline: raspberrypi: Fix log messageNaushir Patuck
Fix a typo in a logging message. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-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-01-19pipeline: raspberrypi: Return all ISP resolutions from generateConfiguration()Naushir Patuck
The libcamerasrc gstreamer component does seem to not allow stream resolutions that are not advertised by PipelineHandler::generateConfiguration(). This has been raised in a bug report [1]. Fix this behavior by advertising a SizeRange from the minimum ISP resolution, up to the sensor resolution from PipelineHandlerRPi::generateConfiguration(). [1] https://bugs.libcamera.org/show_bug.cgi?id=105 Fixes: f16acb275c85 ("pipeline: raspberrypi: Restrict the advertised maximum ISP output resolution") Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-01-19pipeline: raspberrypi: Simplify calculation of sensor's native Bayer orderDavid Plowman
Now that the sensor is defined to list mbus codes using its native (untransformed) Bayer order, the method of obtaining it can be simplified. We don't have to try and reset the flips, we just use the value directly from the sensor. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-01-10pipeline: raspberrypi: Demote the category of a logging messageNaushir Patuck
Switch the "no buffers available" log message from Info to Debug so that it does not get output by default. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-01-08libcamera: pipeline: raspberrypi: Update sensor's V4L2_CID_NOTIFY_GAINS controlDavid Plowman
If the sensor exposes the V4L2_CID_NOTIFY_GAINS control, assume it means the sensor wants to be told the latest colour gains. We store whether the control exists and if so its default value, to save us checking for it on every frame. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-01-06pipeline: raspberrypi: Add support for Video Mux and Bridge devicesNaushir Patuck
This change will allow the pipeline handler to enumerate and control Video Mux or Bridge devices that may be attached between sensors and a particular Unicam instance. Cascaded mux or bridge devices are also handled. A new member function RPiCameraData::enumerateVideoDevices(), called from PipelineHandlerRPi::registerCamera(), is used to identify and open all mux and bridge subdevices present in the sensor -> Unicam link. Relevant links are enabled/disabled and pad formats correctly set in PipelineHandlerRPi::configure() before the camera is started. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-01-06pipeline: raspberrypi: Move sensor entity detection out of registerCamera()Naushir Patuck
Enumerate the sensor device entities in PipelineHandlerRPi::match() and loop over PipelineHandlerRPi::registerCamera() for each sensor found. This will allow the pipeline handler to register multiple cameras attached to a single Unicam instance with a Video Mux device. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-12-29libcamera: pipeline: simple: Rename Entity::link to sourceLinkLaurent Pinchart
The Entity::link member has an ambiguous name. Rename it to sourceLink to clarify that it stores the link on the source pad. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-13libcamera: pipeline: raspberrypi: Support color spacesDavid Plowman
The Raspberry Pi pipeline handler now sets color spaces correctly. In generateConfiguration() it sets them to reasonable default values based on the stream role. validate() now calls validateColorSpaces() to ensure that the requested color spaces are sensible, before proceeding to check what the hardware can deliver. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.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>
2021-12-13libcamera: v4l2_subdevice: Add colorSpace field to V4L2SubdeviceFormatDavid Plowman
This adds a ColorSpace field to the V4L2SubdeviceFormat so that we can set and request particular color spaces from V4L2. This commit simply adds the field and fixes some occurrences of brace initializers that would otherwise be broken. A subsequent commit will pass and retrieve the value correctly to/from V4l2 itself. Signed-off-by: David Plowman <david.plowman@raspberrypi.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>
2021-12-11libcamera: pipeline: Introduce stopDevice()Jacopo Mondi
Since a queue of waiting Requests has been introduced, not all Requests queued to the PipelineHandler are immediately queued to the device. As a Camera can be stopped at any time, it is required to complete the waiting requests after the ones queued to the device had been completed. Introduce a pure virtual PipelineHandler::stopDevice() function to be implemented by pipeline handlers and make the PipelineHandler::stop() function call it before completing pending requests. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-12-08pipeline: raspberrypi: Restrict the advertised maximum ISP output resolutionNaushir Patuck
Limit the advertised ISP output sizes available to the sensor resolution in PipelineHandlerRPi::generateConfiguration(). The user is free to configure a larger resolution than this, and this will work. However, this stops strange behavior in applications that use the V4L2 compatability layer to run, and request the largest possible advertised resolution, which is much larger than the sensor resolution. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-12-08pipeline: raspberrypi: Reduce logging verbosityNaushir Patuck
Demote a couple of lines of logging to Debug level to reduce the verbosity of the log output during startup. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-12-07libcamera: Use utils::abs_diff()Laurent Pinchart
Use the new utils::abs_diff() function where appropriate to replace manual implementations. While at it fix a header ordering issue in src/libcamera/pipeline/raspberrypi/raspberrypi.cpp. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2021-12-07pipeline: raspberrypi: Return the sensor formats from generateConfiguration()Naushir Patuck
Return the available sensor PixelFormats and sizes from generateConfiguration() if the StreamRole is set to StreamRole::Raw. The existing code returns the PixelFormats and sizes for all other StreamRole types. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-12-06libcamera: pipeline: ipu3: Apply a requested test pattern modeHirokazu Honda
This introduces a way to set controls immediately for a capture in ipu3 pipeline handler. It enables to apply a test pattern mode per frame. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-06libcamera: camera_sensor: Reference test pattern modes by enum typeHirokazu Honda
The CameraSensor stores TestPatternModes as an int32_t. This prevents the compiler from verifying the usage against the defined enum types. Fix references to the TestPatternMode to store the value as the TestPatternModeEnum type which is defined by the control generator. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-06libcamera: ipu3: Only process focus if we have a lensKieran Bingham
If there is no lens detected by the system, then we will not be able to set the control, so we can skip processing of the list. Furthermore, if the IPA has not set a V4L2_CID_FOCUS_ABSOLUTE control, then a warning will be printed as the lensControls.get() will not succeed. Break out of the control parsing when there is no CameraLens device, or if there is no absolute focus control set by the IPA. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-12-04libcamera: base: shared_fd: Rename fd() to get()Laurent Pinchart
For consistency with UniqueFD, rename the fd() function to get(). Renaming UniqueFD::get() to fd() would have been another option, but was rejected to keep as close as possible to the std::shared_ptr<> and std::unique_ptr<> APIs. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
2021-12-04libcamera: base: Rename FileDescriptor to SharedFDLaurent Pinchart
Now that we have a UniqueFD class, the name FileDescriptor is ambiguous. Rename it to SharedFD. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-04libcamera: pipeline: raspberrypi: DmaHeaps: Use UniqueFD for a file descriptorHirokazu Honda
Manages a file descriptor owned by DmaHeaps for a dma handle by UniqueFD. Furthermore, DmaHeaps::alloc() creates a new file descriptor and the returned file descriptor is owned by a caller. This also clarifies it by changing the returned value to UniqueFD. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-03libcamera: Move file_descriptor.h to base/Laurent Pinchart
The FileDescriptor class is a generic helper that matches the criteria for the base library. Move it there. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-03ipu3: ipa: Allow IPA to apply controls to the lens deviceHan-Lin Chen
Allow IPA to apply controls to the lens device. Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-12-01pipeline: raspberrypi: Choose bit depth and packing according to raw streamDavid Plowman
When a raw stream is specified, the bit depth and packing requested should influence our choice of camera mode to match (if possible). Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-12-01pipeline: raspberrypi: Fix under-allocation of embedded data buffersDavid Plowman
The code was reducing the number of raw stream buffers allocated when the application is providing some of its own. However, it was not taking account of the fact that the application cannot supply embedded data buffers, so it must always allocate a reasonable minimum number of these buffers (possibly more than the number of raw stream buffers) to prevent frame drops. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-11-29ipa: rkisp1: Report and use sensor controlsJean-Michel Hautbois
The pipeline handler populates a new sensorControls ControlList, to have the effective exposure and gain values for the current frame. This is done when a statistics buffer is received. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-11-29ipa: rkisp1: Pass IPASettings at init callJean-Michel Hautbois
When the IPA is initialized, it will need to know the sensor model used in order to properly call CameraSensorHelper for the analogue gain. Modify the init definition in the pipeline handler and in the IPA as well as the mojo interface to pass the IPASettings. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-11-29pipeline: raspberrypi: Tidy the camera enumeration and registration logicNaushir Patuck
When acquiring the media device, it is not necessary to match all entity names, so remove it. Aditionally, we do not need to keep the MediaEntity pointers for the Unicam and ISP devices stored within the PipelineHandlerRPi class. Instead these can be stored locally in PipelineHandlerRPi::match(). PipelineHandlerRPi::registerCamera() now returns an int error code instead of a boolean for pass/fail. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-11-29pipeline: raspberrypi: Split out device enumeration and camera registrationNaushir Patuck
Split out PipelineHandlerRPi::match() so that media device enumeration and acquisition is separated from camera registration. The former logic remains in PipelineHandlerRPi::match(), whereas the latter logic is moved into a new PipelineHandlerRPi::registerCamera() member function. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-11-24libcamera: pipeline: Convert to pragma onceKieran Bingham
Remove the verbose #ifndef/#define/#endif pattern for maintaining header idempotency, and replace it with a simple #pragma once. This simplifies the headers, and prevents redundant changes when header files get moved. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
2021-11-23pipeline: raspberrypi: Avoid invalid PixelFormat warning messageNaushir Patuck
PixelFormatInfo::info() would log a warning message if the PixelFormat was invalid when called from the isRaw() function. Add a validity test in isRaw() to avoid this warning message. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-11-23pipeline: raspberrypi: Increase the V4L2BufferCache slot allocationsNaushir Patuck
If a stream is marked as external, double the number of V4L2BufferCache slots that are allocated. This is to account for additional buffers that may be allocated directly by the application. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-11-23pipeline: raspberrypi: Rework the internal buffer allocation schemeNaushir Patuck
For simplicity, the pipeline handler currently look at the maximum number of buffers set in the StreamConfiguration by the user and allocate the same number of internal buffers for all device nodes. This would likely overallocate buffers for some nodes. Rework this logic to try and minimise overallcations without compromising performance. The key change is to mostly decouple the number of internal buffers allocated from number of buffers requested by the user through the StreamConfiguration. For ISP nodes, we only ever need 1 set of internal buffers, as the hardware runs synchronous with the requests and IPA. For Unicam nodes, allocate a minimum for 4 buffers (exported + internal), but also require at least 2 internal buffers to minimise frame drops. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-11-23pipeline: raspberrypi: Add const qualifer in isRaw()Naushir Patuck
This function does not modify the pixFmt parameter, so use a const qualifier. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-11-15ipa: ipu3: Move ExposureTime to IPAJean-Michel Hautbois
Now that we have the exposure time calculated, report it in the controls::ExposureTime and don't use the pipeline handler for it anymore. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>