public inbox for virtio-dev@lists.linux.dev
 help / color / mirror / Atom feed
From: Alexander Gordeev <alexander.gordeev@opensynergy.com>
To: Alexandre Courbot <acourbot@chromium.org>
Cc: "Cornelia Huck" <cohuck@redhat.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>,
	"Enric Balletbo i Serra" <eballetb@redhat.com>,
	"Albert Esteve" <aesteve@redhat.com>
Subject: Re: [virtio-dev] Re: [RFC PATCH v6] virtio-video: Add virtio video device specification
Date: Wed, 17 May 2023 09:35:28 +0200	[thread overview]
Message-ID: <eec3fb30-0208-d26d-5715-5700979cfdb1@opensynergy.com> (raw)
In-Reply-To: <CAPBb6MXw5PebCXYBvXOP_b2j+t-1Y_rSJv7kWkLPsa3X+uM9gA@mail.gmail.com>

On 12.05.23 06:15, Alexandre Courbot wrote:
> On Thu, May 11, 2023 at 6:00 PM Alexander Gordeev
> <alexander.gordeev@opensynergy.com> wrote:
>>
>> On 11.05.23 10:50, Alexander Gordeev wrote:
>>> On 08.05.23 06:55, Alexandre Courbot wrote:
>>>> On Fri, May 5, 2023 at 8:55 PM Alexander Gordeev
>>>> <alexander.gordeev@opensynergy.com> wrote:
>>>>>
>>>>> On 03.05.23 16:04, Cornelia Huck wrote:
>>>>>> On Fri, Apr 28 2023, Alexander Gordeev
>>>>>> <alexander.gordeev@opensynergy.com> wrote:
>>>>>>
>>>>>>> On 27.04.23 15:16, Alexandre Courbot wrote:
>>>>>>>> But in any case, that's irrelevant to the guest-host interface, and I
>>>>>>>> think a big part of the disagreement stems from the misconception
>>>>>>>> that
>>>>>>>> V4L2 absolutely needs to be used on either the guest or the host,
>>>>>>>> which is absolutely not the case.
>>>>>>>
>>>>>>> I understand this, of course. I'm arguing, that it is harder to
>>>>>>> implement it, get it straight and then maintain it over years. Also it
>>>>>>> brings limitations, that sometimes can be workarounded in the virtio
>>>>>>> spec, but this always comes at a cost of decreased readability and
>>>>>>> increased complexity. Overall it looks clearly as a downgrade compared
>>>>>>> to virtio-video for our use-case. And I believe it would be the
>>>>>>> same for
>>>>>>> every developer, that has to actually implement the spec, not just do
>>>>>>> the pass through. So if we think of V4L2 UAPI pass through as a
>>>>>>> compatibility device (which I believe it is), then it is fine to have
>>>>>>> both and keep improving the virtio-video, including taking the best
>>>>>>> ideas from the V4L2 and overall using it as a reference to make
>>>>>>> writing
>>>>>>> the driver simpler.
>>>>>>
>>>>>> Let me jump in here and ask another question:
>>>>>>
>>>>>> Imagine that, some years in the future, somebody wants to add a virtio
>>>>>> device for handling video encoding/decoding to their hypervisor.
>>>>>>
>>>>>> Option 1: There are different devices to chose from. How is the person
>>>>>> implementing this supposed to pick a device? They might have a narrow
>>>>>> use case, where it is clear which of the devices is the one that
>>>>>> needs to
>>>>>> be supported; but they also might have multiple, diverse use cases, and
>>>>>> end up needing to implement all of the devices.
>>>>>
>>>>> I think in this case virtio-v4l2 should be used as a compatibility
>>>>> device exclusively. This means discouraging increasing its complexity
>>>>> even more with more patches in the spec. virtio-video should eventually
>>>>> cover all the use-cases of V4L2, so I think it is reasonable to use it
>>>>> in both complex use-cases and in simple use-cases, where there is no
>>>>> decoder/encoder V4L2 device on the host.
>>>>>
>>>>>> Option 2: There is one device with various optional features. The
>>>>>> person
>>>>>> implementing this can start off with a certain subset of features
>>>>>> depending on their expected use cases, and add to it later, if needed;
>>>>>> but the upfront complexity might be too high for specialized use cases.
>>>>
>>>> I don't see that many negociable features we can provide for a
>>>> decoder/encoder device - at least not many that are not considered
>>>> basic (like guest buffers). In terms of provided features for codecs
>>>> virtio-video and virtio-v4l2 are essentially equivalent.
>>>
>>> Actually I see a lot of potential in using the virtio feature flag
>>> negotiation for virtio-video:
>>>
>>> 1. We already have some feature flags related to memory management.
>>>
>>> 2. I think it would be great to take V4L2 controls negotiation and turn
>>> it into the feature flags negotiation. I really like this idea and I'd
>>> like to implement it. Not all the controls at once, of course. Still it
>>> would be very easy to port more given the existing process. They
>>> correspond well enough to each other, I think. This way we don't need to
>>> introduce something like the VIDIOC_QUERYCTRL/VIDIOC_QUERY_EXT_CTRL, we
>>> don't need two mechanisms for feature negotiations (like it would be
>>> with virtio-v4l2, right?), also all the features would be in one place.
>>> Then we can directly reference some enums from V4L2, like
>>> v4l2_mpeg_video_h264_profile or v4l2_mpeg_video_h264_level. That's what
>>> I call taking the best from V4L2.
>>>
>>> 3. We can have things, that V4L2 doesn't support in their stateful UAPI.
>>> For example, dequeuing output buffers in decoder order.
>>
>> I'd like to also share my current roadmap for the draft v7 of
>> virtio-video (or maybe the draft v8 in some cases). The significant
>> changes would be:
>>
>> 1. Making querying the capabilities fully compatible with V4L2 but in 1
>> round-trip over virtio, not 10+. This is what I'm actively working on
>> right now.
>
> That sounds good, while not essential since the capability negotiation
> occurs before we start streaming so these extra trips should not be
> perceptible by the user. But the current capability command was not
> suitable and needs to be improved anyway.

Great!
Well, there are a lot of steps in capability negotiations in V4L2:
1. enumeration of coded formats,
2. setting the coded format on OUTPUT/CAPTURE,
3. enumeration of raw formats,
4. enumeration of resolutions.
5. enumeration of intervals (optional),
6. enumeration of controls and their ranges (if the range is a menu, it
needs its own enumeration).

Each enumeration is 1 API call per element + 1 more in the end. So it
may require up to like 200 round trips overall if there are many
controls I guess. I believe only the first step can be done before any
streams are created. Well, maybe one can create a fake stream and do all
the enumerations during the startup.
Right now it doesn't look like a big problem. If somebody tries to run
the video processing over a local network, they may notice the startup
delay already. Please correct me if I'm wrong.

>> 2. Making all the commands non-blocking by providing completion events
>> over the event queue.
>
> +1 on that too, as the experience with virtio-v4l2 suggests this
> eliminates some headaches down the line.

Super!

>> 3. Adding back the controls from v5 and adding the corresponding feature
>> flags as I wrote in the quote above.
>
> Beware of not repeating the same mistake as v5 (all controls under one
> big structure). If you mean extending the parameters mechanisms with
> the things that are missing from v5, then yes that should be done
> anyway.

Thanks, noted.

--
Alexander Gordeev
Senior Software Engineer

OpenSynergy GmbH
Rotherstr. 20, 10245 Berlin

Phone: +49 30 60 98 54 0 - 88
Fax: +49 (30) 60 98 54 0 - 99
EMail: alexander.gordeev@opensynergy.com

www.opensynergy.com

Handelsregister/Commercial Registry: Amtsgericht Charlottenburg, HRB 108616B
Geschäftsführer/Managing Director: Régis Adjamah

Please mind our privacy notice<https://www.opensynergy.com/datenschutzerklaerung/privacy-notice-for-business-partners-pursuant-to-article-13-of-the-general-data-protection-regulation-gdpr/> pursuant to Art. 13 GDPR. // Unsere Hinweise zum Datenschutz gem. Art. 13 DSGVO finden Sie hier.<https://www.opensynergy.com/de/datenschutzerklaerung/datenschutzhinweise-fuer-geschaeftspartner-gem-art-13-dsgvo/>

---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org


  reply	other threads:[~2023-05-17  7:35 UTC|newest]

Thread overview: 93+ 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
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
2023-05-16 12:57                                                   ` Alexander Gordeev
     [not found]                                                   ` <20230506081229.GA8114@pendragon.ideasonboard.com>
     [not found]                                                     ` <20230506081633.GB8114@pendragon.ideasonboard.com>
2023-05-08  8:00                                                       ` [virtio-dev] Re: [libcamera-devel] " Alexandre Courbot
2023-05-16 13:50                                                       ` Alexander Gordeev
2023-05-17  3:58                                                     ` Tomasz Figa
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 [this message]
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=eec3fb30-0208-d26d-5715-5700979cfdb1@opensynergy.com \
    --to=alexander.gordeev@opensynergy.com \
    --cc=Matti.Moell@opensynergy.com \
    --cc=acourbot@chromium.org \
    --cc=aesteve@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=andrew.gazizov@opensynergy.com \
    --cc=bag@semihalf.com \
    --cc=cohuck@redhat.com \
    --cc=daniel.almeida@collabora.com \
    --cc=eballetb@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox