summaryrefslogtreecommitdiff
path: root/src/libcamera
AgeCommit message (Collapse)Author
2021-05-06libcamera: simple: Report sensor timestampJacopo Mondi
Report the sensor's timestamp in the Request metadata using the completed buffer timestamp. The buffer's timestamp is recorded at DMA-transfer time, and it does not theoretically matches the 'start of exposure' definition. Record this with a \todo entry. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-06libcamera: rkisp1: Report sensor timestampJacopo Mondi
Report the sensor's timestamp in the Request metadata using the completed buffer timestamp. The buffer's timestamp is recorded at DMA-transfer time, and it does not theoretically matches the 'start of exposure' definition. Record this with a \todo entry. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-06libcamera: rkisp1: Do not over-write metadataJacopo Mondi
When a Request is completed upon receiving the IPA produced metadata, the metadata associated with the Request are over-written, deleting the information set at output buffer completion, such as the SensorTimestamp. This commit applies to the RkISP1 pipeline handler the same change applied to IPU3 in commit 2ee3dd57e2fc ("libcamera: ipu3: Merge IPA metadata controls"). Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-06libcamera: uvc: Report sensor timestampJacopo Mondi
Report the sensor's timestamp in the Request metadata using the completed buffer timestamp. The UVC driver reports timestamps of SOE event through metadata, for which there is no support in the current pipeline implementation. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Hirokazu Honda <hiroh@chromium.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-05-06libcamera: ipu3: Merge IPA metadata controlsJacopo Mondi
When a Request is completed upon receiving the IPA produced metadata, they should be merged with the metadata set by the pipeline handler before reporting them to applications. Use ControlList::merge() to collect the IPA produced controls to the request's metadata. Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-06libcamera: ipu3: Report sensor timestampJacopo Mondi
Report the sensor's timestamp in the Request metadata by using the CIO2 buffer timestamp as an initial approximation. The buffer's timestamp is recorded at DMA-transfer time, and it does not theoretically matches the 'start of exposure' definition, but when used to compare two consecutive frames it gives an acceptable estimation of the sensor frame period duration. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-06libcamera: controls: Destage 'SensorTimestamp'Jacopo Mondi
Destage the 'SensorTimestamp' control, which is used by pipeline handlers to report the time when the first active line of the sensor's pixel array is exposed. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-06libcamera: controls: Add a function to merge two control listsLaurent Pinchart
Add a new ControlList::merge() function to merge two control lists by copying in the values in the list passed as parameters. This can be used by pipeline handlers to merge metadata they populate with metadata received from an IPA. Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> [reimplement the function by not using std::unordered_map::merge()] Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-03pipeline: rkisp1: Add check for non-existent frame infoSebastian Fricke
Add a check, that makes sure that the given FrameBuffer is associated to a RkISP1FrameInfo instance. The current code tries to access the frame info without checking if it actually exists. Fixes: 0eb65e14e ("libcamera: pipeline: rkisp1: Attach to an IPA") Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-26libcamera: V4L2Device: Use Span in updateControls()Hirokazu Honda
V4L2Device::updateControls() takes two arguments, raw array and its size, for the v4l2_ext_control values. This replaces it with libcamera::Span. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> 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> Tested-by: Jacopo Mondi <jacopo@jmondi.org>
2021-04-26libcamera: V4L2Device: Replace VLA with std::vector in setControls()Hirokazu Honda
The original code uses Variable-Length-Array, which is not officially supported in C++. This replaces the array with std::vector. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> 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> Tested-by: Jacopo Mondi <jacopo@jmondi.org>
2021-04-26libcamera: V4L2Device: Replace VLA with std::vector in getControls()Hirokazu Honda
The original code uses Variable-Length-Array, which is not officially supported in C++. This replaces the array with std::vector. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Jacopo Mondi <jacopo@jmondi.org>
2021-04-22libcamera: pipeline: ipu3: Cancel unused buffersKieran Bingham
When the CIO2 returns a cancelled buffer, we will not queue buffers to the IMGU. These buffers should be explicitly marked as cancelled to ensure the application knows there is no valid metadata or frame data provided in the buffer. Provide a cancel() method on the FrameBuffer to allow explicitly cancelling a buffer. Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-22libcamera: pipeline: rkisp1: Fail RkISP1FrameInfo can't be foundKieran Bingham
The RkISP1FrameInfo structure associated data sent to the IPA and is essential for handling events. If it can not be found, this is a fatal error which must be fixed. Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-22libcamera: pipeline: ipu3: frames: Fail if the FrameInfo can't be foundKieran Bingham
The FrameInfo structure associates the data sent to the IPA and is essential for handling events. If it can not be found, this is a fatal error which must be fixed. While we're changing the line, also correct a spelling error for 'Information'. Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-22libcamera: camera: Assert pipelines complete all requestsKieran Bingham
When the camera manager calls stop on a pipeline, it is expected that the pipeline handler guarantees all requests are returned back to the application before the camera has stopped. Ensure that this guarantee is met by providing an accessor on the pipeline handler to validate that all pending requests are removed. Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-21libcamera: class: Drop 'klass' argument from documentationJacopo Mondi
The LIBCAMERA_D_PTR() and LIBCAMERA_O_PTR() macros do not require an argument, but the version of the macro consumed by Doxygen does. Fix this by removing the klass parameter from both macros in their documentation version. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-04-21libcamera: Drop argument from LIBCAMERA_DECLARE_PRIVATEJacopo Mondi
The LIBCAMERA_DECLARE_PRIVATE() macro, used by the library classes that inherit from libcamera::Extensible in order to implement the PIMPL pattern, expands to: public: \ class Private; \ friend class Private; The 'klass' argument is not used and it might confuse developers as it might hint that the class that defines the pattern's implementation can be freely named, while it is actually hardcoded to 'Private'. Drop the argument from the macro definition. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Hanlin Chen <hanlinchen@google.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-04-20pipeline: raspberrypi: Fix typo in a commentNaushir Patuck
s/embedded/bayer/ Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Sebastian Fricke <sebastian.fricke@posteo.net> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-04-17libcamera: pipeline: ipu3: Check for failures when loading IPAKieran Bingham
The ipa_->init() method can fail if the IPA can't load correctly. This should be caught by the pipeline handler to prevent continuing with an invalid IPA. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-04-15libcamera: camera_sensor: Demote error messageJacopo Mondi
The CameraSensor class is noisy enough in reporting the missing sensor driver features. Demote an error message about defaulting the active sensor area when retrieving the camera sensor info to a warning. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-04-15libcamera: log: Use compiler builtins to retrieve file and line numberLaurent Pinchart
Replace the __FILE__ and __LINE__ values passed to the _log() function with default parameters, taking their values from the __builtin_FILE() and __builtin_LINE() functions. This moves handling of the file and line from the preprocessor to the compiler, which is generally preferred as it increases type safety. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Sebastian Fricke <sebastian.fricke@posteo.net> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-15libcamera: log: De-duplicate _log() functions and LogMessage constructorLaurent Pinchart
The _log() functions, as well as the LogMessage constructor, exist in two versions, one that takes a log category, and one that doesn't. The latter uses the default log category. This can be simplified by passing a LogCategory pointer to _log(), which can then be null for the default category, and moving the retrieval of the default log category from the LogMessage constructor to the _log() function. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Sebastian Fricke <sebastian.fricke@posteo.net> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-15libcamera: pipeline_handler: Fix typo in documentationLaurent Pinchart
There's no CameraConfiguration::valid(), the correct function is CameraConfiguration::validate(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Sebastian Fricke <sebastian.fricke@posteo.net>
2021-04-14libcamera: pipeline: rkisp1: Allow requests to be cancelledNícolas F. R. A. Prado
Previously when a frame got cancelled, the frameInfo flags metadataProcessed and paramDequeued wouldn't get set, meaning that the request wasn't able to be completed and cancelled. Make sure that these flags are set when the frame gets cancelled so that the request can be cancelled. This issue happened while running lc-compliance. Suggested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2021-04-14libcamera: pipeline: rkisp1: Assert empty queuedRequests before clearing ↵Nícolas F. R. A. Prado
frameInfo Assert that there are no queued requests before clearing the frameInfo, otherwise a SEGFAULT can occur. This issue happened while running lc-compliance. Suggested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2021-04-14libcamera: pipeline: rkisp1: Stop IPA before streamsNícolas F. R. A. Prado
The IPA should be stopped before stopping the streams in order to avoid a "No BufferCache available to queue" issue. This issue happened while running lc-compliance. Suggested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2021-04-14pipeline: simple: Fix an issue in breadth-first searchPhi-Bang Nguyen
When seting up the pipeline, the latest entity in the queue is taken but the oldest one is poped. This is a mistake. Fix it. Fixes: 4671911df040 ("pipeline: simple: Use breadth-first search to setup media pipeline") Signed-off-by: Phi-Bang Nguyen <pnguyen@baylibre.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-04-13libcamera: pipeline_handler: Document requestSequence_Kieran Bingham
The documentation for requestSequence_ was not added when the sequence number was implemented. Provide it. Fixes: d874b3e34173 ("libcamera: request: Provide a sequence number") Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-13libcamera: ipa_proxy: Document ProxyStateKieran Bingham
The documentation for the ProxyState and tracking variable was not added when the IPA was extended with a state machine. Add it. Fixes: 70238ceca5b2 ("utils: ipc: proxy: Track IPA with a state machine") Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-07libcamera: camera_manager: Remove \todo on hotplug/unplug of camerasUmang Jain
Fixes: e9b47217b44c ("libcamera: camera_manager: Introduce signals when a camera is added or removed") Signed-off-by: Umang Jain <email@uajain.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-04-07libcamera: thread: Fix typo in commentSebastian Fricke
s/This method enter/This method enters/ Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net> 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-04-04android: Define OS_CHROMEOS macro if android_platform=crosHirokazu Honda
Android Camera HAL 3 API used in ChromeOS has a ChromeOS own extension, for example, crop_rotate_scale_degrees in camera3_stream. As those extensions are not available on Android platforms, introduce a OS_CHROMEOS macro that can be used to compile CrOS-specific code conditionally. The macro is defined if and only if android_platform is 'cros'. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-04-03libcamera: pipeline_handler: Make queueRequest() void functionHirokazu Honda
PipelineHandler::queueRequest() is asynchronously invoked in Camera::queueRequest(). Therefore the return value of PipelineHandler::queueRequest() is useless. This changes the function to a void function. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> 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-03-29libcamera: thread: Remove the unused setEventDispatcher() functionLaurent Pinchart
Custom event dispatchers for threads was an API meant to provide a way to integrate libcamera in the application's event loop. This isn't used anymore, as libcamera now creates internal threads. Drop the unused Thread::setEventDispatcher() function, and update the documentation accordingly. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-29pipeline: raspberrypi: Remove unused getFormat callSebastian Fricke
The comment states, that we get the device format to pass it to the IPA, but the variable `sensorFormat` is not used again after it's assignment. Remove it, together with the comment. Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net> 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-03-29libcamera: pipeline: ipu3: frames: Use the request sequenceKieran Bingham
For all frame indexes, use the same sequence number as generated by the Request object. This allows clear matching of what operations occurred to which request. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-29libcamera: camera: Extend with a Stopping stateKieran Bingham
When the camera is being stop()ped, active requests will complete. These may trigger an application to re-queue those requests to the camera but that is not permitted, and is an error in the application. Extend the camera state to include a stopping state which is entered as soon as a call to stop() is made. At this point, any request queued will be rejected with a warning, while any pending requests are either successfully completed or cancelled. When the pipeline handler has finished stopping, the camera state will transition to the CameraConfigured state where it can begin to accept requests again, and be restarted. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-29libcamera: camera: Report function which fails access controlKieran Bingham
The camera object has a state machine to ensure calls are only made when in the correct state. It isn't easy to identify where things happen when assertions fail so add extra information to make this clearer. The error level of the isAccessAllowed is raised from Debug to Error as this is important information for applications to know if they have made a request in an invalid state. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-29libcamera: camera: Validate requests are completed in Running stateKieran Bingham
All requests must have completed before the Camera has fully stopped. Requests completing when the camera is not running represent an internal pipeline handler bug. Trap this event with a fatal error. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-29libcamera: request: Add a toString()Kieran Bingham
Provide a toString helper to assist in printing Request state for debug and logging contexts. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-29libcamera: request: Provide a sequence numberKieran Bingham
Provide a sequence number on Requests which are added by the pipeline handler. Each pipeline handler keeps a requestSequence per CameraData and increments everytime a request is queued on that camera. The sequence number is associated with the Request and can be utilised for assisting with debugging, and printing the queueing sequence of in flight requests. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-29libcamera: buffer: Break friendship with RequestKieran Bingham
The FrameBuffer class is only friends with Request so that the request can be associated with the buffers. FrameBuffer already has a helper to setRequest(), so let's use that directly instead. Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-29utils: ipc: proxy: Track IPA with a state machineKieran Bingham
Asynchronous tasks can only be submitted while the IPA is running. Further more, the shutdown sequence can not be tracked with a simple running flag. We can also be in the state 'Stopping' where we have not yet completed all events, but we must not commence anything new. Refactor the running_ boolean into a stateful enum to track this. Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-29libcamera: pipeline: ipu3: Fix typosLaurent Pinchart
Fix two simple typos. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Sebastian Fricke <sebastian.fricke@posteo.net> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2021-03-28pipeline: uvcvideo: Avoid reference to temporary objectKhem Raj
A range-based for loop whose range expression is an array of char pointers and range variable declaration is a const reference to a std::string creates a temporary string from the char pointer and binds the range variable reference to it. This creates a const reference to a temporary, which is valid in C++, and extends the lifetime of the temporary to the lifetime of the reference. However, lifetime extension in range-based for loops is considered as a sign of a potential issue, as a temporary is created for every iteration, which can be costly, and the usage of a reference in the range declaration doesn't make it obvious that the code isn't simply binding a reference to an existing object. gcc 11, with the -Wrange-loop-construct option, flags this: uvcvideo.cpp:432:33: error: loop variable 'name' of type 'const string&' {aka 'const std::__cxx11::basic_string<cha r>&'} binds to a temporary constructed from type 'const char* const' [-Werror=range-loop-construct] | 432 | for (const std::string &name : { "idVendor", "idProduct" }) { | | ^~~~ To please the compiler, make the range variable a const char *. This may bring a tiny performance improvement, as the name is only used once, in a location where the compiler can use operator+(const std::string &, const char *) instead of operator+(const std::string &, const std::string &) Signed-off-by: Khem Raj <raj.khem@gmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Use a const char * type instead of auto, and update the commit message accordingly. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-03-28pipeline: raspberryPi: Fix typo in commentSebastian Fricke
s/Will need to/We'll need to/ Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-03-25libcamera: camera_manager: Document the CameraManager destructorLaurent Pinchart
The destructor stops the camera manager if it is running. This is at the moment an implementation detail, but makes sense to guarantee in the API. Document it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Sebastian Fricke <sebastian.fricke@posteo.net> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-03-24libcamera: v4l2_videodevice: Prevent queueing buffers without a cacheKieran Bingham
The V4l2 buffer cache allows us to map incoming buffers to an instance of the V4L2 buffer required to actually queue. If the cache_ is not available, then the buffers required to allow queuing to a device have been released, and this indicates an issue at the pipeline handler. This could be a common mistake, as it could happen if a pipeline handler always requeues buffers to the device after they complete, without checking if they are cancelled. Catch any invalid queueing of buffers to the V4L2 video device when resources have been released by adding a Fatal log message to highlight the error during development. Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-24libcamera: pipeline: ipu3: frames: Associate buffers with the requestKieran Bingham
Ensure that the buffers are associated with the request even if they are used internally to be able to correctly map back to the resources they are being used to fulfil. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>