Commit graph

8 commits

Author SHA1 Message Date
Niklas Söderlund
ae9a05847c libcamera: buffer: Switch from Plane to FrameBuffer::Plane
It is not libcamera's responsibility to handle memory mappings. Switch
from the soon to be removed Plane class which deals with memory
mappings to FrameBuffer::Plane which just describes it. This makes the
transition to the full FrameBuffer easier.

As the full FrameBuffer interface has not yet spread to all parts of
libcamera core it is hard to create efficient caching of memory mappings
in the qcam application. This will be fixed in a later patch, for now
the dmabuf is mapped and unmapped each time it is seen by the
application.

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>
2020-01-12 16:10:37 +01:00
Laurent Pinchart
fac471e812 test: Extract CameraTest class out of camera tests to libtest
Many tests other than the camera/ tests use a camera. To increase code
sharing, move the base CameraTest class to the test library. The class
becomes a helper that doesn't inherit from Test anymore (to avoid
diamond inheritance issues when more such helpers will exist).

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-11-20 21:47:20 +02:00
Jacopo Mondi
448716d8f7 libcamera: Switch PixelFormat to DRM FourCC values
Use DRM FourCC values for the newly defined PixelFormat.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-10-28 17:04:20 +02:00
Jacopo Mondi
0f2e8cac8d test: buffer_import: Initialize video_ to nullptr
When the vivid module used to test buffer importing is not loaded, the
test correctly bails out, but during the clean up procedure tries to
access the video_ field, which, if not correctly initialized to
nullptr contains random values and accessing it causes a segfault.

Fix this by initializing video_ field to nullptr to make sure it is
properly handled in cleanup().

Fixes: e1a5873701 ("test: camera: Add buffer import and mapping test")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-09-16 22:21:27 +02:00
Laurent Pinchart
5ce4bb62e7 test: camera: Use the CameraManager from the CameraTest base class
Make the camera manager a protected field of the CameraTest class, and
use it instead of CameraManager::instance() in the camera tests. This
prepares for the removal of CameraManager::instance().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-08-19 19:06:50 +03:00
Niklas Söderlund
4debc71ffa libcamera: pipeline: vimc: Switch to using the RGB/YUV Capture video node
Linux commit 85ab1aa1fac17bcd ("media: vimc: deb: fix default sink bayer
format") which is part of v5.2 changes the default media bus format for
the debayer subdevices. This leads to a -EPIPE error when trying to use
the raw capture video device nodes.

Fix this by moving the vimc pipeline to use the RGB/YUV Capture capture
video node. As a consequence of this change the scaler in the vimc
pipeline is used and a hard coded upscale of 3 is present in the video
pipeline. This limits the sizes exposed and accepted by libcamera to
multiples of 3.

Update the buffer import test case to match this  new format constraint
by setting the resolution to 1920x1080, a resolution which works with
both vimc and vivid. With this new resolution the buffer import test
takes a bit more time to complete 60 buffers and it's runtime also needs
to be increased.

The raw capture video node still needs to be handled by the pipeline as
its format needs to be updated to allow the pipeline format validation
to pass.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-08-11 02:16:21 +02:00
Kieran Bingham
1a6b80e4a0 test: camera: buffer_import: clear video pointer
The FrameSink::cleanup() call checks if video_ is set before cleaning up
and then deleting the object.

If the cleanup() call is called twice for any reason, this will
encounter a use-after-free as the video_ pointer is not cleared after
deletion.

Whilst cleanup() is not currently called twice consecutively, to prevent
errors in the future, make it explicit that the object has been deleted
by clearing the stale pointer.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-08-01 10:53:04 +01:00
Jacopo Mondi
e1a5873701 test: camera: Add buffer import and mapping test
Test buffer importing and mapping by streaming the VIMC camera to VIVID
video output device performing zero-copy memory sharing using dmabuf
file descriptors.

The test cycle 20 buffers between the camera and the output with a 1:1
buffer index to dmabuf fd mapping, then randomises the mapping with the
same number of buffers on each side for 20 more frames, to finally
increase the number of buffers on the output side for the 20 last
frames. No remapping of dmabuf fd to buffer index should occur for the
first 40 frames.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-07-14 16:01:11 +03:00