summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2020-07-10libcamera: pipeline: raspberrypi: Simplify format fetchingPaul Elder
Simplify code for looking up PixelFormatInfo using a V4L2 format by using the new PixelFormatInfo lookup function based on V4L2 format. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-07-10libcamera: PixelFormatInfo: Add functions stride and frameSizePaul Elder
Add member functions to PixelFormatInfo for calculating stride and frame size. This will simplify existing code that calculates these things. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-07-10libcamera: StreamConfiguration: Add frameSize fieldPaul Elder
In addition to the stride field, we want the pipeline handler to be able to declare the frame size for the configuration. Add a frameSize field to StreamConfiguration for this purpose. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-07-10libcamera: formats: PixelFormatInfo: Add v4l2 lookup functionPaul Elder
Add a lookup function for PixelFormatInfo that takes a V4L2PixelFormat. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-07-10libcamera: V4L2VideoDevice: Add tryFormatPaul Elder
Add tryFormat and its variations (meta, single-plane, multi-plane) to V4L2VideoDevice. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-07-10libcamera: formats: Add fields to info to ease calculating stridePaul Elder
Packed formats make it difficult to calculate stride as well as frame size with the fields that PixelFormatInfo currently has. bitsPerPixel is defined as the average number of bits per pixel, and only counts effective bits, so it is not useful for calculating stride and frame size. To fix this, we introduce a concept of a "pixel group". The size of this group is defined as the minimum number of pixels (including padding) necessary in a row when the image has only one column of effective pixels. The pixel group has one more attribute, that is the "bytes per group". This determines how many bytes one pixel group consumes. These are the fields pixelsPerGroup and bytesPerGroup that are defined in this patch. Defining these two values makes it really simple to calculate bytes-per-line, as ceil(width / pixelsPerGroup) * bytesPerGroup, where width is measured in number of pixels. The ceiling accounts for padding. The pixel group has another contraint, which is that the pixel group (bytesPerGroup and pixelsPerGroup) is the smallest repeatable unit. What this means is that, for example, in the IPU3 formats, if there is only one column of effective pixels, it looks like it could be fit in 5 bytes with 3 padding pixels (for a total of 4 pixels over 5 bytes). However, this unit is not repeatable, as at the 7th group in the same row, the pattern is broken. Therefore, the pixel group for IPU3 formats must be 25 pixels over 32 bytes. Clearly, pixelsPerGroup must be constant for all planes in the format. The bytesPerGroup then, must be a per-plane attribute. There is one more field, verticalSubSampling, that is per-plane. This is simply a divider, to divide the number of rows of pixels by the sub-sampling value, to obtain the number of rows of pixels for the subsampled plane. For example, for something simple like BGR888, it is self-explanatory: the pixel group size is 1, and the bytes necessary is 3, and there is only one plane with no (= 1) vertical subsampling. For YUYV, the CbCr pair is shared between two pixels, so even if you have only one pixel, you would still need a padded second Y, therefore the pixel group size is 2, and bytes necessary is 4 (as opposed to 1 and 2). YUYV also has no vertical subsampling. NV12 has a pixel group size of 2 pixels, due to the CbCr plane. The bytes per group then, for both planes, is 2. The first plane has no vertical subsampling, but the second plane is subsampled by a factor of 2. The IPU3 formats are also self-explanatory, as they are single-planar, and have a pixel group size of 25, consuming 32 bytes. Although a comment in the driver suggests that it should be 50 and 64, respectively, this is an attribute of the driver, and not the format, so this shall be set by the ipu3 pipeline handler. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-07-10libcamera: formats: Add NV24 and NV42, and reorder NV formatsPaul Elder
Add formats for NV24 and NV42. While at it, reorder the NV formats so that NV12 and NV21 come first, followed by NV16, NV61, NV24, and NV42. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-07-09libcamera: ipu3: cio2: Make use of utils::map_keys() helperNiklas Söderlund
Use a helper instead of local code to retrieve all keys from a map. 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>
2020-07-09libcamera: utils: Add map_keys() functionLaurent Pinchart
Add a map_keys() function to the utils namespace to extract keys from a map. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> [Niklas: change return type to std::vector instead of std::set] 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>
2020-07-08libcamera: Use Size::isNull()Laurent Pinchart
Use the new Size::isNull() function through the code base to replace manual checks. While the new code isn't equivalent, as isNull() checks that both width and height are zero, it catches the same conditions in practice. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <email@uajain.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-07-07android: camera_device: Remove single buffer restriction.Kieran Bingham
A capture request is no longer limited to a single output buffer. Remove the limitation, but (for now) keep the check to ensure that at least one buffer is always provided. 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> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-07-07android: camera_device: Add buffers for each stream to RequestsKieran Bingham
Construct a FrameBuffer for every buffer given in the camera3Request and add it to the libcamera Request on the appropriate stream. The correct stream is obtained from the private data of the camera3_stream associated with the camera3_buffer. Comments regarding supporting only one buffer are now removed, and FrameBuffers have their lifetime tracked in the Camera3RequestDescriptor to ensure they are released when the Request is completed. 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> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-07-06android: camera_device: Maintain a vector of CameraStreamKieran Bingham
Introduce a vector storing a CameraStream to track and maintain state between an Android stream (camera3_stream_t) and a libcamera Stream. Only the index of the libcamera stream is stored, to facilitate identifying the correct index for both the StreamConfiguration and Stream vectors. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-07-06android: camera_device: Create the Request and Camera3RequestDescriptor togetherKieran Bingham
Move the construction of the Request higher in the code flow so that multiple buffers and streams can be added where required. 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> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-07-06android: camera_device: Simplify FrameBuffer construction from a buffer_handle_tKieran Bingham
Move the code which constructs a FrameBuffer from the Android buffer handle to it's own function to simplify the code flow and readability. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-07-06android: camera_device: Support multiple stream configurationsKieran Bingham
Create an initial Camera Configuration using an empty role set, and populate the StreamConfigurations manually from each of the streams given by the Android camera3_stream_configuration_t stream_list. 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> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-07-06android: camera_device: Provide a toPixelFormat helperKieran Bingham
Rather than converting pixelformats through the map, and then dereferencing the iterator later, create a helper to explicitly return a PixelFormat type. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-07-06libcamera: ipa: raspberrypi: Populate focus FoM from the ISP statisticsNaushir Patuck
Switch FocusStatus::num to unsigned int for convenience. Fill in libcamera::controls::FocusFoM with the average of the middle two regions (across a 4x3 grid) FoM statistics from the ISP. 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>
2020-07-06ipa: raspberrypi: Populate libcamera metadata after controller processNaushir Patuck
For control algorithms like focus, this is needed to return out the the current frame focus statistics. For other algorithms, there is no functional change. 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>
2020-07-06libcamera: controls: Add focus Figure of Merit (FoM) controlNaushir Patuck
Provide a control to allow the IPA to return a FoM to indicate how in-focus a scene is. Note, this is not to be used as a means to implement a focus algorithm by the application, rather an indication of how in-focus a scene is. 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>
2020-07-03ipa: raspberrypi: Enable focus measure without recompileDavid Plowman
Previously, output of the focus measure could not be enabled without recompiling (because of the RPI_LOGGING_ENABLE macro). This uses the libcamera logging mechanism instead, so can be enabled/disabled at runtime. 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>
2020-07-03libcamera: ipu3: cio2: Do not proxy signalNiklas Söderlund
Do not proxy the signal in the CI2Device when there is no need for it, remove it. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-07-03libcamera: ipu3: Make it easier to read when a request may be completedNiklas Söderlund
It's confusing to read the code and understand that a request is only completed before being processed by the ImgU if it only contains a single RAW buffer. Add a boolean variable with a explanatory name to make this clearer, no functional change. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-07-03libcamera: raspberrypi: Document vc_sm_cma pointer sharing with IPANiklas Söderlund
Sharing a pointer with the IPA is fragile as it will not work with all IPC mechanisms. Document that it's a temporary workaround that should be reworked. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-07-01ipa/pipeline: rkisp1: Fix spellingAndrej Shadura
Fix a typo in the word "unknown". Suggested-by: IOhannes m zmölnig <umlaeute@debian.org> Signed-off-by: Andrej Shadura <andrewsh@debian.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-06-29libcamera: ipu3: cio2: Use Size::isNull()Niklas Söderlund
Use the Size::isNull() helper instead of using local code. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-06-29libcamera: geometry: Add isNull() function to Size classLaurent Pinchart
It's common for code to check if a size is null. Add a helper function to do so. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <email@uajain.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-06-29libcamera: raspberrypi: Fail on unsupported stream roleJacopo Mondi
When an unsupported stream roles is requested to generateConfiguration(), the function shall fail instead of simply ignoring the request. 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-06-29libcamera: raspberrypi: Refuse invalid roles configurationJacopo Mondi
The generateConfiguration() implementation does not check if the requested list of roles can actually be satisfied. The camera API documentation prescribes the function shall fail in that case, instead of silently adjust the returned configuration. Fix this by implementing the same logic as the validate() function implements, as the pipeline handler supports one raw stream and up to two output streams. 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-06-29libcamera: ipu3: Fix wrong indentationJacopo Mondi
Fix wrong parameter indent in generateConfiguration() function implementation. 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-06-29libcamera: ipu3: Accept an empty roles listJacopo Mondi
The IPU3 pipeline handler that does not support receiving an empty list of roles at generateConfiguration() time. This contradicts the camera API which allows application to generate empty CameraConfiguration to be later manually filled. Fix this by returning an empty CameraConfiguration if the list of requested roles is empty. While at it, align the style with the other pipeline handlers. 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-06-29libcamera: ipu3: Improve error on multiple raw streams requestJacopo Mondi
Improve the error message emitted when multiple raw streams are requested. 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-06-28libcamera: ipu3: imgu: Use unique_ptr for video and subdevicesNiklas Söderlund
Instead of manually deleting the video and subdevices in the destructor use std::unique_ptr. Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-06-28libcamera: ipu3: imgu: Remove ImgUOutputNiklas Söderlund
The struct ImgUOutput now only contains one member that is in use, the video device. Remove the struct and use the video device directly instead. 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>
2020-06-28libcamera: ipu3: Remove IPU3StreamNiklas Söderlund
The pipeline specific subclass of the pipeline is empty, remove it. 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>
2020-06-28libcamera: ipu3: Remove the active flag from IPU3StreamNiklas Söderlund
The active_ flag is only used inside one function, remove the global flag and handle it inside the single function. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-06-28libcamera: ipu3: Do not duplicate data in IPU3StreamNiklas Söderlund
Do not keep the duplicated ImgUDevice::ImgUOutput information in both the stream and camera data classes. Remove it from the stream and only access it from the camera data class. Which stream is which can instead be checked by comparing it to the known streams in camera data. This match how streams are checked in other parts of the code making the pipeline more coherent. 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>
2020-06-28libcamera: ipu3: imgu: Use specific functions to configure each sinkNiklas Söderlund
When the IPU3 pipeline only provided streams to applications that came from the ImgU it made sense to have a generic function to configure all the different outputs. With the addition of the RAW stream this begins to be cumbersome to read and make sense of in the PipelineHandlerIPU3 code. Replace the generic function that takes a specific argument for which sink to configure with a specific function for each sink. This makes the code easier to follow as it's always clear which of the ImgU sinks are being configured without knowing the content of a generically named variable. It also paves the way for future improvements. 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>
2020-06-28libcamera: ipu3: imgu: Mark things that are internal as privateNiklas Söderlund
Mark all variables and functions that are only used internally as private. 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>
2020-06-28libcamera: ipu3: imgu: Do not cache indexNiklas Söderlund
The numerical index of the imgu is only used to create its name in string form. There is no need to keep it around after that, remove it. 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>
2020-06-28libcamera: ipu3: imgu: Move the ImgUDevice class to separate filesNiklas Söderlund
In preparation of refactoring the IPU3 pipeline handler breakout the ImgUDevice into its own .cpp and .h file, 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>
2020-06-28libcamera: ipu3: Remove usage of IPU3CameraData from ImgUDeviceNiklas Söderlund
The IPU3CameraData argument to allocateBuffers() and freeBuffers() is no longer used and can be removed. 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>
2020-06-28libcamera: ipu3: Always import buffers for ImgU sinksNiklas Söderlund
When the IPU3 pipeline was first developed sinks of the ImgU that where not active still needed to have buffers allocated to allow streaming to start. This is no longer true, it's enough that the sinks have imported buffers to allow streaming to start. As we already need to import buffers for stream that are active we can align the two cases and always import buffers. With this there is no longer a reason to store the allocated FrameBuffers to keep them alive and the vector tracking them can be removed. 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>
2020-06-28libcamera: ipu3: Import instead of allocate statistic buffersNiklas Söderlund
Statistics buffers are not yet used by the IPU3 pipeline, they are never queued to the statistics video device or in any other way consumed. The kernel driver will however not allow video streaming to start if buffers are not either allocated or imported on the statistics video device. Instead of allocating the buffers wasting memory that is never used, import 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>
2020-06-28libcamera: ipu3: Remove unused name_ filed from IPU3StreamNiklas Söderlund
The field is never used, remove it. 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>
2020-06-26libcamera: ipu3: Allow zero-copy RAW stream captureNiklas Söderlund
With the refactored CIO2 interface it's now easy to add zero-copy for buffers in the RAW stream. Use the internally allocated buffers inside the CIO2Device if no buffer for the RAW stream is provided by the application, or use the application-provided buffer if any. 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>
2020-06-26libcamera: ipu3: cio2: Hide buffer allocation and freeing from usersNiklas Söderlund
The allocation and freeing of buffers for the CIO2 is handled in the IPU3 pipeline handlers start() and stop() functions. These functions also call CIO2Device start() and stop() at the appropriate times so move the CIO2 buffer allocation/freeing inside the CIO2Device and reduce the complexity of the exposed interface. 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>
2020-06-26libcamera: ipu3: cio2: Make the V4L2 devices privateNiklas Söderlund
In order to make the CIO2 easier to extend with new features make the V4L2 devices (sensor, CIO2 and video device) private members. This requires a few helper functions to be added to allow for the IPU3 driver to still be able to interact with all parts of the CIO2. These helper functions will later be extended to add new features to the IPU3 pipeline. 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>
2020-06-26libcamera: ipu3: cio2: Add function to generate configurationNiklas Söderlund
Collect the code used to generate configurations for the CIO2 block in the CIO2Device class. This allows simplifying the code and allow further changes to only happen at one code location. 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>
2020-06-26libcamera: ipu3: cio2: Consolidate information about formatsNiklas Söderlund
Instead of spreading the mapping between media bus codes and V4L2 FourCC all over the CIO2 code collect it in a single map and extract the data from it. This is done in preparation of adding PixelFormat information to the mix. 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>