drivers/gpu/drm/vmwgfx/vmwgfx_resource_priv.h

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/vmwgfx/vmwgfx_resource_priv.h

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/vmwgfx/vmwgfx_resource_priv.h
Extension
.h
Size
6023 bytes
Lines
155
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 vmw_user_resource_conv {
	enum ttm_object_type object_type;
	struct vmw_resource *(*base_obj_to_res)(struct ttm_base_object *base);
	void (*res_free) (struct vmw_resource *res);
};

/**
 * struct vmw_res_func - members and functions common for a resource type
 *
 * @res_type:          Enum that identifies the lru list to use for eviction.
 * @needs_guest_memory:Whether the resource is guest-backed and needs
 *                     persistent buffer storage.
 * @type_name:         String that identifies the resource type.
 * @domain:            TTM placement for guest memory buffers.
 * @busy_domain:       TTM busy placement for guest memory buffers.
 * @may_evict          Whether the resource may be evicted.
 * @create:            Create a hardware resource.
 * @destroy:           Destroy a hardware resource.
 * @bind:              Bind a hardware resource to persistent buffer storage.
 * @unbind:            Unbind a hardware resource from persistent
 *                     buffer storage.
 * @commit_notify:     If the resource is a command buffer managed resource,
 *                     callback to notify that a define or remove command
 *                     has been committed to the device.
 * @dirty_alloc:       Allocate a dirty tracker. NULL if dirty-tracking is not
 *                     supported.
 * @dirty_free:        Free the dirty tracker.
 * @dirty_sync:        Upload the dirty mob contents to the resource.
 * @dirty_add_range:   Add a sequential dirty range to the resource
 *                     dirty tracker.
 * @clean:             Clean the resource.
 */
struct vmw_res_func {
	enum vmw_res_type res_type;
	bool needs_guest_memory;
	const char *type_name;
	u32 domain;
	u32 busy_domain;
	bool may_evict;
	u32 prio;
	u32 dirty_prio;

	int (*create) (struct vmw_resource *res);
	int (*destroy) (struct vmw_resource *res);
	int (*bind) (struct vmw_resource *res,
		     struct ttm_validate_buffer *val_buf);
	int (*unbind) (struct vmw_resource *res,
		       bool readback,
		       struct ttm_validate_buffer *val_buf);
	void (*commit_notify)(struct vmw_resource *res,
			      enum vmw_cmdbuf_res_state state);
	int (*dirty_alloc)(struct vmw_resource *res);
	void (*dirty_free)(struct vmw_resource *res);
	int (*dirty_sync)(struct vmw_resource *res);
	void (*dirty_range_add)(struct vmw_resource *res, size_t start,
				 size_t end);
	int (*clean)(struct vmw_resource *res);
};

/**
 * struct vmw_simple_resource_func - members and functions common for the
 * simple resource helpers.
 * @res_func:  struct vmw_res_func as described above.
 * @ttm_res_type:  TTM resource type used for handle recognition.
 * @size:  Size of the simple resource information struct.
 * @init:  Initialize the simple resource information.
 * @hw_destroy:  A resource hw_destroy function.
 * @set_arg_handle:  Set the handle output argument of the ioctl create struct.
 */
struct vmw_simple_resource_func {
	const struct vmw_res_func res_func;
	int ttm_res_type;
	size_t size;
	int (*init)(struct vmw_resource *res, void *data);
	void (*hw_destroy)(struct vmw_resource *res);
	void (*set_arg_handle)(void *data, u32 handle);
};

/**
 * struct vmw_simple_resource - Kernel only side simple resource
 * @res: The resource we derive from.
 * @func: The method and member virtual table.
 */
struct vmw_simple_resource {
	struct vmw_resource res;
	const struct vmw_simple_resource_func *func;
};

int vmw_resource_alloc_id(struct vmw_resource *res);
void vmw_resource_release_id(struct vmw_resource *res);

Annotation

Implementation Notes