mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil+cisco@kernel.org>
To: Nicolas Dufresne <nicolas@ndufresne.ca>,
	Hirokazu Honda <hiroh@chromium.org>
Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Tomasz Figa <tfiga@chromium.org>,
	Benjamin Gaignard <benjamin.gaignard@collabora.com>,
	Daniel Almeida <daniel.almeida@collabora.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] media: videobuf2: Allow applications customize data offsets of capture buffers
Date: Wed, 17 Dec 2025 11:02:24 +0100	[thread overview]
Message-ID: <221d3f70-b418-4f89-b352-773c544ed428@kernel.org> (raw)
In-Reply-To: <e265d412260226be67df3bfb0dd05bb74e36d551.camel@ndufresne.ca>

On 15/12/2025 21:56, Nicolas Dufresne wrote:
> Hi Hirokazu, Hans,
> 
> Le vendredi 12 décembre 2025 à 15:15 -0800, Hirokazu Honda a écrit :
>> Thanks Hans for your quick response.
>> And I apologize for my late reply.
>>
>>> So that's were I am: I'm not opposed to supporting this feature, but I
>>> feel that struct v4l2_buffer has reached end-of-life, and that it is
>>> time for a modern replacement.
>>
>> I got it.
>> I will discuss in my team if I can contribute to v4l2_buffer_ext work
>> or sponsor that work next year or in 2027.
> 
> I share Hans feeling in regard to trying to force partial support for
> data_offset into some space left of v4l2_buffer. This brought me thinking that
> doing that, or even v4l2_buffer_ext as last proposed was not the right solution
> to modernize the old V4L2 framework. In fact, I believe that v4l2_buffer_ext
> would simply replicate the MPLANE disaster, leaving another permanent scar in
> the API. Just to state simply, MPLANE have lead to duplication of every multi-
> plane pixel formats, solving some plane alignment issue in multi-allocation
> cases, but leaving behind the common single allocation case.
> 
> For me, the most central issue in V4L2 is that the memory allocation/importation
> is bound to the operation queues. That brings all sort of issues such 
> 
> - We can't queue twice the same frame
> - We can't mix external buffer with device allocated buffer
> - All buffers must have the exact same stride

The three limitations above are all technically possible to implement with the
current vb2 framework/streaming uAPI, it's just that nobody was ever motivated
enough to add support for it.

> - Application is responsible for caching which memory goes to which v4l2_buffer

True, but is this really a big deal?

> - Attempting to import a buffer requires a free spot in the queue

True.

> 
> This adds on top of the v4l2_buffer structure limitation we have been targeting
> so far. With the growth of modern standard API (think Vulkan Video notably), it
> becomes apparent that the model is too inflexible. This inability to separate
> memory allocation and importation from operations creates a lot of complexity in
> user-space, leading to complicated bugs.
> 
> I've been quite about it, since until now I didn't have a solution in mind, but
> I recently come with some ideas. I'll will try develop these ideas, at least in
> prose for now and come up with an RFC, hopefully somewhere beginning of January
> 2026. That my proposal is accepted or not isn't quite relevant. But hopefully it
> will be a starter to go go beyond just fixing what we see. In fact, this next
> step is for me doing to be quite decisive if I continue doing codecs in V4L2 or
> not in the long run. But I'm sure this is not just about video codecs.

I'm looking forward to your RFC!

What is important for me is that whatever we come up with, it is something that
existing drivers can easily support. A new streaming/buffer allocation uAPI that
can only be supported by new drivers will need very, very good reasons for it to
be accepted.

The nice thing about the v4l2_buffer_ext proposal was that it can easily be
supported by all drivers.

From a technical perspective both struct v4l2_buffer and struct v4l2_format have
reached end-of-life: they are full of historical cruft, they are inefficient, the
32-bit/time32 compatibility code is awful and hard to maintain.

Regards,

	Hans

> 
> regards,
> Nicolas


  parent reply	other threads:[~2025-12-17 10:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-22 13:23 Dmitry Osipenko
2022-03-23 13:05 ` Nicolas Dufresne
2022-03-23 14:28   ` Dmitry Osipenko
2022-03-23 19:21     ` Nicolas Dufresne
2022-03-24 18:20       ` Dmitry Osipenko
2022-03-25 12:32         ` Nicolas Dufresne
2022-03-25 13:11           ` Dave Stevenson
2022-04-22 22:50             ` Dmitry Osipenko
2022-05-18 10:26           ` Hans Verkuil
2022-05-19 10:22             ` Dmitry Osipenko
2022-06-29 15:37               ` Dmitry Osipenko
2025-12-02 20:07 ` Hirokazu Honda
2025-12-03  8:28   ` Hans Verkuil
2025-12-12 23:15     ` Hirokazu Honda
2025-12-15 20:56       ` Nicolas Dufresne
2025-12-17  8:44         ` Tomasz Figa
2025-12-17 10:02         ` Hans Verkuil [this message]
2025-12-19  2:01           ` Hirokazu Honda
2025-12-19 15:18           ` Nicolas Dufresne
2025-12-24  6:09             ` Tomasz Figa

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=221d3f70-b418-4f89-b352-773c544ed428@kernel.org \
    --to=hverkuil+cisco@kernel.org \
    --cc=benjamin.gaignard@collabora.com \
    --cc=daniel.almeida@collabora.com \
    --cc=dmitry.osipenko@collabora.com \
    --cc=hiroh@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=nicolas@ndufresne.ca \
    --cc=tfiga@chromium.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

all inboxes | Powered by JetHome®