summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-02-11meson: Fix coding style when declaring arraysLaurent Pinchart
The meson.build files mix array declarations with and without a space after the opening and before the closing square bracket. The vast majority of cases don't use spaces, so standardize on that. While it it, fix indentation in a few places. 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>
2021-02-10ipa: raspberrypi: AWB: Remove unecessary frame count variableDavid Plowman
The variable frame_count2_ is not needed as Prepare() and Process() always run in lock step one after the other. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-09ipa: raspberrypi: Handle control::NoiseReductionMode in the controllerNaushir Patuck
The application provided noise reduction mode gets passed into the denoise controller. The denoise controller in turn returns the mode to the IPA which now sets up the colour denoise processing appropriately. 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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-09ipa: raspberrypi: Add a DenoiseAlgorithm class to the ControllerNaushir Patuck
This denoise algorithm class will be used to pass in the user requested denoise operating mode to the controller. The existing Denoise controller will derive from this new DenoiseAlgorithm class. Add a denoise mode field in the denoise status metadata object for the IPA to use when configuring the ISP. 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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-09ipa: raspberrypi: Rename SdnStatus to DenoiseStatusNaushir Patuck
This change is in anticipation of the addition of a DenoiseAlgorithm base class which the SDN class will derive from. We want to match the metadata object name with the base class algorithm name. This renames: - SdnStatus metadata object to DenoiseStatus - "sdn.status" metadata string key to "denoise.status" - sdn_status.h header file to denoise_status.h 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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-09uapi: raspberrypi: Update the bcm2835-isp header definitionNaushir Patuck
Update the bcm2835-isp.h file with the latest version available in the downstream Raspberry Pi linux repo at commit: 68878170d8a98afd6d519a3a2c909080c19de4ce This change adds support for colour denoise processing, and the following downstream kernel changes must be available: https://github.com/raspberrypi/linux/pull/4069 https://github.com/raspberrypi/linux/pull/4083 The Raspberry Pi image must also be running the latest firmware, obtained by running rpi-update. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-09pipeline: raspberrypi: Set the ISP Output1 to 1/4 resolution if unusedNaushir Patuck
In preparation for fast colour denoise, set the low resolution ISP output stream (Output1) to a 1/4 resolution of the application requested stream (Output0). This only happens if the application has not requested an additional YUV or RGB stream. We also constrain this 1/4 resolution to at most 1200 pixels in the largest dimension to avoid being too taxing on memory usage and system bandwidth. Also switch the default StreamRole::VideoRecording to YUV420 to allow fast colour denoise to run. 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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-09pipeline: raspberrypi: Refactor stream configuration routineNaushir Patuck
Refactor the high/low resolution stream format and output selection routine. This change is in preparation of adding 1/4 resolution output for fast colour denoise. 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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-08libcamera: ipu3: Get request from information structure instead of bufferNiklas Söderlund
Buffers dequeued from the ImgU may not be associated with a Request as they are internal (statistics, parameters and some RAW buffers). Fetch the request they are used for from the frame information instead. Fixes: 9708f49fecf2f9ee ("libcamera: ipu3: Share parameter and statistic buffers with IPA") Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-08ipa: raspberrypi: Remove atomic variable from Algorithm classDavid Plowman
Pause() and Resume() are only called synchronously so paused_ does not need to be atomic. 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>
2021-02-08android: camera_device: Calculate MAX_JPEG_SIZEJacopo Mondi
Calculate the JPEG maximum size using the maximum preview format size multiplied by a 1.5 factor. The same multiplication factor is used in the existing HAL implementations in ChromeOS. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-02-07ipa: raspberrypi: lux: Supply missing method and remove atomic variableDavid Plowman
Supply the missing SetCurrentAperture() method (even though no one is calling it). If we did call it, it would be called synchronously so the atomic variable is not required. 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>
2021-02-07ipa: raspberrypi: noise: Remove unnecessary atomic variableDavid Plowman
mode_factor_ does not need to be atomic - it is set by SwitchMode() which runs synchronously. 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>
2021-02-07ipa: rasberrypi: contrast: Remove unnecessary atomic variablesDavid Plowman
SetBrightness() and SetContrast() are only called synchronously so there is no need for brightness_ and contrast_ to be atomic. 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>
2021-02-07ipa: raspberrypi: ccm: Remove unnecessary atomic variableDavid Plowman
SetSaturation() gets called synchronously so there is no need for saturation_ to be atomic. 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>
2021-02-07ipa: raspberrypi: AWB: Improve lockingDavid Plowman
Fix a couple of places where notify_one() was called with the lock held. Also restartAsync doesn't need the lock for its entire duration. This change exactly matches commit db552b0b925a ("libcamera: ipa: raspberrypi: ALSC: Improve locking in a few places") where we do the same for ALSC (the asynchronous thread arrangement there is identical). 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>
2021-02-07ipa: raspberrypi: AWB: Remove unnecessary locking for AWB settingsDavid Plowman
AWB settings get updated synchronously with the main thread, so the settings_mutex_ and associated locking can be removed. 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>
2021-02-05libcamera: ipu3: Fix RAW sizes selectionJacopo Mondi
Commit 7208e70211a6 ("libcamera: ipu3: Always use sensor full frame size") changed the CIO2 configuration procedure to always select the full sensor resolution to work around an ImgU configuration issue, as reported in the todo item introduced in said commit. When capturing a RAW stream only and the ImgU is not involved, the CIO2 has to be configured with the requested stream size to avoid adjusting the stream to the sensor resolution. As an example, capturing a raw frame smaller than the sensor resolution with this patch applied results in the stream configuration to be correctly assigned. $ cam -c1 -swidth=1056,height=784,role=raw ipu3.cpp:207 CIO2 configuration: 1056x784-SGRBG10_IPU3 ipu3.cpp:222 Validating stream: 1056x784-SGRBG10_IPU3 ipu3.cpp:233 Assigned 1056x784-SGRBG10_IPU3 to the raw stream Without this patch the same operation results in the stream resolution to be adjusted to the sensor resolution. $ cam -c1 -swidth=1056,height=784,role=raw ipu3.cpp:201 CIO2 configuration: 4224x3136-SGRBG10_IPU3 ipu3.cpp:216 Validating stream: 1056x784-SGRBG10_IPU3 ipu3.cpp:227 Assigned 4224x3136-SGRBG10_IPU3 to the raw stream ipu3.cpp:297 Stream 0 configuration adjusted to 4224x3136-SGRBG10_IPU3 Camera configuration adjusted 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>
2021-02-05android: camera_device: Report HOT_PIXEL_MAP_MODE as OFFJacopo Mondi
The CaptureResultTest#testCameraCaptureResultAllKeys enforces the presence of the ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE result metadata. Report ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE_OFF as the Camera HAL does not support the generation of an hot pixel correction map. 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>
2021-02-05android: camera_device: Report sensor test pattern modeJacopo Mondi
The CaptureResultTest#testCameraCaptureResultAllKeys enforces the presence of the ANDROID_SENSOR_TEST_PATTERN_MODE result metadata. Report the only supported value of ANDROID_SENSOR_TEST_PATTERN_MODE_OFF. 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>
2021-02-05libcamera: ipu3: Always report crop regionJacopo Mondi
Report the crop region for every completed request. The crop region is initialized as the sensor's analogue crop rectangle and updated when a Request with a new region completes. 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>
2021-02-05android: camera_device: Report AF_MODE_OFF in templateJacopo Mondi
The CaptureResultTest#testCameraCaptureResultAllKeys CTS test enforces the presence of the auto focus mode in the preview request template. Add the only supported mode AF_MODE_OFF in the generated template. 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>
2021-02-05android: camera_device: Use AF_MODE_OFF in scene overrideJacopo Mondi
The camera HAL does currently list AF_MODE_OFF as the only supported auto-focus mode in the ANDROID_CONTROL_AF_AVAILABLE_MODES static metadata. For this reason reporting AF_MODE_AUTO as scene override is wrong. At the moment scene override is disabled in the Camera HAL, but this is worth a fix nonetheless. 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>
2021-02-05android: camera_device: Report AE_EXPOSURE_COMPENSATIONJacopo Mondi
The CaptureResultTest#testCameraCaptureResultAllKeys enforces the presence of the ANDROID_CONTROL_AE_EXPOSURE_COMPENSATION result metadata. Report 0 as the current value for ANDROID_CONTROL_AE_EXPOSURE_COMPENSATION in the result metadata pack. 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>
2021-02-05android: camera_device: Report COLOR_CORRECTION_ABERRATION_MODEJacopo Mondi
The CaptureResultTest#testCameraCaptureResultAllKeys enforces the presence of the ANDROID_COLOR_CORRECTION_ABERRATION_MODE result metadata. Report the only supported value of ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF. 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>
2021-02-05cam: Only queue the exact number of requests asked forNiklas Söderlund
The cam option --capture=N is suppose to only capture N requests. But if the processing done for each request is large (such as writing it to a slow disk) the current implementation could queue more than N requests before the exit condition is detected and capturing stopped. Solve this by only queueing N requests while still waiting for N requests to complete before exiting. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-05cam: event_loop: Execute events in the libevent loopNiklas Söderlund
Cam uses libevent to deal with threads and idle loop while still implementing its own event queue. This creates issues when the event loop is terminated as it might get stuck in the idle loop if exit() is called while the thread is busy with dispatchCalls(). Solve this by removing the custom event execution and instead injecting the calls as events to the base event loop. Reported-by: Sebastian Fricke <sebastian.fricke@posteo.net> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-05cam: event_loop: Rename event_ to base_Niklas Söderlund
The 'event' variable name is usually used for events added to the base event loop, not the loop itself. Rename the struct event_base member to base_ as a preparation for future work adding events to the loop. There is no functional change. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-05libcamera: ipu3: Share parameter and statistic buffers with IPANiklas Söderlund
Use the IPU3Frames helper to share parameters and statistics buffers with the IPA. Track which parameter and statistic buffer is used for which request and make sure the parameter buffers is filled in by the IPA before it's needed and that the statistic buffer is consumed and meta data generated before completing the request. With this change the IPU3 pipeline is prepared to fully operate with an IPA component. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-05libcamera: ipu3: Add helper for parameter and statistic buffersNiklas Söderlund
Add a helper class to aid in associating a parameter and statistic buffer with each request queued to the pipeline. The helper helps with tracking the state of the extra buffers and in completing the request once all extra processing is done. This change only adds the helper more work is needed to integrate it with the pipeline and an IPA. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-05libcamera: ipu3: Map buffers in IPANiklas Söderlund
Map and unmap the parameters and statistic buffers in the IPA when the pipeline handler allocates and frees the buffers. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-05libcamera: ipu3: imgu: Allocate buffers for stats and paramNiklas Söderlund
Instead of preparing for buffer importing allocate buffers that can be used by an IPA. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-05libcamera: ipu3: Attach to an IPA and allow it to set sensor controlsNiklas Söderlund
Attach to the IPA and allow it to push V4L2 controls that apply to the camera sensor. The IPA is not fully integrated in the pipeline as statistics and parameters buffers are not yet allocated, processed by the IPA nor queued to the hardware. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-05libcamera: ipa: ipu3: Add an IPA skeleton for the IPU3 pipelineNiklas Söderlund
Add an empty IPA skeleton for the IPU3 pipeline. The skeleton IPA handles the flow of parameter and statistic buffers but does not read or write anything in the buffers. It also allows the IPA to set sensor controls but does not implement any logic to set optimal values and instead sets the V4L2 exposure and gain controls to max and keeps them at that setting. This IPA is meant as a base to allow the pipeline handler to be wired up to an IPA. The image algorithms can then later be added to the IPA independently from also having to add plumbing to the pipeline handler. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-05libcamera: ipu3: cio2: Generate start of frame eventNiklas Söderlund
Propagate the frameStart event whenever the CSI-2 receiver in the CIO2 pipeline generates one. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-05libcamera: ipu3: cio2: Return the FrameBuffer pointer usedNiklas Söderlund
When adding IPA plumbing to the IPU3 pipeline handler it will be needed to track which raw buffer was queued to the CIO2 for a specific request. Currently if using an internally allocated raw buffer the FrameBuffer is not exposed outside the CIO2Device as it was not needed. Prepare for the IPA by exposing which internal raw buffer is picked for each request, later changes will associate this with a Request. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-05libcamera: ipu3: imgu: Add parameters video deviceNiklas Söderlund
Add the parameters video device to the data structure of the ImgUDevice. Even if the video device is configured, prepared to import buffers and started no buffers are ever queued to it so it does not yet effect the capture. Nor is does this change hinder the current capture mode to function. This is done in preparation to attach an IPA to the IPU3 pipeline. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-05libcamera: ipu3: imgu: Configure the stat video device as part of configure()Niklas Söderlund
There is no reason to expose and call a separate configureStat() when the statistics video device can be configured with the exact same parameters as part of configure(). Move the configuration internally to the ImgUDevice simplifying the interface, there is no functional change. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-02-05include: linux: Add ipu3 kernel header and format definitionsNiklas Söderlund
Add kernel header and format definitions for the Intel IPU3. The header has been exported from a v5.9 kernel using scripts/headers_install.sh. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-05libcamera: utils: Add reverse adapter for range-based loopLaurent Pinchart
Add a utils::reverse() function that creates an adapter wrapping in iterable, such that range-based iteration over the adapter iterates over the iterable in reverse order. 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>
2021-02-05libcamera: camera_sensor: Check control availability from idmapLaurent Pinchart
The presence of mandatory and optional controls is checked in CameraSensor::validateSensorDriver() by trying to retrieve them. This causes an error message to be printed in the V4L2Device class if an optional control isn't present, while this isn't an error. To fix this, use the control idmap reported by the V4L2Device to check for controls availability. The function can now print the whole list of missing controls, making debugging easier. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-02-05libcamera: camera_sensor: Restrict sensor info to raw sensorsLaurent Pinchart
YUV sensors don't provide the necessary information to fill CameraSensorInfo, as they include an ISP and provide a higher-level API that doesn't always expose low-level information. The CameraSensor class makes low-level V4L2 controls mandatory for all sensors, which prevents usage of YUV sensors with the simple pipeline handler. Make CameraSensor::sensorInfo() available for raw sensors only. This won't introduce any regression in pipeline handlers that currently use the sensorInfo() function as they all operate with raw sensors, and won't be a limitation for the simple pipeline handler as well as it doesn't use sensor info. If part of the sensor info (such as the active pixel array size for instance) becomes useful to expose for YUV sensors in the future, the sensorInfo() function can be extended to report that information only and skip data that is only available for raw sensors. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-02-05libcamera: camera_sensor: Store Bayer pattern in class memberLaurent Pinchart
The Bayer pattern is retrieved based on the media bus formats supported by the sensor, when registering camera sensor properties. To prepare for its usage elsewhere in the CameraSensor class, store it in a private member variable. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-02-05ipa: raspberrypi: Pass the maximum allowable shutter speed into the AGCNaushir Patuck
In order to provide an optimal split between shutter speed and gain, the AGC must know the maximum allowable shutter speed, as limited by the maximum frame duration (either application provided or the default). Add a new API function, SetMaxShutter, to the AgcAlgorithm class. The IPA provides the maximum shutter speed for AGC calculations. This applies to both the manual and auto AGC modes. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-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-02-05ipa: raspberrypi: Limit the calculated vblank based on the sensor modeNaushir Patuck
The existing framerate/vblank calculations did not account for the sensor mode limits. This commit extracts vblank limits from the sensor v4l2 controls, and stores it in the camera modes structure. Exposure and vblank value calculations now use values clamped to the sensor mode limits. The libcamera::controls::FrameDurations metadata return values now reflect the minimum and maximum after clamping. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-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-02-05libcamera: camera_sensor: Add frame length limits to CameraSensorInfoNaushir Patuck
Sensor frame length is made up of active and inactive (blanking) lines. The minimum and maximum frame length values may be used by pipeline handlers to limit frame durations based on the sensor mode capabilities. Store the minimum and maximum allowable frame length values (in lines) in the CameraSensorInfo structure. These values are computed in CameraSensor::sensorInfo() by querying the sensor subdevice V4L2_CID_VBLANK control limits. This in turn means that V4L2_CID_VBLANK is now a mandatory subdevice control. Signed-off-by: Naushir Patuck <naush@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-02-05libcamera: camera_sensor: Make VBLANK mandatoryJacopo Mondi
Add the V4L2_CID_VBLANK control to the list of mandatory controls the sensor driver has to report and document the new requirement. The vertical blanking control is used to calculate the frame duration. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Naushir Patuck <naush@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>
2021-02-05libcamera: pipeline: raspberrypi: Always save sensor params on ↵Naushir Patuck
IPA_RESULT_SENSOR_PARAMS Fixup logic when handling IPA_RESULT_SENSOR_PARAMS where we must always overwrite the parameters if provided by IPA. In the current codebase, this only happens once on startup, so there is no effective functional difference. But this change allows the option for the IPA to request new sensor parameters per-mode if required. 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>
2021-02-05ipa: raspberrypi: Rename RPi::ConfigParameters enum valuesNaushir Patuck
Rename the enum values to indicate pipeline handler -> IPA actions (IPA_CONFIG_*) and IPA -> pipeline handler return results (IPA_RESULT_*). Additionally, provide more descriptive names for these values. Signed-off-by: Naushir Patuck <naush@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-02-04test: Add unit tests for the BayerFormat classSebastian Fricke
Test all of the present methods including the newly implemented `fromV4L2PixelFormat`, as well as the new operators `==/!=`. Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>