diff options
Diffstat (limited to 'include/drm/drm_gem.h')
| -rw-r--r-- | include/drm/drm_gem.h | 32 | 
1 files changed, 32 insertions, 0 deletions
diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h index b8efd836edef..bbc721870c13 100644 --- a/include/drm/drm_gem.h +++ b/include/drm/drm_gem.h @@ -43,6 +43,25 @@ struct iosys_map;  struct drm_gem_object;  /** + * enum drm_gem_object_status - bitmask of object state for fdinfo reporting + * @DRM_GEM_OBJECT_RESIDENT: object is resident in memory (ie. not unpinned) + * @DRM_GEM_OBJECT_PURGEABLE: object marked as purgeable by userspace + * + * Bitmask of status used for fdinfo memory stats, see &drm_gem_object_funcs.status + * and drm_show_fdinfo().  Note that an object can DRM_GEM_OBJECT_PURGEABLE if + * it still active or not resident, in which case drm_show_fdinfo() will not + * account for it as purgeable.  So drivers do not need to check if the buffer + * is idle and resident to return this bit.  (Ie. userspace can mark a buffer + * as purgeable even while it is still busy on the GPU.. it does not _actually_ + * become puregeable until it becomes idle.  The status gem object func does + * not need to consider this.) + */ +enum drm_gem_object_status { +	DRM_GEM_OBJECT_RESIDENT  = BIT(0), +	DRM_GEM_OBJECT_PURGEABLE = BIT(1), +}; + +/**   * struct drm_gem_object_funcs - GEM object functions   */  struct drm_gem_object_funcs { @@ -175,6 +194,19 @@ struct drm_gem_object_funcs {  	int (*evict)(struct drm_gem_object *obj);  	/** +	 * @status: +	 * +	 * The optional status callback can return additional object state +	 * which determines which stats the object is counted against.  The +	 * callback is called under table_lock.  Racing against object status +	 * change is "harmless", and the callback can expect to not race +	 * against object destruction. +	 * +	 * Called by drm_show_memory_stats(). +	 */ +	enum drm_gem_object_status (*status)(struct drm_gem_object *obj); + +	/**  	 * @vm_ops:  	 *  	 * Virtual memory operations used with mmap.  |