@@ -195,7 +195,7 @@ static int capture_enum_fmt_vid_cap(struct file *file, void *fh,
if (ret)
return ret;
} else {
- cc_src = imx_media_find_mbus_format(fmt_src.format.code,
+ cc_src = imx_media_find_mbus_format(f->mbus_code,
PIXFMT_SEL_ANY);
if (WARN_ON(!cc_src))
return -EINVAL;
@@ -740,7 +740,7 @@ static struct video_device capture_videodev = {
.release = video_device_release,
.vfl_dir = VFL_DIR_RX,
.tvnorms = V4L2_STD_NTSC | V4L2_STD_PAL | V4L2_STD_SECAM,
- .device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING,
+ .device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING | V4L2_CAP_IO_MC,
};
Secondly, if one wants to test these patches with the gstreamer libcamerasrc, it
is also required to change the minimum buffers needed in the driver. The
libcamerasrc seems to have an issue that it only queues 1 buffer, thus
not starting the driver to stream. Applying this hunk to the kernel
works around this issue, although frame drops are probably to be expected:
@@ -1042,7 +1042,7 @@ int imx_media_capture_device_register(struct imx_media_video_dev *vdev)
vq->mem_ops = &vb2_dma_contig_memops;
vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
vq->lock = &priv->mutex;
- vq->min_buffers_needed = 2;
+ vq->min_buffers_needed = 1;
vq->dev = priv->dev;
ret = vb2_queue_init(vq);
Finally, add imx-media to the supported Devices in libcamera:
@@ -51,6 +51,7 @@ static const SimplePipelineInfo supportedDevices[] = {
{ "imx7-csi", "pxp" },
{ "qcom-camss", nullptr },
{ "sun6i-csi", nullptr },
+ { "imx-media", nullptr },
};
} /* namespace */
These patches aim to improve the algorithm how SimplePipleine achieves the setup of the Media-Pipeline. Prior to these patches, the SimplePipeline starts at the sensor-device, then always chooses the first Source-Pad it finds. This is obviously just a mere guess how to find the capture device and may fail on some machines. With these patches, SimplePipeline will instead choose the shortest path from the sensor to a capture device. This makes sense as the shortest path is probably a direct path to a capture device, ignoring any IPU-components like encoders or translators. These patches were tested only on the imx-media driver, which is not yet supported by SimplePipeline. The imx-media driver needs some changes in order to work with libcamera. If testing with the imx-media driver is desired, one have to change the driver being media-centric first. For testing purposes, this can be done quick and dirty by applying the following hunk to the kernel: Regards, Marian Cichy Marian Cichy (2): media_entity: overload == operator to use media-entities in maps pipeline: simple: use uniform-cost search algorithm to setup media pipeline include/libcamera/internal/media_object.h | 2 + src/libcamera/pipeline/simple/simple.cpp | 118 +++++++++++----------- 2 files changed, 60 insertions(+), 60 deletions(-)