summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-09-12test: gstreamer: gstreamer_test: Remove redundant wordRishikesh Donadkar
Remove redundant "create" in the error message. Signed-off-by: Rishikesh Donadkar <rishikeshdonadkar@gmail.com> Reviewed-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
2022-09-12test: gstreamer: Fix failure of gstreamer_multistream_testVedant Paranjape
Multistream test failed with the following logs, to run on Raspberry Pi 4 due to a bug introduced in one of the recent patches refactoring the code that fails to set the camera-name property with a valid camera id string. WARN libcamerasrc gstlibcamerasrc.cpp:347:gst_libcamera_src_open:<libcamera> error: Could not find a camera named ''. WARN libcamerasrc gstlibcamerasrc.cpp:347:gst_libcamera_src_open:<libcamera> error: libcamera::CameraMananger::get() returned nullptr This patch assigns the camera->id() to the variable cameraName_ that is later used to set element property "camera-name" needed to call the specific camera which supports multistreams. Move the code to set element property "camera-name" to base class GstreamerTest. Fixes: 5646849b59fe ("test: gstreamer: Check availability of cameras before running") Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Tested-by: Rishikesh Donadkar <rishikeshdonadkar@gmail.com> Reviewed-by: Rishikesh Donadkar <rishikeshdonadkar@gmail.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
2022-09-12gstreamer: Check gstreamer version before using newer macrosVedant Paranjape
GST_VIDEO_TRANSFER_BT601 and GST_VIDEO_TRANSFER_BT2020_10 macros are defined in GST Version 1.18.0. Usage of these macros causes gstlibcamera compilation failure if GST_VERSION < 1.18.0. These macros are used only if GST_VERSION >= 1.18.0. Fix the following compilation error: ../src/gstreamer/gstlibcamera-utils.cpp:157:7: error: ‘GST_VIDEO_TRANSFER_BT601’ was not declared in this scope; did you mean ‘GST_VIDEO_TRANSFER_BT709’? 157 | case GST_VIDEO_TRANSFER_BT601: | ^~~~~~~~~~~~~~~~~~~~~~~~ | GST_VIDEO_TRANSFER_BT709 ../src/gstreamer/gstlibcamera-utils.cpp:159:7: error: ‘GST_VIDEO_TRANSFER_BT2020_10’ was not declared in this scope; did you mean ‘GST_VIDEO_TRANSFER_BT2020_12’? 159 | case GST_VIDEO_TRANSFER_BT2020_10: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ | GST_VIDEO_TRANSFER_BT2020_12 Fixes: fc9783acc608 ("gstreamer: Provide colorimetry <> ColorSpace mappings") Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Tested-by: Rishikesh Donadkar <rishikeshdonadkar@gmail.com> Reviewed-by: Rishikesh Donadkar <rishikeshdonadkar@gmail.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
2022-07-04gstreamer: Use gst_task_resume() when availableLaurent Pinchart
The gst_libcamera_resume_task() helper is an implementation of the gst_task_resume() function that predates its addition to GStreamer. Use gst_task_resume() when available, and rename gst_libcamera_resume_task() to gst_task_resume() to support older GStreamer versions. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
2022-04-02Documentation: guides: introduction: Fix spelling errorsKunal Agarwal
Fixes two spelling mistakes in introduction.rst This patch has no functional changes. Signed-off-by: Kunal Agarwal <kunalagarwal1072002@gmail.com> Reviewed-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
2022-01-21v4l2: V4L2CameraProxy: Add support for PREPARE_BUF as one of the supported ioctlVedant Paranjape
Add support for PREPARE_BUF as one of the ioctl. Since this is a compat layer, there doesn't seem to be an equivalent to the "transfer ownership of the buffer to kernel driver" in V4L2Camera class. Thus, simply duplicate the checks done by vidioc_qbuf. To match the error checks done by kernel implementation, we'd have to check if dmabuf fd is valid and that the buffer size is large enough. Doing so will not add any particular value to the program as applications most likely don't depend on these conditions being handled correctly. Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-01-14v4l2: v4l2_camera_proxy: Zero flags in VIDIOC_REQBUFSLaurent Pinchart
The V4L2 compatibility layer doesn't support any of the VIDIOC_REQBUFS flags. They are all correctly ignored, but also need to be zeroed before returning to indicate that they haven't been taken into account. This fixes a v4l2-compliance failure: Buffer ioctls (Input 0): fail: ../../utils/v4l2-compliance/v4l2-test-buffers.cpp(682): coherent test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL Fixes: aa4533639971 ("include: linux: Update kernel headers to version v5.16-rc7") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-01-08v4l2: v4l2_camera_proxy: Add EXPBUF as one of the supported ioctlVedant Paranjape
To support DMABUF as one of the memory buffer, we need to implement EXPBUF in the v4l2 compat layer. This patch implements vidioc_expbuf as one of the supported ioctls. Bug: https://bugs.libcamera.org/show_bug.cgi?id=89 Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-10-04test: gstreamer: Remove unnecessary header file includesVedant Paranjape
Remove header files which were not being used in the test code. The following headers were removed from the gstreamer_single_stream_test: - libcamera/base/utils.h - libcamera/internal/source_paths.h Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
2021-09-28gstreamer: Fix spelling of the work manager used in a util functionVedant Paranjape
Fix all name in all instances of the function gst_libcamera_get_camera_mananger to gst_libcamera_get_camera_manager. Spelling of manager was incorrect. This patch has no functional changes. Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-09-24test: gstreamer: Add a test for gstreamer multi streamVedant Paranjape
This patch adds a test to test if multi stream using libcamera's gstreamer element works. Test will run only on devices that support multistream capture, eg., devices that use IPU3 and raspberrypi pipeline. This was tested on a Raspberry Pi 4B+. Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
2021-09-23test: gstreamer: Simplify elements' ownershipsVedant Paranjape
In gstreamer, when elements are created, usually a floating [1] reference is returned which simply means, there is no ownership transfer (yet). Once can simply check for NULL and return through an error path, without bothering to clean up. Hence, g_autoptr is not much of help here. If the NULL checks have been passed successfully, elements are ready to use. However, we must claim ownership/reference it before using them via g_object_ref_sink(). This patch build upon this principle and removes the g_autoptr from gstreamer test base class (gstreamer_test.cpp) whereever necessary to tide up the code. [1] https://gstreamer.freedesktop.org/documentation/additional/design/MT-refcounting.html?gi-language=c#refcounting1 Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
2021-09-23test: gstreamer: Simplify single stream test using functions from GstUtilsVedant Paranjape
Simplify memory handling and complexity of the test by using gst_parse_bin_from_description_full [1]. [1]: https://gstreamer.freedesktop.org/documentation/gstreamer/gstutils.html?gi-language=c#gst_parse_bin_from_description_full Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
2021-09-23test: gstreamer_single_stream_test: Fix memory leakVedant Paranjape
The test hold a valid reference to convert0_ and sink0_ but not released. This results in a memory leak and can be checked via valgrind. Drop the references with test cleanup() virtual function. Valgrind log (glib and gst suppression files were used): ==345380== LEAK SUMMARY: ==345380== definitely lost: 1,688 bytes in 2 blocks ==345380== indirectly lost: 7,069 bytes in 42 blocks The patch fixes the leaks reported by valgrind above to: ==348870== LEAK SUMMARY: ==348870== definitely lost: 0 bytes in 0 blocks ==348870== indirectly lost: 0 bytes in 0 blocks Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
2021-09-22gstreamer: Convert cm_singleton_ptr to static variableVedant Paranjape
The global pointer pointing to libcamera's CameraManager isn't used outside of the gstlibcamera-utils.cpp compilation unit. Make it static. Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-09-09test: gstreamer: Fix the destructor of GstreamerTest base classVedant Paranjape
The destructor tried to check if pipeline_ is a parent of libcameraSrc_. This was needed to be checked as if it is, cleanup of libcameraSrc_ would be handled by pipeline itself. Since, the destructor can be called anytime, even when pipeline_ hasn't been created, the use of pipeline_ to check if libcameraSrc_ has an ancestor as pipeline_ caused a segmentation fault. Fixes: f58768092277 ("test: gstreamer: Fix the destructor of GstreamerTest base class") Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-09-08test: gstreamer: Factor out code into a base classVedant Paranjape
A lot of code used in the single stream test is boiler plate and common across every gstreamer test. Factor out this code into a base class called GstreamerTest. Also update the gstreamer_single_stream_test to use the GstreamerTest base class. Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
2021-08-26test: gstreamer: Disable gstreamer registry forksVedant Paranjape
ASan needs to be loaded first before gstreamer is loaded. This was not possible, so verify_asan_link_order was disabled. Better way to tackle this issue was disabling forks on the gstreamer side. verify_asan_link_order=0 disables the check on ASan side which checks if ASan was loaded before any other shared objects. Since, gstreamer spawns a child helper process while building the registry, we needed to disable this check. But with gst_registry_fork_set_enabled() it is possible to disable spawning this child helper process, so this ensures that ASan is loaded before any other shared object is loaded. Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-08-26test: gstreamer: Clean up memory managementVedant Paranjape
This patch simplifies memory management, i.e., by replacing bare pointers with g_autoptr or g_autofree according to use case. While at it also update time representation of timeout variable with GST_SECOND. Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-08-14test: gstreamer: Add test for gstreamer single streamVedant Paranjape
This patch adds a test to test if single stream using libcamera's gstreamer element works. We need to work around two distinct issues with ASan when enabled in the build: - glib has a known leak at initialization time. This is covered by the suppression file shipped with glib, but it's not clear how to use it automatically. For now, disable leak detection to avoid test failures. - GStreamer spawns a child process to scan plugins. If GStreamer is compiled without ASan (which is likely) but libcamera is, dlopen()ing the libcamera plugin will cause an ASan link order verification failure. Disable the verification child processes to work around the problem. This requires gcc 8 or newer. Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-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-08-05gstreamer: Update format specifier in Request Pad templateVedant Paranjape
Change format specifier %s to %u in name template field of request pad template. Pad names are as follows, src_0, src_1, etc. So, instead of using string format specifier, use unsigned integer format specifier. Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
2021-07-28gstreamer: Store group_id in GstLibcameraSrcStateVedant Paranjape
This patch adds group_id in GstLibcameraSrcState, since group_id is something which should be same for all the pads, it can be reused later. Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
2021-07-16libcamera: Add pixel format BGRX8888Vedant Paranjape
This patch adds pixel format BGRX8888 to libcamera. Additionally adds mapping of V4L2 pixel format (V4L2_PIX_FMT_XRGB32) to BGRX8888. Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-07-16libcamera: Fix the V4L2 pixel format for formats::XBGR8888Vedant Paranjape
This patch fixes V4L2 pixel format for formats::XBGR8888 by updating the existing matching to V4L2_PIX_FMT_RGBX32 Fixes: 4fd6bb33 ("libcamera: Add support for XRGB8888 and XBGR8888") Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-06-25gstreamer: Added virtual functions needed to support request padsVedant Paranjape
This patch adds support for using request pads in libcamerasrc Gst Element. It allows a user to request multiple streams if the platform supports multistream output using libcamera. This was tested on Raspberry Pi 4B+ with a camera connected to CSI port. It can be tested by running the following command gst-launch-1.0 libcamerasrc camera-name="<camera-name-here>" name=src src.src ! queue ! videoconvert ! autovideosink src.src_0 ! queue ! videoconvert ! autovideosink Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
2021-06-23libcamera: Add OV5647 sensor propertiesVedant Paranjape
Brief specifications available at https://cdn.sparkfun.com/datasheets/Dev/RaspberryPi/ov5647_full.pdf > pixel size: 1.4 μm x 1.4 μm Change in this patch is referenced from Page 5: key specifications section of the above linked pdf Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-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-04-05Add alternative meson install commandVedant Paranjape
While installing meson using pip3 install --user meson, due to python path issues, build.ninja can't be located by ninja. meson generates ninja files fine, but then when you run ninja, it is unable to find meson's build.ninja python module due to path issues. It gives the following error on ninja -C build install: ninja: Entering directory `build' ninja: error: loading 'build.ninja': No such file or directory After uninstalling meson using pip3 and installing it again using pip without --user argument solved the issue. Add a troubleshooting section to the readme to describe this issue and suggest possible solutions. Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>