Monado OpenXR Runtime
Loading...
Searching...
No Matches
vk_cmd_pool Struct Reference

Small helper to manage lock around a command pool. More...

#include <vk/vk_cmd_pool.h>

Collaboration diagram for vk_cmd_pool:

Public Member Functions

XRT_CHECK_RESULT VkResult vk_cmd_pool_init_for_queue (struct vk_bundle *vk, struct vk_cmd_pool *pool, VkCommandPoolCreateFlags flags, struct vk_bundle_queue *queue)
 Create a command buffer pool.
 
void vk_cmd_pool_destroy (struct vk_bundle *vk, struct vk_cmd_pool *pool)
 Destroy a command buffer pool, lock must not be held, externally synchronizable with all other pool commands.
 
XRT_CHECK_RESULT VkResult vk_cmd_pool_create_cmd_buffer_locked (struct vk_bundle *vk, struct vk_cmd_pool *pool, VkCommandBuffer *out_cmd_buffer)
 Create a command buffer, call with the pool mutex held.
 
XRT_CHECK_RESULT VkResult vk_cmd_pool_create_and_begin_cmd_buffer_locked (struct vk_bundle *vk, struct vk_cmd_pool *pool, VkCommandBufferUsageFlags flags, VkCommandBuffer *out_cmd_buffer)
 Create a command buffer and also begin it, call with the pool mutex held.
 
XRT_CHECK_RESULT VkResult vk_cmd_pool_submit_cmd_buffer_locked (struct vk_bundle *vk, struct vk_cmd_pool *pool, VkCommandBuffer cmd_buffer)
 Submit to the vulkan queue, will take the queue mutex.
 

Static Public Member Functions

static XRT_CHECK_RESULT VkResult vk_cmd_pool_init (struct vk_bundle *vk, struct vk_cmd_pool *pool, VkCommandPoolCreateFlags flags)
 Create a command buffer pool.
 
static XRT_CHECK_RESULT VkResult vk_cmd_pool_end_submit_wait_and_free_cmd_buffer_locked (struct vk_bundle *vk, struct vk_cmd_pool *pool, VkCommandBuffer cmd_buffer)
 A do everything submit function, will take the queue mutex.
 
static void vk_cmd_pool_lock (struct vk_cmd_pool *pool)
 Lock the command pool, needed for creating command buffers, filling out commands on any command buffers created from this pool and submitting any command buffers created from this pool to a VkQueue.
 
static void vk_cmd_pool_unlock (struct vk_cmd_pool *pool)
 Unlock the command pool.
 
static XRT_CHECK_RESULT VkResult vk_cmd_pool_create_cmd_buffer (struct vk_bundle *vk, struct vk_cmd_pool *pool, VkCommandBuffer *out_cmd_buffer)
 Locks, calls vk_cmd_pool_create_cmd_buffer_locked, and then unlocks the command pool.
 
static XRT_CHECK_RESULT VkResult vk_cmd_pool_create_and_begin_cmd_buffer (struct vk_bundle *vk, struct vk_cmd_pool *pool, VkCommandBufferUsageFlags flags, VkCommandBuffer *out_cmd_buffer)
 Locks, calls vk_cmd_pool_create_and_begin_cmd_buffer_locked, and then unlocks the command pool.
 
static XRT_CHECK_RESULT VkResult vk_cmd_pool_submit (struct vk_bundle *vk, struct vk_cmd_pool *pool, uint32_t count, const VkSubmitInfo *infos, VkFence fence)
 Locks, calls vk_cmd_submit_locked, and then unlocks the command pool.
 
static XRT_CHECK_RESULT VkResult vk_cmd_pool_submit_cmd_buffer (struct vk_bundle *vk, struct vk_cmd_pool *pool, VkCommandBuffer cmd_buffer)
 Locks, calls vk_cmd_pool_submit_cmd_buffer_locked, and then unlocks the command pool.
 
static XRT_CHECK_RESULT VkResult vk_cmd_pool_end_submit_wait_and_free_cmd_buffer (struct vk_bundle *vk, struct vk_cmd_pool *pool, VkCommandBuffer cmd_buffer)
 Locks, calls vk_cmd_pool_end_submit_wait_and_free_cmd_buffer_locked, and then unlocks the command pool.
 

Data Fields

VkCommandPool pool
 The command pool for command buffers.
 
struct vk_bundle_queuequeue
 Queue (family) associated with vk_cmd_pool::pool,.
 
struct os_mutex mutex
 Command Pool mutex.
 

Detailed Description

Small helper to manage lock around a command pool.

Member Function Documentation

◆ vk_cmd_pool_create_and_begin_cmd_buffer()

static XRT_CHECK_RESULT VkResult vk_cmd_pool_create_and_begin_cmd_buffer ( struct vk_bundle vk,
struct vk_cmd_pool pool,
VkCommandBufferUsageFlags  flags,
VkCommandBuffer *  out_cmd_buffer 
)
inlinestatic

Locks, calls vk_cmd_pool_create_and_begin_cmd_buffer_locked, and then unlocks the command pool.

◆ vk_cmd_pool_create_and_begin_cmd_buffer_locked()

XRT_CHECK_RESULT VkResult vk_cmd_pool_create_and_begin_cmd_buffer_locked ( struct vk_bundle vk,
struct vk_cmd_pool pool,
VkCommandBufferUsageFlags  flags,
VkCommandBuffer *  out_cmd_buffer 
)

Create a command buffer and also begin it, call with the pool mutex held.

Precondition
Command pool lock must be held.

Referenced by comp_mirror_to_debug_gui::comp_mirror_do_blit(), and do_post_create_vulkan_setup().

◆ vk_cmd_pool_create_cmd_buffer()

static XRT_CHECK_RESULT VkResult vk_cmd_pool_create_cmd_buffer ( struct vk_bundle vk,
struct vk_cmd_pool pool,
VkCommandBuffer *  out_cmd_buffer 
)
inlinestatic

Locks, calls vk_cmd_pool_create_cmd_buffer_locked, and then unlocks the command pool.

◆ vk_cmd_pool_create_cmd_buffer_locked()

XRT_CHECK_RESULT VkResult vk_cmd_pool_create_cmd_buffer_locked ( struct vk_bundle vk,
struct vk_cmd_pool pool,
VkCommandBuffer *  out_cmd_buffer 
)

Create a command buffer, call with the pool mutex held.

Precondition
Command pool lock must be held, see vk_cmd_pool_lock.

◆ vk_cmd_pool_destroy()

void vk_cmd_pool_destroy ( struct vk_bundle vk,
struct vk_cmd_pool pool 
)

Destroy a command buffer pool, lock must not be held, externally synchronizable with all other pool commands.

References pool::mutex.

◆ vk_cmd_pool_end_submit_wait_and_free_cmd_buffer()

static XRT_CHECK_RESULT VkResult vk_cmd_pool_end_submit_wait_and_free_cmd_buffer ( struct vk_bundle vk,
struct vk_cmd_pool pool,
VkCommandBuffer  cmd_buffer 
)
inlinestatic

Locks, calls vk_cmd_pool_end_submit_wait_and_free_cmd_buffer_locked, and then unlocks the command pool.

Will during the call take the queue lock and release it.

◆ vk_cmd_pool_end_submit_wait_and_free_cmd_buffer_locked()

static XRT_CHECK_RESULT VkResult vk_cmd_pool_end_submit_wait_and_free_cmd_buffer_locked ( struct vk_bundle vk,
struct vk_cmd_pool pool,
VkCommandBuffer  cmd_buffer 
)
inlinestatic

A do everything submit function, will take the queue mutex.

Will create a fence and wait on the commands to complete. Will also end and destroy the passed in command buffer.

Precondition
Command pool lock must be held, see vk_cmd_pool_lock.

Calls:

  • vkEndCommandBuffer
  • vkCreateFence
  • vkWaitForFences
  • vkDestroyFence
  • vkFreeCommandBuffers

References vk_cmd_end_submit_wait_and_free_cmd_buffer_locked().

Referenced by do_post_create_vulkan_setup().

◆ vk_cmd_pool_init()

static XRT_CHECK_RESULT VkResult vk_cmd_pool_init ( struct vk_bundle vk,
struct vk_cmd_pool pool,
VkCommandPoolCreateFlags  flags 
)
inlinestatic

Create a command buffer pool.

References vk_bundle::main_queue.

◆ vk_cmd_pool_init_for_queue()

XRT_CHECK_RESULT VkResult vk_cmd_pool_init_for_queue ( struct vk_bundle vk,
struct vk_cmd_pool pool,
VkCommandPoolCreateFlags  flags,
struct vk_bundle_queue queue 
)

Create a command buffer pool.

References vk_bundle_queue::family_index, and pool::mutex.

◆ vk_cmd_pool_lock()

static void vk_cmd_pool_lock ( struct vk_cmd_pool pool)
inlinestatic

Lock the command pool, needed for creating command buffers, filling out commands on any command buffers created from this pool and submitting any command buffers created from this pool to a VkQueue.

References pool::mutex, and os_mutex::os_mutex_lock().

Referenced by comp_mirror_to_debug_gui::comp_mirror_do_blit(), and do_post_create_vulkan_setup().

◆ vk_cmd_pool_submit()

static XRT_CHECK_RESULT VkResult vk_cmd_pool_submit ( struct vk_bundle vk,
struct vk_cmd_pool pool,
uint32_t  count,
const VkSubmitInfo *  infos,
VkFence  fence 
)
inlinestatic

Locks, calls vk_cmd_submit_locked, and then unlocks the command pool.

Will, during the call, take the queue lock and release it.

References vk_cmd_submit_locked().

◆ vk_cmd_pool_submit_cmd_buffer()

static XRT_CHECK_RESULT VkResult vk_cmd_pool_submit_cmd_buffer ( struct vk_bundle vk,
struct vk_cmd_pool pool,
VkCommandBuffer  cmd_buffer 
)
inlinestatic

Locks, calls vk_cmd_pool_submit_cmd_buffer_locked, and then unlocks the command pool.

Will during the call take the queue lock and release it.

◆ vk_cmd_pool_submit_cmd_buffer_locked()

XRT_CHECK_RESULT VkResult vk_cmd_pool_submit_cmd_buffer_locked ( struct vk_bundle vk,
struct vk_cmd_pool pool,
VkCommandBuffer  cmd_buffer 
)

Submit to the vulkan queue, will take the queue mutex.

Precondition
Command pool lock must be held, see vk_cmd_pool_lock.

References vk_cmd_submit_locked().

◆ vk_cmd_pool_unlock()

static void vk_cmd_pool_unlock ( struct vk_cmd_pool pool)
inlinestatic

Field Documentation

◆ mutex

struct os_mutex vk_cmd_pool::mutex

Command Pool mutex.

◆ pool

VkCommandPool vk_cmd_pool::pool

◆ queue

struct vk_bundle_queue* vk_cmd_pool::queue

Queue (family) associated with vk_cmd_pool::pool,.

weak reference to any queue in vk_bundle (e.g. vk_bundle::[graphics|compute]_queue) should not live longer than the vk_bundle instance.


The documentation for this struct was generated from the following file: