mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-15 11:25:26 +00:00
c/main: Compositor targets can set more parameters
Allow compositor targets to require a minimum Vulkan version, and additional optional device extensions.
This commit is contained in:
parent
8df4d0eb96
commit
c5230c075c
|
@ -46,6 +46,8 @@
|
|||
#include "xrt/xrt_config_have.h"
|
||||
#include "xrt/xrt_results.h"
|
||||
|
||||
#include "math/m_api.h"
|
||||
|
||||
#include "os/os_time.h"
|
||||
|
||||
#include "util/u_var.h"
|
||||
|
@ -614,6 +616,14 @@ compositor_init_vulkan(struct comp_compositor *c)
|
|||
optional_device_extensions, //
|
||||
ARRAY_SIZE(optional_device_extensions)); //
|
||||
|
||||
// Add per target optional device extensions.
|
||||
u_string_list_append_array( //
|
||||
optional_device_extension_list, //
|
||||
c->target_factory->optional_device_extensions, //
|
||||
c->target_factory->optional_device_extension_count); //
|
||||
|
||||
// Select required Vulkan version, suitable for both compositor and target
|
||||
uint32_t required_instance_version = MAX(c->target_factory->required_instance_version, VK_API_VERSION_1_0);
|
||||
|
||||
/*
|
||||
* Create the device.
|
||||
|
@ -621,7 +631,7 @@ compositor_init_vulkan(struct comp_compositor *c)
|
|||
|
||||
struct comp_vulkan_arguments vk_args = {
|
||||
.get_instance_proc_address = vkGetInstanceProcAddr,
|
||||
.required_instance_version = VK_MAKE_VERSION(1, 0, 0),
|
||||
.required_instance_version = required_instance_version,
|
||||
.required_instance_extensions = required_instance_ext_list,
|
||||
.optional_instance_extensions = optional_instance_ext_list,
|
||||
.required_device_extensions = required_device_extension_list,
|
||||
|
|
|
@ -593,12 +593,24 @@ struct comp_target_factory
|
|||
*/
|
||||
bool is_deferred;
|
||||
|
||||
/*!
|
||||
* Vulkan version that is required or 0 if no specific
|
||||
* requirement, equivalent to VK_MAKE_VERSION(1, 0, 0)
|
||||
*/
|
||||
uint32_t required_instance_version;
|
||||
|
||||
//! Required instance extensions.
|
||||
const char **required_instance_extensions;
|
||||
|
||||
//! Required instance extension count.
|
||||
size_t required_instance_extension_count;
|
||||
|
||||
//! Optional device extensions.
|
||||
const char **optional_device_extensions;
|
||||
|
||||
//! Optional device extension count.
|
||||
size_t optional_device_extension_count;
|
||||
|
||||
/*!
|
||||
* Checks if this target can be detected, is the preferred target or
|
||||
* some other special consideration that this target should be used over
|
||||
|
|
|
@ -240,8 +240,11 @@ const struct comp_target_factory comp_target_factory_android = {
|
|||
.identifier = "android",
|
||||
.requires_vulkan_for_create = false,
|
||||
.is_deferred = true,
|
||||
.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,
|
||||
};
|
||||
|
|
|
@ -476,8 +476,11 @@ const struct comp_target_factory comp_target_factory_direct_nvidia = {
|
|||
.identifier = "x11_direct_nvidia",
|
||||
.requires_vulkan_for_create = true,
|
||||
.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,
|
||||
};
|
||||
|
|
|
@ -502,8 +502,11 @@ const struct comp_target_factory comp_target_factory_direct_randr = {
|
|||
.identifier = "x11_direct",
|
||||
.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,
|
||||
};
|
||||
|
|
|
@ -506,8 +506,11 @@ const struct comp_target_factory comp_target_factory_direct_wayland = {
|
|||
.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,
|
||||
};
|
||||
|
|
|
@ -438,8 +438,11 @@ const struct comp_target_factory comp_target_factory_mswin = {
|
|||
.identifier = "mswin",
|
||||
.requires_vulkan_for_create = false,
|
||||
.is_deferred = true,
|
||||
.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,
|
||||
};
|
||||
|
|
|
@ -301,8 +301,11 @@ const struct comp_target_factory comp_target_factory_vk_display = {
|
|||
.identifier = "vk_display",
|
||||
.requires_vulkan_for_create = true,
|
||||
.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,
|
||||
};
|
||||
|
|
|
@ -387,8 +387,11 @@ const struct comp_target_factory comp_target_factory_wayland = {
|
|||
.identifier = "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,
|
||||
};
|
||||
|
|
|
@ -496,8 +496,11 @@ const struct comp_target_factory comp_target_factory_xcb = {
|
|||
.identifier = "x11",
|
||||
.requires_vulkan_for_create = false,
|
||||
.is_deferred = true,
|
||||
.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,
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue