venus: properly enable WSI for different platforms

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10112>
This commit is contained in:
Yiwei Zhang 2021-04-05 21:20:09 +00:00 committed by Marge Bot
parent c6232afde0
commit fc3335a472
3 changed files with 26 additions and 2 deletions

View file

@ -38,7 +38,6 @@ libvn_files = files(
'vn_ring.c',
'vn_renderer_virtgpu.c',
'vn_renderer_vtest.c',
'vn_wsi.c',
)
vn_deps = [
@ -53,6 +52,14 @@ vn_flags = [
no_override_init_args,
]
vn_libs = []
if with_platform_wayland or with_platform_x11
libvn_files += files('vn_wsi.c')
vn_flags += '-DVN_USE_WSI_PLATFORM'
vn_libs += libvulkan_wsi
endif
if with_platform_wayland
libvn_files += files('vn_wsi_wayland.c')
vn_deps += dep_wayland_client
@ -74,7 +81,7 @@ libvulkan_virtio = shared_library(
include_directories : [
inc_include, inc_src, inc_vulkan_wsi, inc_virtio,
],
link_with : [libvulkan_wsi],
link_with : vn_libs,
dependencies : [vn_deps],
c_args : [vn_flags],
link_args : [ld_args_bsymbolic, ld_args_gc_sections],

View file

@ -39,9 +39,11 @@ static const struct vk_instance_extension_table
.KHR_get_physical_device_properties2 = true,
/* WSI */
#ifdef VN_USE_WSI_PLATFORM
.KHR_get_surface_capabilities2 = true,
.KHR_surface = true,
.KHR_surface_protected_capabilities = true,
#endif
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
.KHR_wayland_surface = true,
#endif
@ -1404,9 +1406,11 @@ vn_physical_device_get_supported_extensions(
{
*supported = (struct vk_device_extension_table){
/* WSI */
#ifdef VN_USE_WSI_PLATFORM
.KHR_incremental_present = true,
.KHR_swapchain = true,
.KHR_swapchain_mutable_format = true,
#endif
};
*recognized = (struct vk_device_extension_table){

View file

@ -15,10 +15,23 @@
#include "wsi_common.h"
#ifdef VN_USE_WSI_PLATFORM
VkResult
vn_wsi_init(struct vn_physical_device *physical_dev);
void
vn_wsi_fini(struct vn_physical_device *physical_dev);
#else
static inline VkResult
vn_wsi_init(UNUSED struct vn_physical_device *physical_dev)
{
return VK_SUCCESS;
}
static inline void
vn_wsi_fini(UNUSED struct vn_physical_device *physical_dev)
{
}
#endif
#endif /* VN_WSI_H */