On 3/4/21 1:58 AM, Hans Verkuil wrote:
I am not sure which you're suggesting to use: vivid or vimc. Also, are you
suggesting to extend them or use them as a template for a new module?
I don't think either vimc nor vivid are particularly suitable for this, although
vivid comes close. You can certainly lift ideas from vivid.
Thanks for the advice. I'll definitely look at it more closely.
I am assuming you are saying to port v4l2loopback to vb2. I am working on that
right now, but I am not sure how to proceed since the vb2 needs a queue for
capture and a queue for output (since they cannot be the same). I have created
the queues, but I am not sure how to further integrate. Please check out the
WIP here:
https://github.com/wt/v4l2loopback/commit/e71b0a50427729a5e6e74443066751f7321dc404
If the m2m is the wrong approach, do you have any suggestions for how to
proceed?
You need two video devices, one capture, one output. I see that the current
loopback driver has just one video device and advertises it as a M2M device,
but that's not what it should do. Creating two video devices (similar to what
vivid does) is the best and most compatible approach.
FWIW, there is ongoing work to split the devices in v4l2loopback right now.
Also, I am currently making a change for the linux kernel moving this code
info drivers/media/v4l2-core/v4l2-loopback.c so that I can start iterating
with your feedback. Is that a correct place to put this code?
No, v4l2-core is for core V4L2 frameworks, not for drivers.
For now stick it in drivers/media/test-drivers. It will likely be moved again at
some point (if we keep the 'misc' device that the current driver creates, then
it might end up in drivers/media/misc).
By far the most important thing you need to do is convert it to vb2. Since the
intention is to upstream the driver I would start by doing a cleanup of the code,
ditching all compat code with older kernels, making sure it adheres to the
linux coding style (use 'scripts/checkpatch.pl --strict' for that), then split
it in two video devices and use vb2.
I actually wonder if it shouldn't be renamed to viloopback since it will be
different from v4l2loopback. Anyway, that's something that can be done later.
Thanks for the advice. I'm happy to rename it to viloopback now if that makes sense.
That is very little work.
I am moving the code to test-drivers for now. Thanks for that feedback.
wt