drivers/gpu/drm/vmwgfx/vmwgfx_binding.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/vmwgfx/vmwgfx_binding.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/vmwgfx/vmwgfx_binding.c- Extension
.c- Size
- 45994 bytes
- Lines
- 1469
- 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.
- 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_drv.hvmwgfx_binding.hdevice_include/svga3d_reg.hlinux/vmalloc.h
Detected Declarations
struct vmw_ctx_binding_statestruct vmw_binding_infofunction vmw_cbs_contextfunction vmw_binding_locfunction anotherfunction vmw_binding_addfunction vmw_binding_cb_offset_updatefunction vmw_binding_add_uav_indexfunction vmw_binding_transferfunction vmw_binding_state_killfunction vmw_binding_state_scrubfunction list_for_each_entryfunction vmw_binding_res_list_killfunction vmw_binding_res_list_scrubfunction list_for_each_entryfunction list_for_each_entryfunction vmw_binding_state_commitfunction list_for_each_entry_safefunction vmw_binding_rebind_allfunction list_for_each_entryfunction vmw_binding_scrub_shaderfunction vmw_binding_scrub_render_targetfunction vmw_binding_scrub_texturefunction vmw_binding_scrub_dx_shaderfunction vmw_binding_scrub_cbfunction vmw_collect_view_idsfunction vmw_collect_dirty_view_idsfunction vmw_emit_set_srfunction vmw_emit_set_rtfunction vmw_collect_so_targetsfunction vmw_emit_set_so_targetfunction vmw_binding_emit_dirty_psfunction vmw_collect_dirty_vbsfunction vmw_emit_set_vbfunction vmw_emit_set_uavfunction vmw_emit_set_cs_uavfunction vmw_binding_emit_dirtyfunction vmw_binding_scrub_srfunction vmw_binding_scrub_dx_rtfunction vmw_binding_scrub_so_targetfunction vmw_binding_scrub_vbfunction vmw_binding_scrub_ibfunction vmw_binding_scrub_uavfunction vmw_binding_scrub_cs_uavfunction vmw_binding_scrub_sofunction vmw_binding_state_allocfunction vmw_binding_state_freefunction vmw_binding_state_reset
Annotated Snippet
struct vmw_ctx_binding_state {
struct vmw_private *dev_priv;
struct list_head list;
struct vmw_ctx_bindinfo_view render_targets[SVGA3D_RT_MAX];
struct vmw_ctx_bindinfo_tex texture_units[SVGA3D_NUM_TEXTURE_UNITS];
struct vmw_ctx_bindinfo_view ds_view;
struct vmw_ctx_bindinfo_so_target so_targets[SVGA3D_DX_MAX_SOTARGETS];
struct vmw_ctx_bindinfo_vb vertex_buffers[SVGA3D_DX_MAX_VERTEXBUFFERS];
struct vmw_ctx_bindinfo_ib index_buffer;
struct vmw_dx_shader_bindings per_shader[SVGA3D_NUM_SHADERTYPE];
struct vmw_ctx_bindinfo_uav ua_views[VMW_MAX_UAV_BIND_TYPE];
struct vmw_ctx_bindinfo_so so_state;
unsigned long dirty;
DECLARE_BITMAP(dirty_vb, SVGA3D_DX_MAX_VERTEXBUFFERS);
u32 bind_cmd_buffer[VMW_MAX_VIEW_BINDINGS];
u32 bind_cmd_count;
u32 bind_first_slot;
};
static int vmw_binding_scrub_shader(struct vmw_ctx_bindinfo *bi, bool rebind);
static int vmw_binding_scrub_render_target(struct vmw_ctx_bindinfo *bi,
bool rebind);
static int vmw_binding_scrub_texture(struct vmw_ctx_bindinfo *bi, bool rebind);
static int vmw_binding_scrub_cb(struct vmw_ctx_bindinfo *bi, bool rebind);
static int vmw_binding_scrub_dx_rt(struct vmw_ctx_bindinfo *bi, bool rebind);
static int vmw_binding_scrub_sr(struct vmw_ctx_bindinfo *bi, bool rebind);
static int vmw_binding_scrub_so_target(struct vmw_ctx_bindinfo *bi, bool rebind);
static int vmw_binding_emit_dirty(struct vmw_ctx_binding_state *cbs);
static int vmw_binding_scrub_dx_shader(struct vmw_ctx_bindinfo *bi,
bool rebind);
static int vmw_binding_scrub_ib(struct vmw_ctx_bindinfo *bi, bool rebind);
static int vmw_binding_scrub_vb(struct vmw_ctx_bindinfo *bi, bool rebind);
static int vmw_binding_scrub_uav(struct vmw_ctx_bindinfo *bi, bool rebind);
static int vmw_binding_scrub_cs_uav(struct vmw_ctx_bindinfo *bi, bool rebind);
static int vmw_binding_scrub_so(struct vmw_ctx_bindinfo *bi, bool rebind);
static void vmw_binding_build_asserts(void) __attribute__ ((unused));
typedef int (*vmw_scrub_func)(struct vmw_ctx_bindinfo *, bool);
/**
* struct vmw_binding_info - Per binding type information for the binding
* manager
*
* @size: The size of the struct binding derived from a struct vmw_ctx_bindinfo.
* @offsets: array[shader_slot] of offsets to the array[slot]
* of struct bindings for the binding type.
* @scrub_func: Pointer to the scrub function for this binding type.
*
* Holds static information to help optimize the binding manager and avoid
* an excessive amount of switch statements.
*/
struct vmw_binding_info {
size_t size;
const size_t *offsets;
vmw_scrub_func scrub_func;
};
/*
* A number of static variables that help determine the scrub func and the
* location of the struct vmw_ctx_bindinfo slots for each binding type.
*/
static const size_t vmw_binding_shader_offsets[] = {
offsetof(struct vmw_ctx_binding_state, per_shader[0].shader),
offsetof(struct vmw_ctx_binding_state, per_shader[1].shader),
offsetof(struct vmw_ctx_binding_state, per_shader[2].shader),
offsetof(struct vmw_ctx_binding_state, per_shader[3].shader),
offsetof(struct vmw_ctx_binding_state, per_shader[4].shader),
offsetof(struct vmw_ctx_binding_state, per_shader[5].shader),
};
static const size_t vmw_binding_rt_offsets[] = {
offsetof(struct vmw_ctx_binding_state, render_targets),
};
static const size_t vmw_binding_tex_offsets[] = {
offsetof(struct vmw_ctx_binding_state, texture_units),
};
static const size_t vmw_binding_cb_offsets[] = {
offsetof(struct vmw_ctx_binding_state, per_shader[0].const_buffers),
offsetof(struct vmw_ctx_binding_state, per_shader[1].const_buffers),
offsetof(struct vmw_ctx_binding_state, per_shader[2].const_buffers),
offsetof(struct vmw_ctx_binding_state, per_shader[3].const_buffers),
offsetof(struct vmw_ctx_binding_state, per_shader[4].const_buffers),
offsetof(struct vmw_ctx_binding_state, per_shader[5].const_buffers),
};
static const size_t vmw_binding_dx_ds_offsets[] = {
offsetof(struct vmw_ctx_binding_state, ds_view),
};
static const size_t vmw_binding_sr_offsets[] = {
Annotation
- Immediate include surface: `vmwgfx_drv.h`, `vmwgfx_binding.h`, `device_include/svga3d_reg.h`, `linux/vmalloc.h`.
- Detected declarations: `struct vmw_ctx_binding_state`, `struct vmw_binding_info`, `function vmw_cbs_context`, `function vmw_binding_loc`, `function another`, `function vmw_binding_add`, `function vmw_binding_cb_offset_update`, `function vmw_binding_add_uav_index`, `function vmw_binding_transfer`, `function vmw_binding_state_kill`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
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.