drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c- Extension
.c- Size
- 138768 bytes
- Lines
- 4516
- 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.
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
vmwgfx_binding.hvmwgfx_bo.hvmwgfx_drv.hvmwgfx_mksstat.hvmwgfx_so.hdrm/ttm/ttm_bo.hdrm/ttm/ttm_placement.hlinux/sync_file.hlinux/hashtable.hlinux/vmalloc.h
Detected Declarations
struct vmw_relocationstruct vmw_resource_relocationstruct vmw_ctx_validation_infostruct vmw_cmd_entrystruct vmw_draw_indexed_instanced_indirect_cmdstruct vmw_draw_instanced_indirect_cmdstruct vmw_dispatch_indirect_cmdenum vmw_resource_relocation_typeenum vmw_val_add_flagsfunction vmw_ptr_difffunction vmw_execbuf_bindings_commitfunction list_for_each_entryfunction vmw_bind_dx_query_mobfunction vmw_cmd_ctx_first_setupfunction vmw_execbuf_res_sizefunction vmw_execbuf_rcache_updatefunction vmw_execbuf_res_val_addfunction vmw_view_res_val_addfunction vmw_view_id_val_addfunction vmw_resource_context_res_addfunction vmw_res_typefunction list_for_each_entryfunction vmw_resource_relocation_addfunction vmw_resource_relocations_freefunction vmw_resource_relocations_applyfunction list_for_each_entryfunction vmw_cmd_invalidfunction vmw_cmd_okfunction vmw_resources_reservefunction vmw_cmd_res_checkfunction vmw_rebind_all_dx_queryfunction vmw_rebind_contextsfunction list_for_each_entryfunction vmw_view_bindings_addfunction vmw_cmd_cid_checkfunction vmw_execbuf_info_from_resfunction vmw_cmd_set_render_target_checkfunction vmw_cmd_surface_copy_checkfunction vmw_cmd_buffer_copy_checkfunction vmw_cmd_pred_copy_checkfunction vmw_cmd_stretch_blt_checkfunction vmw_cmd_blt_surf_screen_checkfunction vmw_cmd_present_checkfunction vmw_query_bo_switch_preparefunction vmw_query_bo_switch_commitfunction vmw_apply_relocationsfunction vmw_apply_relocationsfunction vmw_cmd_dx_define_query
Annotated Snippet
struct vmw_relocation {
struct list_head head;
struct vmw_bo *vbo;
union {
SVGAMobId *mob_loc;
SVGAGuestPtr *location;
};
};
/**
* enum vmw_resource_relocation_type - Relocation type for resources
*
* @vmw_res_rel_normal: Traditional relocation. The resource id in the
* command stream is replaced with the actual id after validation.
* @vmw_res_rel_nop: NOP relocation. The command is unconditionally replaced
* with a NOP.
* @vmw_res_rel_cond_nop: Conditional NOP relocation. If the resource id after
* validation is -1, the command is replaced with a NOP. Otherwise no action.
* @vmw_res_rel_max: Last value in the enum - used for error checking
*/
enum vmw_resource_relocation_type {
vmw_res_rel_normal,
vmw_res_rel_nop,
vmw_res_rel_cond_nop,
vmw_res_rel_max
};
/**
* struct vmw_resource_relocation - Relocation info for resources
*
* @head: List head for the software context's relocation list.
* @res: Non-ref-counted pointer to the resource.
* @offset: Offset of single byte entries into the command buffer where the id
* that needs fixup is located.
* @rel_type: Type of relocation.
*/
struct vmw_resource_relocation {
struct list_head head;
const struct vmw_resource *res;
u32 offset:29;
enum vmw_resource_relocation_type rel_type:3;
};
/**
* struct vmw_ctx_validation_info - Extra validation metadata for contexts
*
* @head: List head of context list
* @ctx: The context resource
* @cur: The context's persistent binding state
* @staged: The binding state changes of this command buffer
*/
struct vmw_ctx_validation_info {
struct list_head head;
struct vmw_resource *ctx;
struct vmw_ctx_binding_state *cur;
struct vmw_ctx_binding_state *staged;
};
/**
* struct vmw_cmd_entry - Describe a command for the verifier
*
* @func: Call-back to handle the command.
* @user_allow: Whether allowed from the execbuf ioctl.
* @gb_disable: Whether disabled if guest-backed objects are available.
* @gb_enable: Whether enabled iff guest-backed objects are available.
* @cmd_name: Name of the command.
*/
struct vmw_cmd_entry {
int (*func) (struct vmw_private *, struct vmw_sw_context *,
SVGA3dCmdHeader *);
bool user_allow;
bool gb_disable;
bool gb_enable;
const char *cmd_name;
};
#define VMW_CMD_DEF(_cmd, _func, _user_allow, _gb_disable, _gb_enable) \
[(_cmd) - SVGA_3D_CMD_BASE] = {(_func), (_user_allow),\
(_gb_disable), (_gb_enable), #_cmd}
static int vmw_resource_context_res_add(struct vmw_private *dev_priv,
struct vmw_sw_context *sw_context,
struct vmw_resource *ctx);
static int vmw_translate_mob_ptr(struct vmw_private *dev_priv,
struct vmw_sw_context *sw_context,
SVGAMobId *id,
struct vmw_bo **vmw_bo_p);
/**
* vmw_ptr_diff - Compute the offset from a to b in bytes
*
Annotation
- Immediate include surface: `vmwgfx_binding.h`, `vmwgfx_bo.h`, `vmwgfx_drv.h`, `vmwgfx_mksstat.h`, `vmwgfx_so.h`, `drm/ttm/ttm_bo.h`, `drm/ttm/ttm_placement.h`, `linux/sync_file.h`.
- Detected declarations: `struct vmw_relocation`, `struct vmw_resource_relocation`, `struct vmw_ctx_validation_info`, `struct vmw_cmd_entry`, `struct vmw_draw_indexed_instanced_indirect_cmd`, `struct vmw_draw_instanced_indirect_cmd`, `struct vmw_dispatch_indirect_cmd`, `enum vmw_resource_relocation_type`, `enum vmw_val_add_flags`, `function vmw_ptr_diff`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.