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