public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: ming.qian@oss.nxp.com
To: linux-media@vger.kernel.org
Cc: mchehab@kernel.org, hverkuil-cisco@xs4all.nl,
	nicolas@ndufresne.ca, sebastian.fricke@collabora.com,
	shawnguo@kernel.org, s.hauer@pengutronix.de,
	kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com,
	Frank.li@nxp.com, xiahong.bao@nxp.com, eagle.zhou@nxp.com,
	imx@lists.linux.dev, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 2/7] docs: media: v4l2-ctrls: Add V4L2_CID_MEMORY_USAGE control
Date: Tue, 31 Mar 2026 15:23:12 +0800	[thread overview]
Message-ID: <20260331072347.253-3-ming.qian@oss.nxp.com> (raw)
In-Reply-To: <20260331072347.253-1-ming.qian@oss.nxp.com>

From: Ming Qian <ming.qian@oss.nxp.com>

Add documentation for the V4L2_CID_MEMORY_USAGE control in the
userspace API documentation. This read-only control allows applications
to query the total amount of memory currently used by a device instance.

The documentation explains:
- The control reports memory usage in bytes for driver-managed allocations
- It includes internal buffers, intermediate processing data, and other
  driver allocations associated with the instance
- Applications can use it for debugging, resource monitoring, and making
  informed buffer allocation decisions
- The value may change dynamically during device operation
- It only reports driver-managed memory, not application-allocated buffers

Update V4L2_CID_LASTP1 definition to reflect the new control as the
last predefined control ID.

Signed-off-by: Ming Qian <ming.qian@oss.nxp.com>
---
 .../userspace-api/media/v4l/control.rst       | 22 ++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/Documentation/userspace-api/media/v4l/control.rst b/Documentation/userspace-api/media/v4l/control.rst
index 19372bb32c4b..6904c5bdbf37 100644
--- a/Documentation/userspace-api/media/v4l/control.rst
+++ b/Documentation/userspace-api/media/v4l/control.rst
@@ -316,9 +316,29 @@ Control IDs
     set the alpha component value of all pixels for further processing
     in the device.
 
+``V4L2_CID_MEMORY_USAGE`` ``(integer64)``
+    This is an optional read-only control that reports the total amount of
+    memory, in bytes, currently allocated and used by this device instance.
+    This includes memory used for internal buffers, intermediate processing
+    data, and any other driver-managed allocations associated with the
+    instance.
+
+    Applications can use this control to monitor memory consumption for
+    debugging purposes, resource management, or to make informed decisions
+    about buffer allocation strategies. The value may change dynamically
+    as the device operates, for example when buffers are allocated or
+    released during streaming.
+
+    Note that this control only reports memory managed by the driver for
+    this specific instance; it does not include memory allocated by the
+    application itself (e.g., userspace buffers passed to the driver).
+
+    Not all drivers support this control. Applications should query for
+    its availability before use.
+
 ``V4L2_CID_LASTP1``
     End of the predefined control IDs (currently
-    ``V4L2_CID_ALPHA_COMPONENT`` + 1).
+    ``V4L2_CID_MEMORY_USAGE`` + 1).
 
 ``V4L2_CID_PRIVATE_BASE``
     ID of the first custom (driver specific) control. Applications
-- 
2.53.0



  parent reply	other threads:[~2026-03-31  7:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-31  7:23 [RFC PATCH 0/7] media: amphion: Add DMA memory tracking support ming.qian
2026-03-31  7:23 ` [RFC PATCH 1/7] media: v4l2-ctrls: Add V4L2_CID_MEMORY_USAGE control ming.qian
2026-03-31 14:33   ` Frank Li
2026-03-31 14:54     ` Nicolas Dufresne
2026-04-01  2:23       ` Ming Qian(OSS)
2026-04-02  3:14         ` Ming Qian(OSS)
2026-04-08 21:11           ` Nicolas Dufresne
2026-04-09 14:29             ` Detlev Casanova
2026-04-10  2:53               ` Ming Qian(OSS)
2026-04-01  2:07     ` Ming Qian(OSS)
2026-03-31  7:23 ` ming.qian [this message]
2026-03-31  7:23 ` [RFC PATCH 3/7] media: v4l2-memtrack: Add V4L2 memory tracking infrastructure ming.qian
2026-03-31  7:23 ` [RFC PATCH 4/7] docs: media: v4l2-memtrack: Add driver API documentation ming.qian
2026-03-31  7:23 ` [RFC PATCH 5/7] MAINTAINERS: Add entry for V4L2 memory usage tracker ming.qian
2026-03-31  7:23 ` [RFC PATCH 6/7] media: videobuf2: Add memory tracking support ming.qian
2026-03-31  7:23 ` [RFC PATCH 7/7] media: amphion: Add V4L2 " ming.qian

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=20260331072347.253-3-ming.qian@oss.nxp.com \
    --to=ming.qian@oss.nxp.com \
    --cc=Frank.li@nxp.com \
    --cc=eagle.zhou@nxp.com \
    --cc=festevam@gmail.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=nicolas@ndufresne.ca \
    --cc=s.hauer@pengutronix.de \
    --cc=sebastian.fricke@collabora.com \
    --cc=shawnguo@kernel.org \
    --cc=xiahong.bao@nxp.com \
    /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