STRUCT VMW_CMDBUF_MAN(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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 protects cur, 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 β€” a struct work_struct implementing 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 by lock. πŸ¦‹
  • error β€” list of command buffers that have caused device errors. protected by lock. the naughty list πŸ’€
  • mm β€” range manager for the command buffer space. manager allocations and frees are protected by lock. 🌈
  • 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 by cur_mutex. πŸ’–
  • cur_pos β€” space already used in cur. protected by cur_mutex. tracking the usage, love that for us πŸŽ€
  • default_size β€” default size for the cur command 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 by lock. πŸ’œ
  • 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 if using_mob is 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 πŸ’–:


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