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: Fri, 28 Apr 2023 10:22:08 +0200 [thread overview]
Message-ID: <2ce708c1-574f-6021-4f94-eaf88be3161c@opensynergy.com> (raw)
In-Reply-To: <CAPBb6MVg3rcWK2XVXEPAijD7ETPDqDnx=LiKrK6aRq0x5bYVTQ@mail.gmail.com>
On 28.04.23 05:22, Alexandre Courbot wrote:
> On Thu, Apr 27, 2023 at 11:20 PM Alexander Gordeev
> <alexander.gordeev@opensynergy.com> wrote:
>>
>> On 26.04.23 07:52, Alexandre Courbot wrote:
>>> On Mon, Apr 24, 2023 at 4:52 PM Alexander Gordeev
>>> <alexander.gordeev@opensynergy.com> wrote:
>>>>
>>>> On 21.04.23 18:01, Alexander Gordeev wrote:
>>>>
>>>>> Let's compare VIRTIO_VIDEO_CMD_RESOURCE_QUEUE with
>>>>> VIDIOC_QBUF+VIDIOC_DQBUF. Including the parameters, of course. First,
>>>>> let's compare the word count to get a very rough estimate of complexity.
>>>>> I counted 585 words for VIRTIO_VIDEO_CMD_RESOURCE_QUEUE, including the
>>>>> parameters. VIDIOC_QBUF+VIDIOC_DQBUF are defined together and take 1206
>>>>> words, they both use struct v4l2_buffer as a parameter. The struct takes
>>>>> 2716 words to be described. So the whole thing takes 3922 words. This is
>>>>> 6.7 times more, than VIRTIO_VIDEO_CMD_RESOURCE_QUEUE. If we check the
>>>>> definitions of the structs, it is also very obvious, that V4L2 UAPI is
>>>>> almost like an order of magnitude more complex.
>>>>
>>>>
>>>> I think, it is best to add all the steps necessary to reproduce my calculations just in case.
>>>>
>>>> VIRTIO_VIDEO_CMD_RESOURCE_QUEUE is doing essentially the same thing as VIDIOC_QBUF+VIDIOC_DQBUF, so we're comparing apples to apples (if we don't forget to compare their parameters too).
>>>>
>>>> To get the word count for the VIRTIO_VIDEO_CMD_RESOURCE_QUEUE I opened the rendered PDF of video section only from the first email in this thread. Here is the link: https://drive.google.com/file/d/1Sm6LSqvKqQiwYmDE9BXZ0po3XTKnKYlD/view?usp=sharing . Then I scrolled to page 11 and copied everything related a text file. This is around two pages in the PDF. Then I removed page numbers from the copied text and used 'wc -w' to count words.
>>>>
>>>> To get the word count for VIDIOC_QBUF+VIDIOC_DQBUF I opened this link: https://docs.kernel.org/userspace-api/media/v4l/vidioc-qbuf.html . Then I selected all the text except table of contents and did followed the same procedure.
>>>>
>>>> To get the word count for struct v4l2_buffer and other types, that are referenced from it, I opened this link: https://docs.kernel.org/userspace-api/media/v4l/buffer.html#struct-v4l2-buffer . Then I selected all the text except the table of contents and the text above struct v4l2_buffer definition. The rest is the same.
>>>>
>>>> Also it's quite obvious if you look at them how much bigger struct v4l2_buffer (including the referenced types) is compared to struct virtio_video_resource_queue.
>>>
>>> You are comparing not the complexity of the structures but the
>>> verbosity of their documentation, which are written in a different
>>> style, format, and by different people.
>>
>> I agree to some extent. At least this benchmark is simple and it
>> provokes to actually go and look at the definitions, which IMO should be
>> enough to already see the difference. What could be a better benchmark?
>> Maybe counting the number of various fields and flags and enum cases,
>> that one has to read through?
>
> I give you another point of comparison literally 5 lines down my email.
>
>>
>>> And the V4L2 page also
>>> contains the description of memory types, which is part of another
>>> section in the virtio-video spec.
>>
>> You mean only enum v4l2_memory? Or anything else too?
>>
>>> There is no way to draw a meaningful
>>> conclusion from this.
>>>
>>> If you want to compare, do it with how the structures are actually
>>> used. Here is how you would queue an input buffer with virtio-video:
>>>
>>> struct virtio_video_resource_queue queue_buf = {
>>> .cmd_type = VIRTIO_VIDEO_CMD_RESOURCE_QUEUE,
>>> .stream_id = 42,
>>> .queue_type = VIRTIO_VIDEO_QUEUE_TYPE_INPUT,
>>> .resource_id = 1,
>>> .timestamp = 0x10,
>>> .data_sizes = {
>>> [0] = 0x1000,
>>> },
>>> };
>>>
>>> Now the same with virtio-v4l2:
>>>
>>> struct virtio_v4l2_queue_buf queue_buf = {
>>> .cmd = VIRTIO_V4L2_CMD_IOCTL,
>>> .code = VIDIOC_QBUF,
>>> .session_id = 42,
>>> .buffer.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
>>> .buffer.index = 1,
>>> .buffer.timestamp.tv_usec = 0x10,
>>> .buffer.memory = V4L2_MEMORY_MMAP,
>>> .planes = {
>>> [0] = { .bytesused = 0x1000 },
>>> }
>>> };
>>>
>>> In both cases, you pass a structure with some members set, and the
>>> rest to 0. The host receives basically the same thing - it's the same
>>> data! The only difference is how it is laid out.
>>
>> How do I know this from the text? How do I verify, that this is correct?
>> Can I be sure this code is going to work or not between any device and
>> any driver?
>>
>> With virtio-video you can just go to the spec/header file, take the
>> struct definition and simply set all the fields.
>>
>> With V4L2 UAPI I don't see any other way except going through the whole
>> buffer.html file, filtering potentially irrelevant stuff, then doing
>> some trials, and maybe looking into the device or driver code. Maybe
>> also asking you for an advice?
>
> The relevant fields for each decoding operation are clearly detailed
> in https://www.kernel.org/doc/html/v5.18/userspace-api/media/v4l/dev-decoder.html,
> which I already linked to multiple times.
That's true for most of them. I'd prefer a single document without all
the irrelevant stuff at all. So this one is not quite readable and it
never asks to zero the not required fields. Still this is bearable.
But this is not true for struct v4l2_buffer. I couldn't find anything in
the document, that you're linking. I went there and rechecked it again,
still no. Where is it exactly?
--
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
next prev parent reply other threads:[~2023-04-28 8:22 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 [this message]
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
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=2ce708c1-574f-6021-4f94-eaf88be3161c@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