summaryrefslogtreecommitdiff
path: root/test/libtest/buffer_source.cpp
AgeCommit message (Collapse)Author
2020-12-09libcamera: v4l2_device: Return a unique pointer from fromEntityName()Laurent Pinchart
The fromEntityName() function returns a pointer to a newly allocated V4L2Device instance, which must be deleted by the caller. This opens the door to memory leaks. Return a unique pointer instead, which conveys the API semantics better than a sentence in the documentation. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-05-16libcamera: Move internal headers to include/libcamera/internal/Laurent Pinchart
The libcamera internal headers are located in src/libcamera/include/. The directory is added to the compiler headers search path with a meson include_directories() directive, and internal headers are included with (e.g. for the internal semaphore.h header) #include "semaphore.h" All was well, until libcxx decided to implement the C++20 synchronization library. The __threading_support header gained a #include <semaphore.h> to include the pthread's semaphore support. As include_directories() adds src/libcamera/include/ to the compiler search path with -I, the internal semaphore.h is included instead of the pthread version. Needless to say, the compiler isn't happy. Three options have been considered to fix this issue: - Use -iquote instead of -I. The -iquote option instructs gcc to only consider the header search path for headers included with the "" version. Meson unfortunately doesn't support this option. - Rename the internal semaphore.h header. This was deemed to be the beginning of a long whack-a-mole game, where namespace clashes with system libraries would appear over time (possibly dependent on particular system configurations) and would need to be constantly fixed. - Move the internal headers to another directory to create a unique namespace through path components. This causes lots of churn in all the existing source files through the all project. The first option would be best, but isn't available to us due to missing support in meson. Even if -iquote support was added, we would need to fix the problem before a new version of meson containing the required support would be released. The third option is thus the only practical solution available. Bite the bullet, and do it, moving headers to include/libcamera/internal/. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Jacopo Mondi <jacopo@jmondi.org>
2020-04-30libcamera: v4l2_pixelformat: Move DRM/V4L2 format conversionLaurent Pinchart
Move the DRM/V4L2 format conversion code from V4L2VideoDevice to V4L2PixelFormat. This is a more natural home for the code. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-19libcamera: v4l2_videodevice: Rename toV4L2Fourcc to toV4L2PixelFormatLaurent Pinchart
Now that the functions return a V4L2PixelFormat, adapt their name accordingly. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-03-18libcamera: v4l2_videodevice: Rename exportBuffers() to allocateBuffers()Laurent Pinchart
To prepare for the rework of buffer allocation that will differentiate export and allocation, rename exportBuffers() to allocateBuffers(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-03-18test: libtest: buffer_source: Close video device right after allocationLaurent Pinchart
There's no need to keep the video device open after allocating buffers, as V4L2 supports buffer orphaning and the exported buffers will still be usable. Close the device right after allocation to avoid the need for delayed cleanups. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-03-06test: Extract BufferSource class out of camera tests to libtestNiklas Söderlund
The BufferSource class can be used by other tests other then the camera buffer importer test, move it to libtest. The only changes to BufferSource is for it to be allowed to be split in a header and source file. This change makes it necessary for libtest to have access to internal libcamera headers. As the internal headers already are accessible to all test cases this does not increase the exposure of libcamera internals to the test cases. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>