summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2021-06-19libcamera: utils: Support systems that lack secure_getenv and issetugidLaurent Pinchart
Android provides neither secure_getenv() nor issetugid(). Enable compilation on that platform by using a plain getenv(), as that seems to be the best we can do. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-17libcamera: pipeline: simple: Fix crash when storing timestamp in metadataLaurent Pinchart
Commit 922833f774f6 ("libcamera: simple: Report sensor timestamp") unconditionally tries to access the request through the capture buffer to store the capture timestamp in the metadata. This causes a null pointer dereference when using a converter, as the capture buffers are free-wheeling in that case, and not associated with a request. Fix this by getting the request from the user-facing buffer, which can be the capture buffer when no converter is used. Fixes: 922833f774f6 ("libcamera: simple: Report sensor timestamp") 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-06-17android: camera_device: Simplify leftover CameraMetadata callsPaul Elder
There were some CameraMetadata calls that were left in the old version. Update them. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
2021-06-16libcamera: pipeline: vimc: Fail without an IPAKieran Bingham
The IPA is required for VIMC so fail early if it can't be loaded. Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-16pipeline: ipu3: Report error when failing to configureKieran Bingham
If the IPA fails to configure, this can now be caught by the pipeline handler but the cause may not be clear. If the IPA is isolated, then reports from that IPA will not be visible in the libcamera logs directly. Print the return error value to help identify any issue that has arisen. Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-16meson: summarise pathsKieran Bingham
The IPAs are loaded from a defined location set as IPA_MODULE_DIR. Furthermore, configuration files for both libcamera and IPAs are loaded from paths defined during the meson configuration. To make it easy to identify these locations for a given configuration, present them as a 'paths' section in the meson summary. This adds a summary section to meson in the form: Paths LIBCAMERA_DATA_DIR : "/usr/share/libcamera" LIBCAMERA_SYSCONF_DIR : "/etc/camera/libcamera" IPA_PROXY_DIR : "/usr/libexec/libcamera" IPA_CONFIG_DIR : "/etc/camera/libcamera/ipa:/usr/share/libcamera/ipa" IPA_MODULE_DIR : "/usr/lib/x86_64-linux-gnu/libcamera" Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-15android: camera_device: Drop HAL_PIXEL_FORMAT_RAW_OPAQUE supportHirokazu Honda
HAL_PIXEL_FORMAT_RAW_OPAQUE is requested only for Zero-Shutter-Lag (ZSL). ZSL requires RAW and YUV reprocessing. Since either of them is not supported by libcamera, supporting RAW_OPAQUE format doesn't make sense. Drop the format from the supported format list. 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-06-15ipa: raspberrypi: Non-functional formatting fixes to md_parser_smia.cppNaushir Patuck
Adjust source formatting to closer match libcamera guidelines: - Remove unused header files. - Switch to C style comments. - Adjust whitespace for readability. - Remove retcode local variable usage. There are no functional changes in this commit. 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>
2021-06-15ipa: raspberrypi: Rename md_parser.cpp to md_parser_smia.cppNaushir Patuck
The file implements the MdParserSmia class, so change the file name to reflect this. 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>
2021-06-15ipa: raspberrypi: Set default values for member variables of MdParserNaushir Patuck
Set some sensible default values for member variables of the MdParser class. Remove buffer_size_bytes_ along with some related asserts as this class now uses libcamera::Span for buffer handling, and buffer_size_bytes_ is unused. 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>
2021-06-15ipa: raspberrypi: Non-functional formatting fixes to md_parser.hppNaushir Patuck
Adjust source formatting to closer match libcamera guidelines: - Switch to C style comments. - Add whitespace for readability. There are no functional changes in this commit. 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>
2021-06-15libcamera: log: Destroy LogCategory instances in a controlled wayLaurent Pinchart
The LogCategory instances are constructed on first use as static variables in accessor functions, following the Meyers singleton pattern. As a result, their destruction order is not guaranteed. This can cause issues as the global Logger object, constructed in a similar fashion, is accessed from the LogCategory destructor and may be destroyed first. To fix this, keep the same singleton pattern, but allocate the LogCategory instances dynamically. As they get registered with the global Logger instance, we can destroy them in the Logger destructor. This only avoids destruction order issues between LogCategory and Logger, and doesn't address yet the fact that LOG() calls from destructors of global objects may access an already destroyed Logger. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chormium.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-14android: CameraDevice: Report queried test pattern modesHirokazu Honda
Report to the Android camera stack the list of supported test pattern modes constructed by inspecting the values reported by libcamera through the controls::draft::TestPatternMode control. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-06-14libcamera: pipeline: ipu3: Report available sensor test pattern modeHirokazu Honda
PipelineHandlerIPU3 gets available test pattern modes of the sensor device and reports them to a client. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-06-14libcamera: CameraSensor: Enable retrieving supported test pattern modesHirokazu Honda
This enables retrieving supported test pattern modes through CameraSensorInfo. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-06-14libcamera: CameraSensorProperties: Add table of v4l2 index and test patternHirokazu Honda
The V4L2 specification defines the sensor test pattern modes through a menu control, where a numerical index is associated to a string that describes the test pattern. The index-to-pattern mapping is driver specific and requires a corresponding representation in the library. Add to the static list of CameraSensorProperties a map of indexes to libcamera::controls::TestPatternModes values to be able to map the indexes returned by the driver to the corresponding test pattern mode. 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: Jacopo Mondi <jacopo@jmondi.org>
2021-06-14libcamera: V4L2Device: Support v4l2 menu controlHirokazu Honda
This adds a support of v4l2 menu. The control info for v4l2 menu contains indices without names and 64bit values of querymenu. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-06-14libcamera: controls: Add sensor test pattern modeHirokazu Honda
The control is used to report available sensor test pattern modes and also specify the mode to sensor. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-06-14android: Implement flush() camera operationJacopo Mondi
Implement the flush() camera operation in the CameraDevice class and make it available to the camera framework by implementing the operation wrapper in camera_ops.cpp. Introduce a new camera state State::Flushing to handle concurrent flush() and process_capture_request() calls. As flush() can race with processCaptureRequest() protect it by introducing a new State::Flushing state that processCaptureRequest() inspects before queuing the Request to the Camera. If flush() is in progress while processCaptureRequest() is called, return the current Request immediately in error state. If flush() has completed and a new call to processCaptureRequest() is made just after, start the camera again before queuing the request. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-06-14android: Rename CameraDevice::mutex_Jacopo Mondi
With the introduction of an additional mutex class member, the name of the existing one is too generic. Rename CameraDevice::mutex_ in CameraDevice::descriptorsMutex_ and use the libcamera provided libcamera::Mutex type to align the style with the rest of the code base. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-06-14android: Guard access to the camera stateJacopo Mondi
Guard access to the camera state and the start/stop sequences with a mutex. Currently only stop() and the first call to processCaptureRequest() start and stop the camera, and they're not meant to race with each other. With the introduction of flush() the camera can be stopped concurrently to a processCaptureRequest() call, hence access to the camera state will need to be protected. Prepare for that by guarding the existing paths with a mutex. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-06-14android: Replace scoped_lock<> with libcamera::MutexLockerJacopo Mondi
The CameraDevice class uses std::scoped_lock<> to guard access to the class' descriptors_ member. std::scoped_lock<> provides a set of features that guarantees safety when locking multiple mutexes in a critical section, while for single locks happening in a scoped block it does not provides benefits compared to the simplest std::unique_lock<> which libcamera provides the MutexLocker type for. Replace usage of std::scoped_lock<> with libcamera::MutexLocker to make the implementation consistent with the rest of the code base. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-06-14android: camera_device: Replace running_ with CameraStateJacopo Mondi
The CameraDevice class maintains the camera state in the 'running_' boolean flag to check if the camera has to be started at the first received process_capture_request() call which happens after the camera had been stopped. So far this was correct, as the operations that change the camera could only start or stop the camera, so a simple boolean flag was enough. To prepare to handle the flush() operation that will introduce a new 'flushing' state, replace the simple plain boolean flag with an enumeration of values that define the CameraState. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-06-14libcamera: pipeline_handler: Cancel Request on queueing failureJacopo Mondi
Capture requests are queued by the PipelineHandler base class to each pipeline handler implementation using the virtual queueRequestDevice() function. However, if the pipeline handler fails to queue the request to the hardware, the request gets silently deleted from the list of queued ones, without notifying application of the error. Reporting to applications that a Request has failed to queue by cancelling and then completing it allows applications to maintain their request-tracking mechanism consistent with the one internal to the library. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-06-14libcamera: request: Add Request::cancel()Jacopo Mondi
Add a cancel() function to the Request class that allows to forcefully complete the request and its associated buffers in error state. Only pending requests can be forcefully cancelled. Enforce that by asserting the request state to be RequestPending. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-06-14android: Rework request completion notificationJacopo Mondi
The current implementation of CameraDevice::requestComplete() which handles event notification and calls the framework capture result callback does not handle error notification precisely enough. In detail: - Error notification is an asynchronous callback that has to be notified to the framework as soon as an error condition is detected, and it independent from the process_capture_result() callback - Error notification requires the HAL to report the precise error cause, by specifying the correct CAMERA3_MSG_ERROR_* error code. The current implementation only notifies errors of type CAMERA3_MSG_ERROR_REQUEST at the end of the procedure, before the callback invocation. Rework the procedure to: - Notify CAMERA3_MSG_ERROR_DEVICE and perform library tear-down in case a Fatal error is detected - Notify CAMERA3_MSG_ERROR_REQUEST if the libcamera::Request::status is different than RequestCompleted and immediately call process_capture_result() with all buffers in error state. - Notify the shutter event as soon as possible - Notify CAMERA3_MSG_ERROR_RESULT in case the metadata cannot be generated correctly and call process_capture_result() with the right buffer state regardless of metadata availability. - Notify CAMERA3_MSG_ERROR_BUFFER for buffers whose post-processing failed While at it, return the CameraStream buffer by calling cameraStream->putBuffer() regardless of the post-processing result. No regression detected when running CTS in LIMITED mode. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-06-14ipa: ipu3: Support return values from configure()Kieran Bingham
The IPU3 IPA interface does not define a return value from configure(). This prevents errors from being reported back to the pipeline handler when they occur in the IPA. Update the IPU3 IPA interface and add return values to the checks in IPAIPU3::configure() accordingly Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-09ipa: ipu3: Fix struct/class mismatch in forward declarationLaurent Pinchart
The ipu3_agc.h forward-declares the IPACameraSensorInfo structure, but incorrectly declares it as a class. This causes a compilation error with clang: include/libcamera/ipa/core_ipa_interface.h:24:1: error: 'IPACameraSensorInfo' defined as a struct here but previously declared as a class; this is valid, but may result in linker errors under the Microsoft C++ ABI [-Werror,-Wmismatched-tags] struct IPACameraSensorInfo ^ ../../src/ipa/ipu3/ipu3_agc.h:21:1: note: did you mean struct here? class IPACameraSensorInfo; ^~~~~ struct Fix it. Fixes: 384a53d3cdf7 ("ipa: ipu3: Calculate line duration from IPACameraSensorInfo") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Tested-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
2021-06-08ipa: raspberrypi: Switch the AGC/Lux code to use utils::DurationNaushir Patuck
Convert the core AGC and Lux controller code to use utils::Duration for all exposure time related variables and calculations. Convert the exposure/shutter time fields in AgcStatus and DeviceStatus to use utils::Duration. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-06-08ipa: raspberrypi: Switch AgcAlgorithm API to use utils::DurationNaushir Patuck
Switch the AgcAlgorithm API functions to use utils::Duration for all time based variables. 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-06-08ipa: raspberrypi: Switch ipa and cam_helper to use utils::DurationNaushir Patuck
Switch the ipa and cam_helper code to use libcamera::utils::Duration for all time based variables. This improves code readability and avoids possible errors when converting between time bases. 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>
2021-06-08libcamera: utils: Add helper class for std::chrono::durationNaushir Patuck
A new utils::Duration class is defined to represent a std::chrono::duration type with double precision nanosecond timebase. Using a double minimises the loss of precision when converting timebases. This helper class may be used by IPAs to represent variables such as frame durations and exposure times. An operator << overload is defined to help with displaying utils::Duration value in stream objects. Currently, this will display the duration value in microseconds. 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-06-08ipa: ipu3: Calculate frame duration from minimum VBLANK valueUmang Jain
Frame duration is hard-coded for CTS as per [1]. Ideally, to accurately calculate the frame duration, it needs the VBLANK value from every frame's exposure. However, this particular bit is yet to be implemented in IPAIPU3. Meanwhile, we can at least head in the right direction by not hard coding the value, instead using the default VBLANK value as reported by the sensor. Update the existing \todo, to use the derived VBLANK value as and when it's available from each frame exposure. [1] 6c5f3fe6ced7 ("ipa: ipu3: Set output frame duration metadata") Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Tested-by: Paul Elder <paul.elder@ideasonboard.com> Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-06-08ipa: ipu3: Copy IPACameraSensorInfo for future usageUmang Jain
IPACameraSensorInfo members will be needed at various places in the IPAIPU3 class, in subsequent commits. Hence, it seems trivial to copy this structure for wider availability throughout the class. This commit does not introduce any functional changes. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Tested-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-06-08ipa: ipu3: Calculate line duration from IPACameraSensorInfoUmang Jain
Squash \todo by calculating line duration from IPACameraSensorInfo, now passed in, to IPU3Agc::initialise(). Since line duration is now calculated from real values, store it as a private member in IPU3Agc class. As a further step, replace the associated global constant, kMaxExposureTime, with a private IPU3Agc class member as well, and assign its value correspondingly in IPU3Agc::initialise(), similar to previous precedence. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Tested-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-06-07gstreamer: Add error checking in gst_libcamera_src_task_enter()Vedant Paranjape
The return value from generateConfiguration() was not checked. Only assert was added as a guard which checked if the size of the generated camera config was equal to size of roles passed to it. If the roles variable has an invalid/unsupported role, it will return a nullptr and then trying to access a member on a nullptr for size comparison will result in a segmentation fault. So, if the function returns a nullptr, simply push an error message on GstBus and gracefully exit. Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
2021-06-07libcamera: V4L2Device: Remove the controls order assumption in updateControls()Hirokazu Honda
The original updateControls() has the assumption that ctrls and v4l2Ctrls lists are in the same order. It is dependent on the caller implementation though. This changes updateControls() implementation so that it works without the assumption. 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-06-04libcamera: Add libcamera_generated_ipa_headers as a dependency for libcamera_depNiklas Söderlund
Some external components such as the unit tests include headers generated for the IPA's. This is not fully described in meson for each external component which results in one or more races in the build system. Instead of playing whack-a-mole add the generated IPA headers to libcamera_dep. Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-06-04libcamera: Add IMX258 sensor propertiesUmang Jain
Brief specifications available at https://www.sony-semicon.co.jp/products/common/pdf/ProductBrief_IMX258_20151015.pdf Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
2021-06-03qcam: Add libatomic dependencyFabrice Fontaine
Add libatomic dependency due to std::shared_ptr which is used by qcam since its addition in commit 97e8b3a2eb321884fe1e15fb584f41a38cc33d51: https://en.cppreference.com/w/cpp/memory/shared_ptr. This will avoid the following build failure: /srv/storage/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/sparc-buildroot-linux-uclibc/9.3.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: src/qcam/qcam.p/main_window.cpp.o: undefined reference to symbol '__atomic_fetch_add_4@@LIBATOMIC_1.0' Fixes: - http://autobuild.buildroot.org/results/d0726b2253f1f3d006e057f3b32c646c4b9b5f7a Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-06-02android: Make FRAME_DURATION result key available in static metadataUmang Jain
Report ANDROID_SENSOR_FRAME_DURATION as an available result key for CTS to read out the value of frame duration we set in CameraDevice::getResultMetadata(). Failing to do so might fail the CTS test: - android.hardware.camera2.cts.CaptureRequestTest#testNoiseReductionModeControl Fixes: 3beb1accac1d ("android: camera_device: Fix sensor frame duration") Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-06-01android: Fix unused parameter warnings on Chrome OSLaurent Pinchart
The Chrome OS-specific code has multiple function parameters that are not used. This results in compilation warnings. Fix them with [[maybe_unused]]. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
2021-06-01ipa: ipu3: Use a default gamma LUT at startupJean-Michel Hautbois
A custom gamma LUT is used, but the table is not calculated at startup, resulting in an all 0's frame. Use the drfault LUT specified in the Linux kernel as a first estimation. Reported-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Tested-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-06-01libcamera: pipeline: ipu3: Fix incorrect bdsHeight calculationLaurent Pinchart
When compiling with optimization, gcc 9 and newer throw an unitialized variable warning: ../../src/libcamera/pipeline/ipu3/imgu.cpp: In function ‘void libcamera::{anonymous}::calculateBDSHeight(libcamera::ImgUDevice::Pipe*, const libcamera::Size&, const libcamera::Size&, unsigned int, float)’: ../../src/libcamera/pipeline/ipu3/imgu.cpp:172:17: error: ‘bdsHeight’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 172 | unsigned int bdsIntHeight = static_cast<unsigned int>(bdsHeight); Neither clang not gcc versions older than 9 complain. This seems to be a false positive. However, there's an obvious error in the code. The second while () loop in the first part of calculateBDSHeight() modifies the bdsHeight variable set by the first loop even if the second loop doesn't find a suitable height. This can result in an incorrect bdsHeight value. Fix this, which also gets rid of the compiler warning. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
2021-05-31gst: Fix compilation warning with GLib >= 2.62Laurent Pinchart
GLib 2.62 has deprecated g_memdup(), which is used inline in GStreamer's gstbytereader.h header. This results in a compilation warning: In file included from /usr/include/gstreamer-1.0/gst/base/base.h:35, from ../../src/gstreamer/gstlibcamerasrc.cpp:39: /usr/include/gstreamer-1.0/gst/base/gstbytereader.h: In function ‘guint8* gst_byte_reader_dup_data_unchecked(GstByteReader*, guint)’: /usr/include/gstreamer-1.0/gst/base/gstbytereader.h:365:41: error: ‘void* g_memdup(gconstpointer, guint)’ is deprecated: Use 'g_memdup2' instead [-Werror=deprecated-declarations] 365 | return (guint8 *) g_memdup (data, size); GLib has a mechanism to silence warnings introduced in newer versions, to allow compilation without warnings on multiple versions of the library. This is done by setting the GLIB_VERSION_MIN_REQUIRED macro to the minimum GLib version required. As we depend on GStreamer >= 1.14, set the minimum GLib version to 2.40. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
2021-05-31android: Don't rely on indirect inclusion of unistd.hLaurent Pinchart
The standard C library close() and lseek() functions require inclusion of the unistd.h header. Include it explicitly where needed instead of relying on indirect inclusion. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Tested-by: Paul Elder <paul.elder@ideasonboard.com>
2021-05-27Revert "libcamera: ipu3: imgu: Add pipe calculation debug"Jacopo Mondi
This reverts commit 5b015e96ccdbcd87b4ba6484199652fec5cdb38a. The ImgU pipe configuration debug is useful to test the correctness of the parameters computation against the Intel Python script. However, the number of debug messages which is printed out by the configuration procedure is so high it floods the logs, up to the point that starting the Android camera3 HAL, which tests several configurations at startup, becomes so slow it is barely usable. Revert the patch that adds the excessive debug statements, which are mostly useful only when testing the configuration procedure. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Acked-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-05-27meson: ipa: Build documentation cpp files from mojom filesPaul Elder
Plumb meson to build the cpp files from the mojom files for the purpose of containing the documentation for the IPA interfaces. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2021-05-27ipa: core: Move documentation from cpp file back into the mojom filePaul Elder
Move the documentation back to the mojom file from the cpp file. While at it, move the documentation for IPAInterface::init() and IPAInterface::stop() to the IPA guide. While at it, update the todo comment in all of the mojom files accordingly. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> [umang.jain@ideasonboard.com: Update todos] Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-05-27ipa: ipu3: Set output frame duration metadataPaul Elder
The sensor frame duration should be set by the IPA. Hardcode it for now. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org>