mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arun Iyengar via B4 Relay <devnull+aiyengar1990.gmail.com@kernel.org>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
	 Nicolas Dufresne <nicolas.dufresne@collabora.com>,
	 Hans Verkuil <hverkuil@kernel.org>
Cc: Tomasz Figa <tfiga@chromium.org>,
	linux-media@vger.kernel.org,  linux-kernel@vger.kernel.org,
	Arun Iyengar <aiyengar1990@gmail.com>
Subject: [PATCH RFC] media: doc: dev-encoder: Define CAPTURE sizeimage across OUTPUT changes
Date: Thu, 26 Nov 2026 16:57:33 +0000	[thread overview]
Message-ID: <20261126-b4-v4l2-enc-sizeimage-v1-1-dd2cb99bd717@gmail.com> (raw)

From: Arun Iyengar <aiyengar1990@gmail.com>

The encoder sets the CAPTURE width and height from the OUTPUT format,
but the specification doesn't say what happens to sizeimage then. A
client leaving sizeimage to the encoder (0) gets a size for the coded
size at the time of the CAPTURE S_FMT, usually the default resolution,
as the OUTPUT format is set later.

Document that setting the OUTPUT format updates the coded size, and a
sizeimage chosen by the encoder with it. A size requested by the client
is not reduced, so clients setting one keep their buffers.

Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
Spec proposal asked for in the review of the Hantro JPEG encoder
fixes [1].

[1] https://lore.kernel.org/r/7a5a79bf8e1bfe698b7a49aa9580eb3858c25993.camel@collabora.com

Today vicodec, allegro and iris ignore the client's sizeimage; venus and
wave5 recompute or raise it on OUTPUT S_FMT; hantro, coda, mtk-vcodec and
s5p-mfc never update it. No driver change here.

Open point: a G_FMT/S_FMT round trip (v4l2-ctl) passes the old default
back as a non-zero sizeimage, so it then counts as the client's choice.

Developed with Claude (Anthropic), which wrote the text and the commit
message. I reviewed it.
---
 Documentation/userspace-api/media/v4l/dev-encoder.rst | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/Documentation/userspace-api/media/v4l/dev-encoder.rst b/Documentation/userspace-api/media/v4l/dev-encoder.rst
index cdad276d00bc..64f1297dab3f 100644
--- a/Documentation/userspace-api/media/v4l/dev-encoder.rst
+++ b/Documentation/userspace-api/media/v4l/dev-encoder.rst
@@ -156,7 +156,8 @@ Initialization
 
      ``sizeimage``
          desired size of ``CAPTURE`` buffers; the encoder may adjust it to
-         match hardware requirements.
+         match hardware requirements. If 0, the encoder chooses it for the
+         coded size and again when the coded size changes, see step 3.
 
      ``width``, ``height``
          ignored (read-only).
@@ -230,6 +231,12 @@ Initialization
      default values, based on the new resolution, as described in the next
      step.
 
+   * Setting the ``OUTPUT`` format sets the ``CAPTURE`` ``width`` and
+     ``height`` to the new coded size. A ``CAPTURE`` ``sizeimage`` chosen by
+     the encoder (the client passed 0, or the encoder ignores the client's
+     value) is chosen again for the new coded size. A ``sizeimage`` requested
+     by the client is not reduced.
+
 4. Set the raw frame interval on the ``OUTPUT`` queue via
    :c:func:`VIDIOC_S_PARM`. This also sets the coded frame interval on the
    ``CAPTURE`` queue to the same value.

---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261126-b4-v4l2-enc-sizeimage-89cb43b74b9b

Best regards,
--  
Arun Iyengar <aiyengar1990@gmail.com>



                 reply	other threads:[~2026-11-26 16:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261126-b4-v4l2-enc-sizeimage-v1-1-dd2cb99bd717@gmail.com \
    --to=devnull+aiyengar1990.gmail.com@kernel.org \
    --cc=aiyengar1990@gmail.com \
    --cc=hverkuil@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=nicolas.dufresne@collabora.com \
    --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®