Commit 0aeda708 authored by Drew DeVault's avatar Drew DeVault Committed by Simon Ser

Implement WINDOW_DIRECT_WAYLAND

parent 9347ecfe
Pipeline #80147 failed with stages
in 7 minutes and 55 seconds
......@@ -723,6 +723,7 @@ vk_get_instance_functions(struct vk_bundle *vk)
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
vk->vkCreateWaylandSurfaceKHR = GET_INS_PROC(vk, vkCreateWaylandSurfaceKHR);
vk->vkAcquireWaylandDisplayEXT = GET_INS_PROC(vk, vkAcquireWaylandDisplayEXT);
#endif
#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
......
......@@ -65,6 +65,7 @@ struct vk_bundle
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
PFN_vkCreateWaylandSurfaceKHR vkCreateWaylandSurfaceKHR;
PFN_vkAcquireWaylandDisplayEXT vkAcquireWaylandDisplayEXT;
#endif
#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
......
This diff is collapsed.
......@@ -311,6 +311,13 @@ static const char *instance_extensions_wayland[] = {
COMPOSITOR_COMMON_VULKAN_EXTENSIONS,
VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME,
};
static const char *instance_extensions_wayland_direct[] = {
COMPOSITOR_COMMON_VULKAN_EXTENSIONS,
VK_KHR_DISPLAY_EXTENSION_NAME,
VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME,
VK_EXT_ACQUIRE_WL_DISPLAY_EXTENSION_NAME,
};
#endif
#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
......@@ -333,6 +340,10 @@ select_instances_extensions(struct comp_compositor *c,
*out_num = ARRAY_SIZE(instance_extensions_none);
break;
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
case WINDOW_DIRECT_WAYLAND:
*out_exts = instance_extensions_wayland_direct;
*out_num = ARRAY_SIZE(instance_extensions_wayland_direct);
break;
case WINDOW_WAYLAND:
*out_exts = instance_extensions_wayland;
*out_num = ARRAY_SIZE(instance_extensions_wayland);
......@@ -643,6 +654,10 @@ compositor_init_window_pre_vulkan(struct comp_compositor *c)
switch (c->settings.window_type) {
case WINDOW_AUTO:
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
if (compositor_try_window(c, comp_window_wayland_direct_create(c))) {
c->settings.window_type = WINDOW_DIRECT_WAYLAND;
return true;
}
if (compositor_try_window(c, comp_window_wayland_create(c))) {
c->settings.window_type = WINDOW_WAYLAND;
return true;
......@@ -674,6 +689,13 @@ compositor_init_window_pre_vulkan(struct comp_compositor *c)
compositor_try_window(c, comp_window_wayland_create(c));
#else
COMP_ERROR(c, "Wayland support not compiled in!");
#endif
break;
case WINDOW_DIRECT_WAYLAND:
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
compositor_try_window(c, comp_window_wayland_direct_create(c));
#else
COMP_ERROR(c, "Wayland support not compiled in!");
#endif
break;
case WINDOW_DIRECT_RANDR:
......
......@@ -14,6 +14,7 @@
DEBUG_GET_ONCE_BOOL_OPTION(print_spew, "XRT_COMPOSITOR_PRINT_SPEW", false)
DEBUG_GET_ONCE_BOOL_OPTION(print_debug, "XRT_COMPOSITOR_PRINT_DEBUG", false)
DEBUG_GET_ONCE_BOOL_OPTION(force_randr, "XRT_COMPOSITOR_FORCE_RANDR", false)
DEBUG_GET_ONCE_BOOL_OPTION(force_wayland_direct, "XRT_COMPOSITOR_FORCE_WAYLAND_DIRECT", false)
DEBUG_GET_ONCE_BOOL_OPTION(force_nvidia, "XRT_COMPOSITOR_FORCE_NVIDIA", false)
DEBUG_GET_ONCE_BOOL_OPTION(force_xcb, "XRT_COMPOSITOR_FORCE_XCB", false)
DEBUG_GET_ONCE_BOOL_OPTION(force_wayland, "XRT_COMPOSITOR_FORCE_WAYLAND", false)
......@@ -52,6 +53,9 @@ comp_settings_init(struct comp_settings *s, struct xrt_device *xdev)
if (debug_get_bool_option_force_randr()) {
s->window_type = WINDOW_DIRECT_RANDR;
}
if (debug_get_bool_option_force_wayland_direct()) {
s->window_type = WINDOW_DIRECT_WAYLAND;
}
if (debug_get_bool_option_force_xcb()) {
s->window_type = WINDOW_XCB;
......
......@@ -40,6 +40,7 @@ enum window_type
WINDOW_AUTO,
WINDOW_XCB,
WINDOW_WAYLAND,
WINDOW_DIRECT_WAYLAND,
WINDOW_DIRECT_RANDR,
WINDOW_DIRECT_NVIDIA,
};
......
......@@ -74,6 +74,14 @@ comp_window_xcb_create(struct comp_compositor *c);
*/
struct comp_window *
comp_window_wayland_create(struct comp_compositor *c);
/*!
* Create a direct surface to a HMD via Wayland.
*
* @ingroup comp
*/
struct comp_window *
comp_window_wayland_direct_create(struct comp_compositor *c);
#endif
#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
......
This diff is collapsed.
......@@ -57,6 +57,7 @@ if wayland.found() and wayland_protos.found() and wayland_scanner.found()
protocols = [
[wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'],
['drm-lease-unstable-v1.xml'],
]
foreach p : protocols
......@@ -87,7 +88,10 @@ if wayland.found() and wayland_protos.found() and wayland_scanner.found()
)
compile_args += ['-DVK_USE_PLATFORM_WAYLAND_KHR']
compositor_srcs += ['main/comp_window_wayland.c']
compositor_srcs += [
'main/comp_window_wayland.c',
'main/comp_window_wayland_direct.c',
]
compositor_deps += [wayland, wl_protos]
endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment