summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm/include
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2024-05-06 01:46:21 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2024-05-06 01:46:21 +0000
commit710011d18515094aec400f5578e3ebe2ccc2de81 (patch)
tree02b9e4d6b6d0c2fb6356316b59a3af0ae956d11e /sys/dev/pci/drm/include
parente635f55e4eed1fa721533562a99837910434a96f (diff)
drm: add drm_gem_object_is_shared_for_memory_stats() helper
From Alex Deucher a4ae24cd04a8e2c1f61586a2e129b1cbd44a78db in linux-6.6.y/6.6.30 b31f5eba32ae8cc28e7cfa5a55ec8670d8c718e2 in mainline linux
Diffstat (limited to 'sys/dev/pci/drm/include')
-rw-r--r--sys/dev/pci/drm/include/drm/drm_gem.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/sys/dev/pci/drm/include/drm/drm_gem.h b/sys/dev/pci/drm/include/drm/drm_gem.h
index de5d21d976f..678464ada27 100644
--- a/sys/dev/pci/drm/include/drm/drm_gem.h
+++ b/sys/dev/pci/drm/include/drm/drm_gem.h
@@ -567,6 +567,19 @@ unsigned long drm_gem_lru_scan(struct drm_gem_lru *lru,
int drm_gem_evict(struct drm_gem_object *obj);
+/**
+ * drm_gem_object_is_shared_for_memory_stats - helper for shared memory stats
+ *
+ * This helper should only be used for fdinfo shared memory stats to determine
+ * if a GEM object is shared.
+ *
+ * @obj: obj in question
+ */
+static inline bool drm_gem_object_is_shared_for_memory_stats(struct drm_gem_object *obj)
+{
+ return (obj->handle_count > 1) || obj->dma_buf;
+}
+
#ifdef CONFIG_LOCKDEP
/**
* drm_gem_gpuva_set_lock() - Set the lock protecting accesses to the gpuva list.