STRUCT VMW_CMDBUF_MAN(9)
π struct vmw_cmdbuf_man(9) π
okay so bestie, welcome to the struct vmw_cmdbuf_man page from the Kernel API Manual β section 9, the cool section. this is literally the command buffer manager and i'm obsessed with how much it's doing. let's get into it π«Ά
πΈ NAME πΈ
struct vmw_cmdbuf_man β the command buffer manager. that's her. that's the whole vibe. π
β¨ SYNOPSIS β¨
struct vmw_cmdbuf_man {
struct mutex cur_mutex;
struct mutex space_mutex;
struct mutex error_mutex;
struct work_struct work;
struct vmw_private *dev_priv;
struct vmw_cmdbuf_context ctx[SVGA_CB_CONTEXT_MAX];
struct list_head error;
struct drm_mm mm;
struct vmw_bo *cmd_space;
u8 *map;
struct vmw_cmdbuf_header *cur;
size_t cur_pos;
size_t default_size;
unsigned max_hw_submitted;
spinlock_t lock;
struct dma_pool *headers;
struct dma_pool *dheaders;
wait_queue_head_t alloc_queue;
wait_queue_head_t idle_queue;
bool irq_on;
bool using_mob;
bool has_pool;
dma_addr_t handle;
size_t size;
u64 id;
u32 num_contexts;
};
no cap, that's a lot of fields. but she's worth it π
π Members π
okay so let's meet the whole cast, one field at a time β¨
cur_mutexβ the mutex that protectscur, the command buffer we use for those incremental small kernel command submissions. small but mighty πspace_mutexβ mutex that protects against starvation when we allocate main pool buffer space. she's here to make sure nobody starves, fr fr πerror_mutexβ mutex to serialize the work queue error handling. heads up though: this isn't needed if the same workqueue handler can't race with itself... πworkβ astruct work_structimplementing command buffer error handling. Immutable. icon behavior π₯dev_privβ pointer to the device private struct. Immutable. πctxβ array of command buffer context queues. the queues and the context data are protected bylock. π¦errorβ list of command buffers that have caused device errors. protected bylock. the naughty list πmmβ range manager for the command buffer space. manager allocations and frees are protected bylock. πcmd_spaceβ buffer object for the command buffer space β unless we were able to make a contigous coherent DMA memory allocation,handle. Immutable. π€mapβ pointer to command buffer space. it may be a mapped buffer object or a contigous coherent DMA memory allocation. Immutable. either way she slays β¨curβ command buffer for small kernel command submissions. protected bycur_mutex. πcur_posβ space already used incur. protected bycur_mutex. tracking the usage, love that for us πdefault_sizeβ default size for thecurcommand buffer. Immutable. πΈmax_hw_submittedβ max number of in-flight command buffers the device can handle. Immutable. π₯lockβ spinlock protecting the command submission queues. the bouncer at the club πheadersβ pool of DMA memory for device command buffer headers. Internal protection. π§dheadersβ pool of DMA memory for device command buffer headers with trailing space for inline data. Internal protection. β¨alloc_queueβ wait queue for processes waiting to allocate command buffer space. line starts here π«Άidle_queueβ wait queue for processes waiting for command buffer idle. π¦irq_onβ whether the process function has requested irq to be turned on. Protected bylock. πusing_mobβ whether the command buffer space is a MOB or a contigous DMA allocation. Immutable. πhas_poolβ has a large pool of DMA memory which allows larger allocations. Typically this is false only during bootstrap. πΈhandleβ DMA address handle for the command buffer space ifusing_mobis false. Immutable. βsizeβ the size of the command buffer space. Immutable. πidβ monotonically increasing ID of the last cmdbuf submitted. it only goes up, periodt πnum_contextsβ number of contexts actually enabled. π
π SEE ALSO π
Kernel file ./drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c and honestly the whole extended friend group π:
struct vmw_cmdbuf_context(9)struct vmw_cmdbuf_header(9)struct vmw_cmdbuf_dheader(9)struct vmw_cmdbuf_alloc_info(9)vmw_cmdbuf_cur_lock(9)vmw_cmdbuf_cur_unlock(9)vmw_cmdbuf_header_inline_free(9)__vmw_cmdbuf_header_free(9)vmw_cmdbuf_header_free(9)vmw_cmdbuf_header_submit(9)vmw_cmdbuf_ctx_init(9)vmw_cmdbuf_ctx_submit(9)vmw_cmdbuf_ctx_process(9)vmw_cmdbuf_man_process(9)vmw_cmdbuf_ctx_add(9)vmw_cmdbuf_irqthread(9)vmw_cmdbuf_work_func(9)vmw_cmdbuf_man_idle(9)__vmw_cmdbuf_cur_flush(9)vmw_cmdbuf_cur_flush(9)vmw_cmdbuf_idle(9)vmw_cmdbuf_try_alloc(9)vmw_cmdbuf_alloc_space(9)vmw_cmdbuf_space_pool(9)vmw_cmdbuf_space_inline(9)vmw_cmdbuf_alloc(9)vmw_cmdbuf_reserve_cur(9)vmw_cmdbuf_commit_cur(9)vmw_cmdbuf_reserve(9)vmw_cmdbuf_commit(9)vmw_cmdbuf_send_device_command(9)vmw_cmdbuf_preempt(9)vmw_cmdbuf_startstop(9)vmw_cmdbuf_set_pool_size(9)vmw_cmdbuf_man_create(9)vmw_cmdbuf_remove_pool(9)vmw_cmdbuf_man_destroy(9)
and that's the page, bestie!! this one came out of ./drivers/gpu/drm/vmwgfx back in October 2026, and like... we're so lucky she did π
β¨ mwah, go read some more kernel docs, ily π«Άπ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms