summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline
AgeCommit message (Collapse)Author
2019-02-13libcamera: v4l2_device: Simplify exportBuffers()Kieran Bingham
exportBuffers() can only operate on an existing BufferPool allocation. The pool identifies its size through its .count() method. Passing a count in to the exportBuffers() call is redundant and can be incorrect if the value is not the same as the BufferPool size. Simplify the function and remove the unnecessary argument, correcting all uses throughout the code base. While we're here, remove the createBuffers() helper from the V4L2DeviceTest which only served to obfuscate which pool the buffers were being allocated for. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-02-08libcamera: pipeline: vimc: Fix name of pipeline handler classNiklas Söderlund
Rename the VIMC pipeline handler to match the naming convention. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-02-06libcamera: pipeline: ipu3: Implement capture supportJacopo Mondi
Replace the buffer allocation, capture start/stop and request queue stubs with real implementations. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> 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>
2019-02-06libcamera: pipeline: ipu3: Create video devices and subdevicesJacopo Mondi
Create the video devices and subdevices associated with an IPU3 camera. While at there, move the IPU3 pipeline handler class definition and the associated IPU3CameraData to a separate header as the class has now grown enough. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> 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>
2019-02-06libcamera: pipeline: vimc: Implement capture supportNiklas Söderlund
Replace the buffer allocation, capture start/stop and request queue stubs with real implementations. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-02-06libcamera: pipeline: vimc: Set a default formatNiklas Söderlund
Pick a default format for the one stream in a vimc camera. This is just a starting point to define a good default format for the vimc camera, and is expected to evolve over time as the capabilities of the library grows. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-02-06libcamera: pipeline: uvcvideo: Implement capture supportKieran Bingham
Replace the buffer allocation, capture start/stop and request queue stubs with real implementations. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-02-06libcamera: pipeline_handler: Extend the interface to support captureNiklas Söderlund
In order to support capture, the pipeline handler needs methods to allocate and free buffers, to start and stop the capture and to queue requests. Define those interfaces in the PipelineHandler class and implement them as stubs in the existing pipeline handlers. This initial implementation only considers the allocation of new buffers. Future work would need to expand this to also cover importing buffers from an external source. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-02-05libcamera: v4l2_device: Construct from MediaEntity*Jacopo Mondi
The V4L2Device constructor wants a "const MediaEntity &", while entities are usually retrieved by pointer before being used to construct a V4L2Device. Change the constructor argument to "const MediaEntity *". Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-02-04libcamera: pipeline: uvcvideo: set a default formatNiklas Söderlund
Pick a default format for the UVC one stream in a UVC camera. This is just a starting point to define a good default format for the UVC camera it's expected to evolve over time as the capabilities of the library grows. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-02-04libcamera: pipeline: vimc: create camera for Sensor BNiklas Söderlund
Create a camera for Sensor B of the vimc pipeline. At this stage only Sensor B is exposed while the are in total two sensors in the graph. Going forward Sensor A should also be exposed as another camera. Sensor B was chosen since the graph is configured correctly for it out of the box. As we lack control over sub devices formats it's not really possible to use Sensor A yet with the library. Once both cameras are registered with the library they should be extended to provide two streams each, one for the raw output and one for the output which uses the shared scaler. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-02-01libcamera: pipeline: extend pipelines to support stream configurationNiklas Söderlund
All streams which are to be used for capture need to be configured at the same time. This allows the pipeline handler to take any dependencies between the different streams and their configuration into account when setting up the hardware. Extend the pipeline API and all pipeline implementations with two new functions, one to read a default configuration and one to set a new configuration. Both functions operate on a group of streams which the pipeline handler should consider when performing the operations. In the current implemented pipelines this is rather easy as they only have one stream each per camera. Furthermore as there is yet no way for the pipeline handlers to interact with the hardware all they do is return a null format, log that a default configuration has been requested and log that a new configuration has been set. Future work based on more components are needed to make the pipelines return a good default format and actually interact with the hardware. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-02-01libcamera: camera: extend camera object to support streamsNiklas Söderlund
A camera consists of one or more video streams originating from the same video source. The different streams could for example have access to different hardware blocks in the video pipeline and therefore be able to process the video source in different ways. All static information describing each stream need to be recorded at camera creation. After a camera is created an application can retrieve the static information about its streams at any time. Update all pipeline handlers to register one stream per camera, this will be extended in the future for some of the pipelines. 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>
2019-01-30libcamera: pipeline: uvcvideo: add error if no default video device is foundNiklas Söderlund
If for any reason a default video device is not found in the media graph the creation of the UVC pipeline silently failed. This is not optimal when debugging problems with the pipeline, add an error to notify the user of the issue. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-29libcamera: ipu3: Re-work camera data registrationJacopo Mondi
Re-work camera data registration to create the cameraData pointer as unique_ptr<> and make clear its ownership model. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-29libcamera: ipu3: Add method to retrieve camera dataJacopo Mondi
Provide a method for the IPU3 pipeline handler that hides the downcast required to return an "IPU3CameraData *" reference from the PipelineHandler::cameraData() method. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-25libcamera: pipeline: uvcvideo: create a V4L2Device for the default video entityNiklas Söderlund
Add a V4L2Device for the default video entity in the media graph. The UVC pipeline needs to search for the entity marked with the MEDIA_ENT_FL_DEFAULT flag as the entity names in the media graph varies depending on which device is used. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-25libcamera: pipelines: rename MediaDevice member for UVC and VIMCNiklas Söderlund
The name dev_ does a poor job of representing that it holds a media device, rename it to media_. There is no functional change in this change just s/dev_/media_/. 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>
2019-01-25libcamera: ipu3: Create CIO2 V4L2 devicesJacopo Mondi
Create V4L2 devices for the CIO2 capture video nodes and associate them with the camera they are part of. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-25libcamera: pipeline: uvc: Mark the media device as hotpluggableLaurent Pinchart
UVC devices can be hot-unplugged. Mark the corresponding media device as hotpluggable to ensure proper disconnection support. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-25libcamera: pipeline_handler: Add camera disconnection supportNiklas Söderlund
Pipeline handlers are responsible for creating camera instances, but also for destroying them when devices are unplugged. As camera objects are reference-counted this isn't a straightforward operation and involves the camera manager and camera object itself. Add two helper methods in the PipelineHandler base class to register a camera and to register a media device with the pipeline handler. When registering a camera, the registerCamera() helper method will add it to the camera manager. When registering a media device, the registerMediaDevice() helper method will listen to device disconnection events, and disconnect all cameras created by the pipeline handler as a response. Under the hood the PipelineHandler class needs to keep track of registered cameras in order to handle disconnection. They can't be stored as shared pointers as this would create a circular dependency (the Camera class owns a shared pointer to the pipeline handler). Store them as weak pointers instead. This is safe as a reference to the camera is stored in the camera manager, and doesn't get removed until the camera is unregistered from the manager by the PipelineHandler. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-24libcamera: device_enumerator: Reference-count MediaDevice instancesLaurent Pinchart
The MediaDevice class will be the entry point to hot-unplug, as it corresponds to the kernel devices that will report device removal events. The class will signal media device disconnection to pipeline handlers, which will clean up resources as a result. This can't be performed synchronously as references may exist to the related Camera objects in applications. The MediaDevice object thus needs to be reference-counted in order to support unplugging, as otherwise pipeline handlers would be required to drop all the references to the media device they have borrowed synchronously with the disconnection signal handler, which would be very error prone (if even possible at all in a sane way). Handle MedieDevice instances with std::shared_ptr<> to support this. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-24libcamera: camera: Associate cameras with their pipeline handlerNiklas Söderlund
The PipelineHandler which creates a Camera is responsible for serving any operation requested by the user. In order forward the public API calls, the camera needs to store a reference to its pipeline handler. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> --- Changes since v1: - Create pipeline handlers is shared pointers, make them inherit from std::enable_shared_from_this<> and stored them in shared pointers.
2019-01-24libcamera: pipeline_handler: Store the camera manager pointerLaurent Pinchart
Instead of passing the camera manager pointer to the match() function, and later to more PipelineHandler functions, store it in the PipelineHandler::manager_ member variable at construction time and access it from there. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-22libcamera: ipu3: Use log categoriesJacopo Mondi
Log the IPU3 pipeline using IPU3 log category Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-22libcamera: pipeline: uvcvideo: add pipeline handler for uvcvideoNiklas Söderlund
Provide a pipeline handler for uvcvideo devices. The entity names for UVC devices are different for different cameras so matching on entity names is not possible in the generic case. This leaves options to create specialized UVC pipeline handlers if needed to fit a specific model's needs. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-22libcamera: pipeline: Add Intel IPU3 pipelineJacopo Mondi
Add a pipeline handler for the Intel IPU3 device. The pipeline handler creates a Camera for each image sensor it finds to be connected to an IPU3 CSI-2 receiver, and enables the link between the two. Tested on Soraka, listing detected cameras on the system, verifying the pipeline handler gets matched and links properly enabled. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-21libcamera: camera: Handle camera objects through shared pointersLaurent Pinchart
The Camera class is explicitly reference-counted to manage the lifetime of camera objects. Replace this open-coded implementation with usage of the std::shared_ptr<> class. This API change prevents pipeline handlers from subclassing the Camera class. This isn't deemed to be an issue. Mark the class final to make this explicit. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-21libcamera: camera_manager: Register cameras with the camera managerLaurent Pinchart
Cameras are listed through a double indirection, first iterating over all available pipeline handlers, and then listing the cameras they each support. To simplify the API make the pipeline handlers register the cameras with the camera manager directly, which lets the camera manager easily expose the list of all available cameras. The PipelineHandler API gets simplified as the handlers don't need to expose the list of cameras they have created. 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>
2019-01-02libcamera: device_enumerator: Use MediaDeviceJacopo Mondi
Replace usage of the DeviceInfo class with MediaDevice in the DeviceEnumerator and remove the DeviceInfo class. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-31libcamera: pipeline: vimc: add pipeline handler for vimcNiklas Söderlund
Provide a pipeline handler for the virtual vimc driver. 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>