diff mbox series

[RFC,2/8] drm: add new tracepoint fields to drm_device and drm_file

Message ID 20211021031027.537-3-gurchetansingh@chromium.org (mailing list archive)
State New, archived
Headers show
Series GPU memory tracepoints | expand

Commit Message

Gurchetan Singh Oct. 21, 2021, 3:10 a.m. UTC
For struct drm_device, add:
    - mem_total
    - import_mem_total

For struct drm_file, add:
    - mem_instance
    - import_mem_instance

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
---
 include/drm/drm_device.h | 16 ++++++++++++++++
 include/drm/drm_file.h   | 16 ++++++++++++++++
 2 files changed, 32 insertions(+)
diff mbox series

Patch

diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
index 604b1d1b2d72..35a96bda5320 100644
--- a/include/drm/drm_device.h
+++ b/include/drm/drm_device.h
@@ -298,6 +298,22 @@  struct drm_device {
 	 */
 	struct drm_fb_helper *fb_helper;
 
+	/**
+	 * @mem_total:
+	 *
+	 * The total size of all GEM objects known to this DRM device.  Used
+	 * with `gpu_mem_total` tracepoint.
+	 */
+	atomic64_t mem_total;
+
+	/**
+	 * @import_mem_total:
+	 *
+	 * The total size of all GEM objects imported into this DRM device from
+	 * external exporters.  Used with `gpu_mem_total` tracepoint.
+	 */
+	atomic64_t import_mem_total;
+
 	/* Everything below here is for legacy driver, never use! */
 	/* private: */
 #if IS_ENABLED(CONFIG_DRM_LEGACY)
diff --git a/include/drm/drm_file.h b/include/drm/drm_file.h
index a3acb7ac3550..a5b9befcf1db 100644
--- a/include/drm/drm_file.h
+++ b/include/drm/drm_file.h
@@ -362,6 +362,22 @@  struct drm_file {
 	 */
 	struct drm_prime_file_private prime;
 
+	/**
+	 * @mem_instance:
+	 *
+	 * The total size of all GEM objects known into this instance of the DRM
+	 * device.  Used with `gpu_mem_instance` tracepoint.
+	 */
+	atomic64_t mem_instance;
+
+	/**
+	 * @import_mem_instance:
+	 *
+	 * The total size of all GEM objects imported into this instance of the
+	 * DRM device.  Used with `gpu_mem_instance` tracepoint.
+	 */
+	atomic64_t import_mem_instance;
+
 	/* private: */
 #if IS_ENABLED(CONFIG_DRM_LEGACY)
 	unsigned long lock_count; /* DRI1 legacy lock count */