drivers/gpu/drm/i915/gem/i915_gem_object_types.h

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gem/i915_gem_object_types.h

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/i915/gem/i915_gem_object_types.h
Extension
.h
Size
26443 bytes
Lines
749
Domain
Driver Families
Bucket
drivers/gpu
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct i915_lut_handle {
	struct list_head obj_link;
	struct i915_gem_context *ctx;
	u32 handle;
};

struct drm_i915_gem_object_ops {
	unsigned int flags;
#define I915_GEM_OBJECT_IS_SHRINKABLE			BIT(1)
/* Skip the shrinker management in set_pages/unset_pages */
#define I915_GEM_OBJECT_SELF_MANAGED_SHRINK_LIST	BIT(2)
#define I915_GEM_OBJECT_IS_PROXY			BIT(3)
#define I915_GEM_OBJECT_NO_MMAP				BIT(4)

	/* Interface between the GEM object and its backing storage.
	 * get_pages() is called once prior to the use of the associated set
	 * of pages before to binding them into the GTT, and put_pages() is
	 * called after we no longer need them. As we expect there to be
	 * associated cost with migrating pages between the backing storage
	 * and making them available for the GPU (e.g. clflush), we may hold
	 * onto the pages after they are no longer referenced by the GPU
	 * in case they may be used again shortly (for example migrating the
	 * pages to a different memory domain within the GTT). put_pages()
	 * will therefore most likely be called when the object itself is
	 * being released or under memory pressure (where we attempt to
	 * reap pages for the shrinker).
	 */
	int (*get_pages)(struct drm_i915_gem_object *obj);
	void (*put_pages)(struct drm_i915_gem_object *obj,
			  struct sg_table *pages);
	int (*truncate)(struct drm_i915_gem_object *obj);
	/**
	 * shrink - Perform further backend specific actions to facilate
	 * shrinking.
	 * @obj: The gem object
	 * @flags: Extra flags to control shrinking behaviour in the backend
	 *
	 * Possible values for @flags:
	 *
	 * I915_GEM_OBJECT_SHRINK_WRITEBACK - Try to perform writeback of the
	 * backing pages, if supported.
	 *
	 * I915_GEM_OBJECT_SHRINK_NO_GPU_WAIT - Don't wait for the object to
	 * idle.  Active objects can be considered later. The TTM backend for
	 * example might have aync migrations going on, which don't use any
	 * i915_vma to track the active GTT binding, and hence having an unbound
	 * object might not be enough.
	 */
#define I915_GEM_OBJECT_SHRINK_WRITEBACK   BIT(0)
#define I915_GEM_OBJECT_SHRINK_NO_GPU_WAIT BIT(1)
	int (*shrink)(struct drm_i915_gem_object *obj, unsigned int flags);

	int (*pread)(struct drm_i915_gem_object *obj,
		     const struct drm_i915_gem_pread *arg);
	int (*pwrite)(struct drm_i915_gem_object *obj,
		      const struct drm_i915_gem_pwrite *arg);
	u64 (*mmap_offset)(struct drm_i915_gem_object *obj);
	void (*unmap_virtual)(struct drm_i915_gem_object *obj);

	int (*dmabuf_export)(struct drm_i915_gem_object *obj);

	/**
	 * adjust_lru - notify that the madvise value was updated
	 * @obj: The gem object
	 *
	 * The madvise value may have been updated, or object was recently
	 * referenced so act accordingly (Perhaps changing an LRU list etc).
	 */
	void (*adjust_lru)(struct drm_i915_gem_object *obj);

	/**
	 * delayed_free - Override the default delayed free implementation
	 */
	void (*delayed_free)(struct drm_i915_gem_object *obj);

	/**
	 * migrate - Migrate object to a different region either for
	 * pinning or for as long as the object lock is held.
	 */
	int (*migrate)(struct drm_i915_gem_object *obj,
		       struct intel_memory_region *mr,
		       unsigned int flags);

	void (*release)(struct drm_i915_gem_object *obj);

	const struct vm_operations_struct *mmap_ops;
	const char *name; /* friendly name for debug, e.g. lockdep classes */
};

/**

Annotation

Implementation Notes