Monado OpenXR Runtime
comp_window_direct_wayland.c File Reference

Wayland direct mode code. More...

#include <errno.h>
#include <linux/input.h>
#include <poll.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <wayland-client.h>
#include <xf86drm.h>
#include "drm-lease-v1-client-protocol.h"
#include "xrt/xrt_compiler.h"
#include "main/comp_window.h"
#include "main/comp_window_direct.h"
Include dependency graph for comp_window_direct_wayland.c:

Data Structures

struct  direct_wayland_lease
 
struct  direct_wayland_lease_connector
 
struct  direct_wayland_lease_device
 
struct  comp_window_direct_wayland
 

Functions

static void direct_wayland_lease_device_destroy (struct direct_wayland_lease_device *dev)
 
static void comp_window_direct_wayland_destroy (struct comp_target *w)
 
static struct vk_bundleget_vk (struct comp_window_direct_wayland *cww)
 
static void _lease_fd (void *data, struct wp_drm_lease_v1 *wp_drm_lease_v1, int32_t leased_fd)
 
static void _lease_finished (void *data, struct wp_drm_lease_v1 *wp_drm_lease_v1)
 
static VkResult comp_window_direct_wayland_create_surface (struct comp_window_direct_wayland *w, VkSurfaceKHR *surface, uint32_t width, uint32_t height)
 
static bool comp_window_direct_wayland_init_swapchain (struct comp_target *w, uint32_t width, uint32_t height)
 
static void comp_window_direct_wayland_flush (struct comp_target *w)
 
static void _lease_connector_name (void *data, struct wp_drm_lease_connector_v1 *wp_drm_lease_connector_v1, const char *name)
 
static void _lease_connector_description (void *data, struct wp_drm_lease_connector_v1 *wp_drm_lease_connector_v1, const char *description)
 
static void _lease_connector_connector_id (void *data, struct wp_drm_lease_connector_v1 *wp_drm_lease_connector_v1, uint32_t connector_id)
 
static void _lease_connector_done (void *data, struct wp_drm_lease_connector_v1 *wp_drm_lease_connector_v1)
 
static void _lease_connector_withdrawn (void *data, struct wp_drm_lease_connector_v1 *wp_drm_lease_connector_v1)
 
static void _drm_lease_device_drm_fd (void *data, struct wp_drm_lease_device_v1 *drm_lease_device, int fd)
 
static void _drm_lease_device_connector (void *data, struct wp_drm_lease_device_v1 *wp_drm_lease_device_v1, struct wp_drm_lease_connector_v1 *wp_drm_lease_connector_v1)
 
static void _drm_lease_device_done (void *data, struct wp_drm_lease_device_v1 *wp_drm_lease_device_v1)
 
static void _drm_lease_device_released (void *data, struct wp_drm_lease_device_v1 *wp_drm_lease_device_v1)
 
static void _registry_global_remove_cb (void *data, struct wl_registry *registry, uint32_t name)
 
static void _registry_global_cb (void *data, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t version)
 
static bool comp_window_direct_wayland_init (struct comp_target *w)
 
static void _update_window_title (struct comp_target *ct, const char *title)
 
struct comp_targetcomp_window_direct_wayland_create (struct comp_compositor *c)
 Create a direct surface to a HMD using Wayland. More...
 
static bool detect (const struct comp_target_factory *ctf, struct comp_compositor *c)
 
static bool create_target (const struct comp_target_factory *ctf, struct comp_compositor *c, struct comp_target **out_ct)
 

Variables

static const struct wp_drm_lease_v1_listener lease_listener
 
static const struct wp_drm_lease_connector_v1_listener lease_connector_listener
 
static const struct wp_drm_lease_device_v1_listener drm_lease_device_listener
 
static const struct wl_registry_listener registry_listener
 
static const char * instance_extensions []
 
const struct comp_target_factory comp_target_factory_direct_wayland
 

Detailed Description

Variable Documentation

◆ comp_target_factory_direct_wayland

const struct comp_target_factory comp_target_factory_direct_wayland
Initial value:
= {
.name = "Wayland Direct-Mode",
.identifier = "direct_wayland",
.requires_vulkan_for_create = false,
.is_deferred = false,
.required_instance_version = 0,
.required_instance_extensions = instance_extensions,
.required_instance_extension_count = ARRAY_SIZE(instance_extensions),
.optional_device_extensions = NULL,
.optional_device_extension_count = 0,
.detect = detect,
.create_target = create_target,
}
#define ARRAY_SIZE(a)
Array size helper.
Definition: xrt_compiler.h:29

◆ drm_lease_device_listener

const struct wp_drm_lease_device_v1_listener drm_lease_device_listener
static
Initial value:
= {
.drm_fd = _drm_lease_device_drm_fd,
.connector = _drm_lease_device_connector,
.done = _drm_lease_device_done,
.released = _drm_lease_device_released,
}

◆ instance_extensions

const char* instance_extensions[]
static
Initial value:
= {
VK_KHR_DISPLAY_EXTENSION_NAME,
VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME,
VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME,
}

◆ lease_connector_listener

const struct wp_drm_lease_connector_v1_listener lease_connector_listener
static
Initial value:
= {
.name = _lease_connector_name,
.description = _lease_connector_description,
.connector_id = _lease_connector_connector_id,
.done = _lease_connector_done,
.withdrawn = _lease_connector_withdrawn,
}

◆ lease_listener

const struct wp_drm_lease_v1_listener lease_listener
static
Initial value:
= {
.lease_fd = _lease_fd,
.finished = _lease_finished,
}

◆ registry_listener

const struct wl_registry_listener registry_listener
static
Initial value:
= {
.global = _registry_global_cb,
.global_remove = _registry_global_remove_cb,
}