Monado OpenXR Runtime
comp_swapchain.c File Reference

Independent swapchain implementation. More...

#include "xrt/xrt_compiler.h"
#include "xrt/xrt_handles.h"
#include "xrt/xrt_config_os.h"
#include "xrt/xrt_results.h"
#include "util/u_misc.h"
#include "util/u_handles.h"
#include "util/u_trace_marker.h"
#include "util/u_limited_unique_id.h"
#include "vk/vk_helpers.h"
#include "vk/vk_cmd_pool.h"
#include "vk/vk_mini_helpers.h"
#include "util/comp_swapchain.h"
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <errno.h>
Include dependency graph for comp_swapchain.c:

Functions

static void swapchain_destroy (struct xrt_swapchain *xsc)
 
static xrt_result_t swapchain_acquire_image (struct xrt_swapchain *xsc, uint32_t *out_index)
 
static xrt_result_t swapchain_inc_image_use (struct xrt_swapchain *xsc, uint32_t index)
 
static xrt_result_t swapchain_dec_image_use (struct xrt_swapchain *xsc, uint32_t index)
 
static xrt_result_t swapchain_wait_image (struct xrt_swapchain *xsc, uint64_t timeout_ns, uint32_t index)
 
static xrt_result_t swapchain_release_image (struct xrt_swapchain *xsc, uint32_t index)
 
static struct comp_swapchainset_common_fields (struct comp_swapchain *sc, comp_swapchain_destroy_func_t destroy_func, struct vk_bundle *vk, struct comp_swapchain_shared *cscs, uint32_t image_count)
 
static void image_view_array_cleanup (struct vk_bundle *vk, size_t array_size, VkImageView **views_ptr)
 
static void image_cleanup (struct vk_bundle *vk, struct comp_swapchain_image *image)
 Free and destroy any initialized fields on the given image, safe to pass in images that has one or all fields set to NULL. More...
 
static void cleanup_post_create_vulkan_setup (struct vk_bundle *vk, struct comp_swapchain *sc)
 
static XRT_CHECK_RESULT xrt_result_t do_post_create_vulkan_setup (struct vk_bundle *vk, const struct xrt_swapchain_create_info *info, struct comp_swapchain *sc)
 
static void really_destroy (struct comp_swapchain *sc)
 Swapchain destruct is delayed until it is safe to destroy them, this function does the actual destruction and is called from comp_swapchain_shared_garbage_collect. More...
 
xrt_result_t comp_swapchain_create_init (struct comp_swapchain *sc, comp_swapchain_destroy_func_t destroy_func, struct vk_bundle *vk, struct comp_swapchain_shared *cscs, const struct xrt_swapchain_create_info *info, const struct xrt_swapchain_create_properties *xsccp)
 Helper to init a comp_swachain struct as if it was a create operation, useful for wrapping comp_swapchain within another struct. More...
 
xrt_result_t comp_swapchain_import_init (struct comp_swapchain *sc, comp_swapchain_destroy_func_t destroy_func, struct vk_bundle *vk, struct comp_swapchain_shared *cscs, const struct xrt_swapchain_create_info *info, struct xrt_image_native *native_images, uint32_t native_image_count)
 Helper to init a comp_swachain struct as if it was a import operation, useful for wrapping comp_swapchain within another struct. More...
 
void comp_swapchain_teardown (struct comp_swapchain *sc)
 De-inits a comp_swapchain, usable for classes sub-classing comp_swapchain. More...
 
XRT_CHECK_RESULT xrt_result_t comp_swapchain_shared_init (struct comp_swapchain_shared *cscs, struct vk_bundle *vk)
 Create the shared struct. More...
 
void comp_swapchain_shared_destroy (struct comp_swapchain_shared *cscs, struct vk_bundle *vk)
 Destroy the shared struct. More...
 
void comp_swapchain_shared_garbage_collect (struct comp_swapchain_shared *cscs)
 Do garbage collection, destroying any resources that has been scheduled for destruction from other threads. More...
 
xrt_result_t comp_swapchain_get_create_properties (const struct xrt_swapchain_create_info *info, struct xrt_swapchain_create_properties *xsccp)
 A compositor function that is implemented in the swapchain code. More...
 
xrt_result_t comp_swapchain_create (struct vk_bundle *vk, struct comp_swapchain_shared *cscs, const struct xrt_swapchain_create_info *info, const struct xrt_swapchain_create_properties *xsccp, struct xrt_swapchain **out_xsc)
 A compositor function that is implemented in the swapchain code. More...
 
xrt_result_t comp_swapchain_import (struct vk_bundle *vk, struct comp_swapchain_shared *cscs, const struct xrt_swapchain_create_info *info, struct xrt_image_native *native_images, uint32_t native_image_count, struct xrt_swapchain **out_xsc)
 A compositor function that is implemented in the swapchain code. More...
 

Detailed Description

Independent swapchain implementation.

Author
Jakob Bornecrantz jakob.nosp@m.@col.nosp@m.labor.nosp@m.a.co.nosp@m.m

Function Documentation

◆ do_post_create_vulkan_setup()

static XRT_CHECK_RESULT xrt_result_t do_post_create_vulkan_setup ( struct vk_bundle vk,
const struct xrt_swapchain_create_info info,
struct comp_swapchain sc 
)
static

◆ image_cleanup()

static void image_cleanup ( struct vk_bundle vk,
struct comp_swapchain_image image 
)
static

Free and destroy any initialized fields on the given image, safe to pass in images that has one or all fields set to NULL.

References os_mutex::os_mutex_lock(), and os_mutex::os_mutex_unlock().