From 7dca2000adcbfb895a84d7224c49d1d19a2e8007 Mon Sep 17 00:00:00 2001 From: Gurchetan Singh Date: Fri, 21 Jun 2024 13:43:07 -0700 Subject: [PATCH] gfxstream: guest: add XCB Surface support This is needed to run X11 apps via libvulkan_gfxstream.so Reviewed-by: Aaron Ruby Acked-by: Yonggang Luo Acked-by: Adam Jackson Part-of: --- src/gfxstream/guest/vulkan/gfxstream_vk_device.cpp | 5 ++++- src/gfxstream/guest/vulkan/meson.build | 11 ++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/gfxstream/guest/vulkan/gfxstream_vk_device.cpp b/src/gfxstream/guest/vulkan/gfxstream_vk_device.cpp index 617f902f0aa..2ccf87e031d 100644 --- a/src/gfxstream/guest/vulkan/gfxstream_vk_device.cpp +++ b/src/gfxstream/guest/vulkan/gfxstream_vk_device.cpp @@ -43,8 +43,11 @@ static struct vk_instance_extension_table gfxstream_vk_instance_extensions_suppo // Provided by Mesa components only; never encoded/decoded through gfxstream static const char* const kMesaOnlyInstanceExtension[] = { VK_KHR_SURFACE_EXTENSION_NAME, -#if defined(LINUX_GUEST_BUILD) +#if defined(GFXSTREAM_VK_WAYLAND) VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME, +#endif +#if defined(GFXSTREAM_VK_X11) + VK_KHR_XCB_SURFACE_EXTENSION_NAME, #endif VK_EXT_DEBUG_UTILS_EXTENSION_NAME, }; diff --git a/src/gfxstream/guest/vulkan/meson.build b/src/gfxstream/guest/vulkan/meson.build index 84a8becf174..9055a9cfae3 100644 --- a/src/gfxstream/guest/vulkan/meson.build +++ b/src/gfxstream/guest/vulkan/meson.build @@ -7,10 +7,19 @@ files_lib_vulkan_gfxstream = files( 'gfxstream_vk_wsi.cpp' ) +gfxstream_vk_wsi_args = [] +if with_platform_x11 + gfxstream_vk_wsi_args += '-DGFXSTREAM_VK_X11' +endif + +if with_platform_wayland + gfxstream_vk_wsi_args += '-DGFXSTREAM_VK_WAYLAND' +endif + lib_vulkan_gfxstream = shared_library( 'vulkan_gfxstream', files_lib_vulkan_gfxstream + files_lib_vulkan_enc + gfxstream_vk_entrypoints, - cpp_args: gfxstream_guest_args, + cpp_args: gfxstream_guest_args + gfxstream_vk_wsi_args, include_directories: [inc_vulkan_headers, inc_opengl_headers, inc_android_emu, inc_android_compat, inc_opengl_system, inc_guest_iostream, inc_opengl_codec, inc_render_enc, inc_vulkan_enc, inc_platform,