mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 12:44:11 +08:00
drm: add drm_gem_object_is_shared_for_memory_stats() helper
Add a helper so that drm drivers can consistently report shared status via the fdinfo shared memory stats interface. In addition to handle count, show buffers as shared if they are shared via dma-buf as well (e.g., shared with v4l or some other subsystem). v2: switch to inline function Link: https://lore.kernel.org/all/20231207180225.439482-1-alexander.deucher@amd.com/ Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> (v1) Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Christian König <christian.keonig@amd.com> Signed-off-by: Christian König <christian.koenig@amd.com>
This commit is contained in:
parent
77d17c4cd0
commit
b31f5eba32
@ -553,6 +553,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.
|
||||
|
Loading…
Reference in New Issue
Block a user