From 6dc169e18f6991836be5172adae7c5766cda3366 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Wed, 20 Apr 2016 19:15:18 +0100 Subject: [PATCH] anv: factor out the X11/XCB build Similar to earlier commit - move all the common bits into a single place, thus improving readability and allowing us to see what's missing. Also don't forget to add the missing bits. This commit should allows us to build wayland only vulkan ;-) Signed-off-by: Emil Velikov Acked-by: Jason Ekstrand --- src/intel/vulkan/Makefile.am | 23 +++++++++++++++++------ src/intel/vulkan/anv_device.c | 2 ++ src/intel/vulkan/anv_wsi.c | 4 ++++ 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/intel/vulkan/Makefile.am b/src/intel/vulkan/Makefile.am index 98784aa2714..5289860b504 100644 --- a/src/intel/vulkan/Makefile.am +++ b/src/intel/vulkan/Makefile.am @@ -30,8 +30,7 @@ vulkan_include_HEADERS = \ # Used when generating entrypoints to filter out unwanted extensions VULKAN_ENTRYPOINT_CPPFLAGS = \ - -I$(top_srcdir)/include/vulkan \ - -DVK_USE_PLATFORM_XCB_KHR + -I$(top_srcdir)/include/vulkan lib_LTLIBRARIES = libvulkan_intel.la @@ -66,12 +65,11 @@ AM_CPPFLAGS = \ -I$(top_builddir)/src/compiler/nir \ -I$(top_builddir)/src/intel -AM_CFLAGS = -DVK_USE_PLATFORM_XCB_KHR -Wno-override-init -msse2 +AM_CFLAGS = -Wno-override-init -msse2 VULKAN_SOURCES = \ $(VULKAN_GENERATED_FILES) \ - $(VULKAN_FILES) \ - $(VULKAN_WSI_X11_FILES) + $(VULKAN_FILES) VULKAN_LIB_DEPS = @@ -91,6 +89,20 @@ libanv_gen8_la_SOURCES = $(GEN8_FILES) libanv_gen9_la_CFLAGS = $(AM_CFLAGS) -DGEN_VERSIONx10=90 libanv_gen9_la_SOURCES = $(GEN9_FILES) + +if HAVE_EGL_PLATFORM_X11 +VULKAN_ENTRYPOINT_CPPFLAGS += \ + -DVK_USE_PLATFORM_XCB_KHR + +AM_CPPFLAGS += \ + $(XCB_DRI3_CFLAGS) \ + -DVK_USE_PLATFORM_XCB_KHR + +VULKAN_SOURCES += $(VULKAN_WSI_X11_FILES) +VULKAN_LIB_DEPS += $(XCB_DRI3_LIBS) +endif + + if HAVE_EGL_PLATFORM_WAYLAND VULKAN_ENTRYPOINT_CPPFLAGS += -DVK_USE_PLATFORM_WAYLAND_KHR @@ -112,7 +124,6 @@ libvulkan_common_la_SOURCES = $(VULKAN_SOURCES) VULKAN_LIB_DEPS += \ libvulkan_common.la \ - -lxcb -lxcb-dri3 -lxcb-present -lxcb-sync -lxshmfence \ $(top_builddir)/src/intel/isl/libisl.la \ $(top_builddir)/src/mesa/drivers/dri/i965/libi965_compiler.la \ $(top_builddir)/src/mesa/libmesa.la \ diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 03a14392b4d..02b96ca3d69 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -170,10 +170,12 @@ static const VkExtensionProperties global_extensions[] = { .extensionName = VK_KHR_SURFACE_EXTENSION_NAME, .specVersion = 25, }, +#ifdef VK_USE_PLATFORM_XCB_KHR { .extensionName = VK_KHR_XCB_SURFACE_EXTENSION_NAME, .specVersion = 5, }, +#endif #ifdef VK_USE_PLATFORM_WAYLAND_KHR { .extensionName = VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME, diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c index 850e14fd60d..49edbdc2f99 100644 --- a/src/intel/vulkan/anv_wsi.c +++ b/src/intel/vulkan/anv_wsi.c @@ -28,9 +28,11 @@ anv_init_wsi(struct anv_instance *instance) { VkResult result; +#ifdef VK_USE_PLATFORM_XCB_KHR result = anv_x11_init_wsi(instance); if (result != VK_SUCCESS) return result; +#endif #ifdef VK_USE_PLATFORM_WAYLAND_KHR result = anv_wl_init_wsi(instance); @@ -49,7 +51,9 @@ anv_finish_wsi(struct anv_instance *instance) #ifdef VK_USE_PLATFORM_WAYLAND_KHR anv_wl_finish_wsi(instance); #endif +#ifdef VK_USE_PLATFORM_XCB_KHR anv_x11_finish_wsi(instance); +#endif } void anv_DestroySurfaceKHR( -- 2.30.2