Monado OpenXR Runtime
comp_window_peek.c File Reference

Displays the content of one or both eye onto a desktop window. More...

#include "main/comp_compositor.h"
#include "main/comp_target_swapchain.h"
#include "main/comp_window_peek.h"
#include "util/u_debug.h"
#include "util/u_string_list.h"
#include <SDL2/SDL_vulkan.h>
Include dependency graph for comp_window_peek.c:

Data Structures

struct  comp_window_peek
 

Macros

#define PEEK_IMAGE_USAGE   (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT)
 

Functions

static struct vk_bundleget_vk (struct comp_window_peek *w)
 
static void create_images (struct comp_window_peek *w)
 
static void * window_peek_run_thread (void *ptr)
 
struct comp_window_peekcomp_window_peek_create (struct comp_compositor *c)
 
void comp_window_peek_destroy (struct comp_window_peek **w_ptr)
 
void comp_window_peek_blit (struct comp_window_peek *w, VkImage src, int32_t width, int32_t height)
 
enum comp_window_peek_eye comp_window_peek_get_eye (struct comp_window_peek *w)
 Getter for the peek window's eye enum. More...
 
bool comp_window_peek_get_vk_instance_exts (struct u_string_list *out_required_list)
 Gets the required vulkan instance extensions for comp_window_peek support. More...
 

Detailed Description

Displays the content of one or both eye onto a desktop window.

Author
Simon Zeni simon.nosp@m.@bl4.nosp@m.ckb0n.nosp@m.e.ca

Function Documentation

◆ comp_window_peek_get_eye()

enum comp_window_peek_eye comp_window_peek_get_eye ( struct comp_window_peek w)

Getter for the peek window's eye enum.

This is a getter function so that struct comp_window_peek can be private.

Parameters
[in]wThe peek window struct this compositor has.
Returns
The eye that the peek window wants to display.

◆ comp_window_peek_get_vk_instance_exts()

bool comp_window_peek_get_vk_instance_exts ( struct u_string_list out_required_list)

Gets the required vulkan instance extensions for comp_window_peek support.

Parameters
[in,out]out_required_listlist of string containing the required instance extensions to enable, the list may already contain some/all of the required, duplicates will not be added.

NOTE: The SDL2 function SDL_Vulkan_GetInstanceExtensions requires an SDL_Window but the compositor needs to know which vk (instance) extensions are required much earlier than when comp_window_peek is created.

API docs for SDL_Vulkan_GetInstanceExtensions states that in future versions this parameter will be removed so for now just create a temporary, tiny window.

WARNING: The extension name strings will not be deeply copied, the docs for SDL_Vulkan_GetInstanceExtensions do not state the life time of these strings.

based on looking the current codebase these are copied from function-level static arrays containing string literals (expanded from vulkan header macros, e.g. VK_FOO_EXTENSION_NAME) so we can assume it's safe to pass around but future versions this may change, they may get destroyed when deleting the SDL_Window (although check note comment above).

References U_LOG_E, U_LOG_T, u_string_list::u_string_list_append_unique(), and U_TYPED_ARRAY_CALLOC.