Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/v3d: Expose memory stats through fdinfo

Use the common DRM function `drm_show_memory_stats()` to expose standard
fdinfo memory stats.

V3D exposes global GPU memory stats through debugfs. Those stats will be
preserved while the DRM subsystem doesn't have a standard solution to
expose global GPU stats.

Signed-off-by: Maíra Canal <mcanal@igalia.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240711142736.783816-1-mcanal@igalia.com

+14
+12
drivers/gpu/drm/v3d/v3d_bo.c
··· 26 26 #include "v3d_drv.h" 27 27 #include "uapi/drm/v3d_drm.h" 28 28 29 + static enum drm_gem_object_status v3d_gem_status(struct drm_gem_object *obj) 30 + { 31 + struct v3d_bo *bo = to_v3d_bo(obj); 32 + enum drm_gem_object_status res = 0; 33 + 34 + if (bo->base.pages) 35 + res |= DRM_GEM_OBJECT_RESIDENT; 36 + 37 + return res; 38 + } 39 + 29 40 /* Called DRM core on the last userspace/kernel unreference of the 30 41 * BO. 31 42 */ ··· 74 63 .vmap = drm_gem_shmem_object_vmap, 75 64 .vunmap = drm_gem_shmem_object_vunmap, 76 65 .mmap = drm_gem_shmem_object_mmap, 66 + .status = v3d_gem_status, 77 67 .vm_ops = &drm_gem_shmem_vm_ops, 78 68 }; 79 69
+2
drivers/gpu/drm/v3d/v3d_drv.c
··· 184 184 drm_printf(p, "v3d-jobs-%s: \t%llu jobs\n", 185 185 v3d_queue_to_string(queue), jobs_completed); 186 186 } 187 + 188 + drm_show_memory_stats(p, file); 187 189 } 188 190 189 191 static const struct file_operations v3d_drm_fops = {