From: Cornelia Huck <cohuck@redhat.com>
To: Alexandre Courbot <acourbot@chromium.org>
Cc: "Alexander Gordeev" <alexander.gordeev@opensynergy.com>,
virtio-dev@lists.oasis-open.org,
"Keiichi Watanabe" <keiichiw@chromium.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Marcin Wojtas" <mwojtas@google.com>,
"Matti Möll" <Matti.Moell@opensynergy.com>,
"Andrew Gazizov" <andrew.gazizov@opensynergy.com>,
"Enrico Granata" <egranata@google.com>,
"Gustavo Padovan" <gustavo.padovan@collabora.com>,
"Peter Griffin" <peter.griffin@linaro.org>,
"Bartłomiej Grzesik" <bag@semihalf.com>,
"Tomasz Figa" <tfiga@chromium.org>,
"Daniel Almeida" <daniel.almeida@collabora.com>
Subject: Re: [virtio-dev] Re: [RFC PATCH v6] virtio-video: Add virtio video device specification
Date: Tue, 07 Feb 2023 14:59:50 +0100 [thread overview]
Message-ID: <877cwttw2x.fsf@redhat.com> (raw)
In-Reply-To: <CAPBb6MWNfPH+e8=4zUcq2dV-59OdzTYSuN04Cg2rRPWao-nseQ@mail.gmail.com>
On Tue, Feb 07 2023, Alexandre Courbot <acourbot@chromium.org> wrote:
> On Mon, Feb 6, 2023 at 11:13 PM Cornelia Huck <cohuck@redhat.com> wrote:
>>
>> On Thu, Jan 19 2023, Alexander Gordeev <alexander.gordeev@opensynergy.com> wrote:
>>
>> > Hi Alexandre,
>> >
>> > On 12.01.23 07:39, Alexandre Courbot wrote:
>> >> On Thu, Jan 12, 2023 at 3:42 AM Alexander Gordeev
>> >> <alexander.gordeev@opensynergy.com> wrote:
>>
>> >>> Well, on the one hand mimicking v4l2 looks like an easy solution from
>> >>> virtio-video spec writing perspective. (But the implementers will have
>> >>> to read the V4L2 API instead AFAIU, which is probably longer...)
>> >> It should not necessarily be much longer as the parts we are
>> >> interested in have their own dedicated pages:
>> >>
>> >> https://docs.kernel.org/userspace-api/media/v4l/dev-decoder.html <https://docs.kernel.org/userspace-api/media/v4l/dev-decoder.html>https://docs.kernel.org/userspace-api/media/v4l/dev-encoder.html <https://docs.kernel.org/userspace-api/media/v4l/dev-encoder.html>
>> >>
>> >> Besides, the decoding and encoding processes are described with more
>> >> precision, not that we couldn't do that here but it would make the
>> >> spec grow longer than I am comfortable with...
>> >
>> > I read the references carefully, thanks. I am somewhat familiar with the
>> > stateful decoder API, but the stateless one still needs exploring.
>> >
>> > There is one serious issue with these references IMO: they represent
>> > guest user-space <-> v4l2 subsystem API, not v4l2 subsystem <->
>> > virtio-video driver API. Just to make sure we're on the same page:
>> >
>> > guest user-space <-> v4l2 kernel subsystem <-> virtio-video driver <-
>> > virtio-video protocol -> virtio-video device.
>> >
>> > I believe this is how it is supposed to work, right? So I thought, that
>> > your intention is to simplify virtio-video driver and virtio-video
>> > protocol by reusing the v4l2 subsystem <-> v4l2 driver API. But having
>> > these references I can assume, that you want to use user-space <-> v4l2
>> > subsystem API, right? Well, I think this cannot happen and therefore
>> > these references cannot be used directly unless:
>> >
>> > 1. You suggest that virtio-video driver should not use v4l2 subsystem,
>> > but should mimic its user-space API in every detail. Probably not a good
>> > idea.
>> >
>> > 2. There is already a way to bypass the subsystem completely. I'm not
>> > aware of that.
>> >
>> > 3. user-space <-> v4l2 subsystem API is already the same or very close
>> > to v4l2 subsystem <-> v4l2 driver API. I believe this is not the case
>> > even with stateful decoder/encoder. Even more with stateless decoders
>> > because I can see, that v4l2 subsystem actually stores some state in
>> > this case as well. Which is quite reasonable I think.
>> >
>> > So I think what we need to reference here is v4l2 subsystem <-> v4l2
>> > driver API. Do you have this reference? Well, I know there is some
>> > documentation, but still I doubt that. AFAIR kernel internal APIs are
>> > never fixed. Right?
>>
>> So, I'm not that familiar with v4l2, but if that's indeed the case,
>> depending on some kernel internal APIs is a no-go. First, because
>> in-kernel APIs are not stable, and second, because we want something
>> that's BSD-licenced (as opposed to GPLv2-licenced) to point to. The
>> kernel<->userspace API would work (BSD-licenced header and stable); I
>> had the impression that we wanted to reuse the various #defines in
>> there -- did I misunderstand?
>
> Sorry, I should have replied earlier to lift any misunderstanding. I
> am not suggesting to use any kernel internal API as reference. My
> suggestion is to stick strictly to the UAPI which is stable (as in,
> guaranteed to be backward-compatible) and well documented. Here is for
> instance the part documenting buffer queuing/dequeuing:
> https://www.kernel.org/doc/html/v4.9/media/uapi/v4l/vidioc-qbuf.html
>
> Changing anything in this documentation in a backward-incompatible way
> would break user-space, and everyone familiar with the kernel
> community knows what happens when someone breaks user-space. ;) So
> this can be a reliable source for virtio-video (and if you look
> closely, you will also notice many similarities between the two).
Yes, that sounds good to me :)
>
>>
>> (...)
>>
>> >> Let me try to summarize the case for using V4L2 over Virtio (I'll call
>> >> it virtio-v4l2 to differentiate it from the current spec).
>> >>
>> >> There is the argument that virtio-video turns out to be a recreation
>> >> of the stateful V4L2 decoder API, which itself works similarly to
>> >> other high-level decoder APIs. So it's not like we could or should
>> >> come with something very different. In parallel, virtio-camera is also
>> >> currently using V4L2 as its model. While this is subject to change, I
>> >> am starting to see a pattern here. :)
>> >>
>> >> Transporting V4L2 over virtio would considerably shorten the length of
>> >> this spec, as we would just need to care about the transport aspect
>> >> and minor amendments to the meaning of some V4L2 structure members,
>> >> and leave the rest to V4L2 which is properly documented and for which
>> >> there is a large collection of working examples.
>> >>
>> >> This would work very well for codec devices, but as a side-effect
>> >> would also enable other kinds of devices that may be useful to
>> >> virtualize, like image processors, DVB cards, and cameras. This
>> >> doesn't mean virtio-v4l2 should be the *only* way to support cameras
>> >> over virtio. It is a nice bonus of encapsulating V4L2, it may be
>> >> sufficient for simple (most?) use-cases, but also doesn't forbid more
>> >> specialized virtual devices for complex camera pipelines to be added
>> >> later. virtio-v4l2 would just be the generic virtual video device that
>> >> happens to be sufficient for our accelerated video needs - and if your
>> >> host camera is a USB UVC one, well feel free to use that too.
>> >>
>> >> In other words, I see an opportunity to enable a whole class of
>> >> devices instead of a single type for the same effort and think we
>> >> should seriously consider this.
>> >>
>> >> I have started to put down what a virtio-v4l2 transport might look
>> >> like, and am also planning on putting together a small
>> >> proof-of-concept. If I can get folks here to warm up to the idea, I
>> >> believe we should be able to share a spec and prototype in a month or
>> >> so.
>> >
>> > Thanks for the detailed explanation. Please check my comments above. I'd
>> > like to resolve the mentioned issue first.
>>
>> I hope we can sort this out soon -- I guess I'm not the only one who is
>> anxious about this spec moving forward :) Please let me know if I can
>> help in any way.
>
> I'll try to address Alexander's points in more detail, but I am not
> seeing any blocking issue with using the V4L2 UAPI as the basis for
> virtio-video (we are working on a small proof-of-concept and things
> are going smoothly so far).
Great to hear, looking forward to it!
---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org
next prev parent reply other threads:[~2023-02-07 13:59 UTC|newest]
Thread overview: 97+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-08 7:23 [virtio-dev] [RFC PATCH v6] virtio-video: Add virtio video device specification Alexandre Courbot
2022-12-08 15:00 ` Cornelia Huck
2022-12-27 5:38 ` Alexandre Courbot
2023-01-11 8:45 ` Cornelia Huck
2023-01-12 6:32 ` Alexandre Courbot
2023-01-12 15:23 ` Cornelia Huck
2022-12-19 16:59 ` [virtio-dev] " Alexander Gordeev
2022-12-20 9:51 ` Cornelia Huck
2022-12-20 10:35 ` Alexander Gordeev
2022-12-20 17:39 ` Cornelia Huck
2022-12-21 14:56 ` Alexander Gordeev
2022-12-27 7:31 ` Alexandre Courbot
2023-01-11 18:42 ` Alexander Gordeev
2023-01-11 20:13 ` Alex Bennée
2023-01-12 6:40 ` Alexandre Courbot
2023-01-12 6:39 ` Alexandre Courbot
2023-01-18 23:06 ` Alexander Gordeev
2023-02-06 14:12 ` Cornelia Huck
2023-02-07 6:16 ` Alexandre Courbot
2023-02-07 13:59 ` Cornelia Huck [this message]
2023-03-10 10:50 ` Cornelia Huck
2023-03-10 13:19 ` Alexandre Courbot
2023-03-10 14:20 ` Cornelia Huck
2023-03-14 5:06 ` Alexandre Courbot
2023-03-16 10:12 ` Alexander Gordeev
2023-03-17 7:24 ` Alexandre Courbot
2023-04-17 12:51 ` Alexander Gordeev
2023-04-17 14:43 ` Cornelia Huck
2023-04-19 7:39 ` Alexander Gordeev
2023-04-19 21:34 ` Enrico Granata
2023-04-21 14:48 ` Alexander Gordeev
2023-04-21 4:02 ` Alexandre Courbot
2023-04-21 16:01 ` Alexander Gordeev
2023-04-24 7:52 ` Alexander Gordeev
2023-04-25 16:04 ` Cornelia Huck
2023-04-26 6:29 ` Alexandre Courbot
2023-04-27 14:10 ` Alexander Gordeev
2023-04-28 4:02 ` Alexandre Courbot
2023-04-28 8:54 ` Alexander Gordeev
2023-05-02 1:07 ` Alexandre Courbot
2023-05-02 11:12 ` Alexander Gordeev
2023-04-26 5:52 ` Alexandre Courbot
2023-04-27 14:20 ` Alexander Gordeev
2023-04-28 3:22 ` Alexandre Courbot
2023-04-28 8:22 ` Alexander Gordeev
2023-04-26 15:52 ` Alexander Gordeev
2023-04-27 13:23 ` Alexandre Courbot
2023-04-27 15:12 ` Alexander Gordeev
2023-04-28 3:24 ` Alexandre Courbot
2023-04-28 8:31 ` Alexander Gordeev
[not found] ` <CALgKJBqKWng508cB_F_uD2fy9EAvQ36rYR3fRb57sFd3ihpUFw@mail.gmail.com>
2023-04-26 16:00 ` Alexander Gordeev
2023-04-27 10:13 ` Bartłomiej Grzesik
2023-04-27 14:34 ` Alexander Gordeev
2023-04-28 3:22 ` Alexandre Courbot
2023-04-28 7:57 ` Alexander Gordeev
2023-04-21 4:02 ` Alexandre Courbot
2023-04-26 15:11 ` Alexander Gordeev
2023-04-27 13:16 ` Alexandre Courbot
2023-04-28 7:47 ` Alexander Gordeev
2023-05-03 14:04 ` Cornelia Huck
2023-05-03 15:11 ` Alex Bennée
2023-05-03 15:53 ` Cornelia Huck
2023-05-05 9:57 ` Alexander Gordeev
[not found] ` <168329085253.1880445.14002473591422425775@Monstersaurus>
2023-05-05 15:55 ` Alex Bennée
[not found] ` <20230506081229.GA8114@pendragon.ideasonboard.com>
2023-05-06 8:16 ` [libcamera-devel] " Laurent Pinchart
2023-05-08 8:00 ` [virtio-dev] " Alexandre Courbot
2023-05-08 8:00 ` Alexandre Courbot
2023-08-09 7:34 ` Hans Verkuil
2023-05-16 13:50 ` [virtio-dev] " Alexander Gordeev
2023-05-16 13:50 ` Alexander Gordeev
2023-05-17 3:58 ` [virtio-dev] " Tomasz Figa
2023-05-16 12:57 ` Alexander Gordeev
2023-05-05 12:28 ` Alexander Gordeev
2023-05-05 11:54 ` Alexander Gordeev
2023-05-08 4:55 ` Alexandre Courbot
2023-05-11 8:50 ` Alexander Gordeev
2023-05-11 9:00 ` Alexander Gordeev
2023-05-12 4:15 ` Alexandre Courbot
2023-05-17 7:35 ` Alexander Gordeev
2023-05-12 4:09 ` Alexandre Courbot
2023-05-16 14:53 ` Alexander Gordeev
2023-05-17 16:28 ` Cornelia Huck
2023-05-18 6:29 ` Alexander Gordeev
2023-05-18 19:35 ` Michael S. Tsirkin
2023-05-17 11:04 ` Alexander Gordeev
2023-03-27 13:00 ` Albert Esteve
2023-04-15 5:58 ` Alexandre Courbot
2023-04-17 12:56 ` Cornelia Huck
2023-04-17 13:13 ` Alexander Gordeev
2023-04-17 13:22 ` Cornelia Huck
2023-02-07 11:11 ` Alexander Gordeev
2023-02-07 6:51 ` Alexandre Courbot
2023-02-07 10:57 ` Alexander Gordeev
2023-01-11 17:04 ` Alexander Gordeev
2023-01-12 6:32 ` Alexandre Courbot
2023-01-12 22:24 ` Alexander Gordeev
2023-01-11 18:45 ` Alexander Gordeev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877cwttw2x.fsf@redhat.com \
--to=cohuck@redhat.com \
--cc=Matti.Moell@opensynergy.com \
--cc=acourbot@chromium.org \
--cc=alex.bennee@linaro.org \
--cc=alexander.gordeev@opensynergy.com \
--cc=andrew.gazizov@opensynergy.com \
--cc=bag@semihalf.com \
--cc=daniel.almeida@collabora.com \
--cc=egranata@google.com \
--cc=gustavo.padovan@collabora.com \
--cc=keiichiw@chromium.org \
--cc=mwojtas@google.com \
--cc=peter.griffin@linaro.org \
--cc=tfiga@chromium.org \
--cc=virtio-dev@lists.oasis-open.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.